* [COMMITTED] ada: Cleanup calculation of task stacks
@ 2024-05-07 8:00 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-05-07 8:00 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
From: Piotr Trojanek <trojanek@adacore.com>
Code cleanup; semantics is unaffected.
gcc/ada/
* exp_ch3.adb (Count_Default_Sized_Task_Stacks): Do not look for
tasks inside record discriminants; remove avoid repeated call to
Has_Task that happened for record components.
(Expand_N_Object_Declaration): Use high-level routine to detect
array types and subtypes; remove unused initial values.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_ch3.adb | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 4c0679f531b..e9fab87365c 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -6752,27 +6752,23 @@ package body Exp_Ch3 is
| E_Record_Subtype
| E_Record_Type
=>
- Component := First_Component_Or_Discriminant (Typ);
+ Component := First_Component (Typ);
-- Recursively descend each component of the composite type
- -- looking for tasks, but only if the component is marked as
- -- having a task.
+ -- looking for tasks.
while Present (Component) loop
- if Has_Task (Etype (Component)) then
- declare
- P : Int;
- S : Int;
+ declare
+ P : Int;
+ S : Int;
- begin
- Count_Default_Sized_Task_Stacks
- (Etype (Component), P, S);
- Pri_Stacks := Pri_Stacks + P;
- Sec_Stacks := Sec_Stacks + S;
- end;
- end if;
+ begin
+ Count_Default_Sized_Task_Stacks (Etype (Component), P, S);
+ Pri_Stacks := Pri_Stacks + P;
+ Sec_Stacks := Sec_Stacks + S;
+ end;
- Next_Component_Or_Discriminant (Component);
+ Next_Component (Component);
end loop;
when E_Limited_Private_Subtype
@@ -7457,11 +7453,10 @@ package body Exp_Ch3 is
and then not Restriction_Active (No_Secondary_Stack)
and then (Restriction_Active (No_Implicit_Heap_Allocations)
or else Restriction_Active (No_Implicit_Task_Allocations))
- and then not (Ekind (Typ) in E_Array_Type | E_Array_Subtype
- and then Has_Init_Expression (N))
+ and then not (Is_Array_Type (Typ) and then Has_Init_Expression (N))
then
declare
- PS_Count, SS_Count : Int := 0;
+ PS_Count, SS_Count : Int;
begin
Count_Default_Sized_Task_Stacks (Typ, PS_Count, SS_Count);
Increment_Primary_Stack_Count (PS_Count);
--
2.43.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-07 8:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 8:00 [COMMITTED] ada: Cleanup calculation of task stacks Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).