diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-11-06 10:44:51 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-11-06 10:44:51 +0100 |
commit | 6bc057a79e2cef15d7dfd1170c1043cb0f271b04 (patch) | |
tree | a6504859fca4e60b28f22d72a2d374e0cfd7e0a9 /gcc/ada/s-tarest.adb | |
parent | 3c55062f3030f6dcd365f89ba9ecfea2131889b4 (diff) | |
download | gcc-6bc057a79e2cef15d7dfd1170c1043cb0f271b04.zip gcc-6bc057a79e2cef15d7dfd1170c1043cb0f271b04.tar.gz gcc-6bc057a79e2cef15d7dfd1170c1043cb0f271b04.tar.bz2 |
[multiple changes]
2012-11-06 Thomas Quinot <quinot@adacore.com>
* s-oscons-tmplt.c: Interfaces.C now needs to be WITH'd even
on platforms that do not support sockets (for the benefit of
subtype IOCTL_Req_T).
2012-11-06 Ed Schonberg <schonberg@adacore.com>
* par-ch4.adb (P_Primary): if-expressions, case-expressions,
and quantified expressions are legal if surrounded by parentheses
from an enclosing context, such as a call or an instantiation.
2012-11-06 Yannick Moy <moy@adacore.com>
* impunit.adb (Get_Kind_Of_Unit): Return appropriate kind for
predefined implementation files, instead of returning
Not_Predefined_Unit on all .adb files.
2012-11-06 Tristan Gingold <gingold@adacore.com>
* exp_ch9.adb (Build_Activation_Chain_Entity): Return immediately if
partition elaboration policy is sequential.
(Build_Task_Activation_Call): Likewise. Use
Activate_Restricted_Tasks on restricted profile.
(Make_Task_Create_Call): Do not use the _Chain
parameter if elaboration policy is sequential. Call
Create_Restricted_Task_Sequential in that case.
* exp_ch3.adb (Build_Initialization_Call): Change condition to
support concurrent elaboration policy.
(Build_Record_Init_Proc): Likewise.
(Init_Formals): Likewise.
* bindgen.adb (Gen_Adainit): Declare Partition_Elaboration_Policy
and set it in generated code if the elaboration policy is
sequential. The procedure called to activate all tasks is now
named __gnat_activate_all_tasks.
* rtsfind.adb (RE_Activate_Restricted_Task,
RE_Create_Restricted_Task_Sequential): New RE_Id literals.
* s-tarest.adb (Create_Restricted_Task): Added to create a task without
adding it on an activation chain.
(Activate_Tasks): Has now a Chain parameter.
(Activate_All_Tasks_Sequential): Added. Called by the binder to
activate all tasks.
(Activate_Restricted_Tasks): Added. Called during elaboration to
activate tasks of the units.
* s-tarest.ads: Remove pragma Partition_Elaboration_Policy.
(Partition_Elaboration_Policy): New variable (set by the binder).
(Create_Restricted_Task): Revert removal of the chain parameter.
(Create_Restricted_Task_Sequential): New procedure.
(Activate_Restricted_Tasks): Revert removal.
(Activate_All_Tasks_Sequential): New procedure.
From-SVN: r193214
Diffstat (limited to 'gcc/ada/s-tarest.adb')
-rw-r--r-- | gcc/ada/s-tarest.adb | 119 |
1 files changed, 112 insertions, 7 deletions
diff --git a/gcc/ada/s-tarest.adb b/gcc/ada/s-tarest.adb index bba83ab..ec94313 100644 --- a/gcc/ada/s-tarest.adb +++ b/gcc/ada/s-tarest.adb @@ -111,6 +111,24 @@ package body System.Tasking.Restricted.Stages is -- Terminate the calling task. -- This should only be called by the Task_Wrapper procedure. + procedure Create_Restricted_Task + (Priority : Integer; + Stack_Address : System.Address; + Size : System.Parameters.Size_Type; + Task_Info : System.Task_Info.Task_Info_Type; + CPU : Integer; + State : Task_Procedure_Access; + Discriminants : System.Address; + Elaborated : Access_Boolean; + Task_Image : String; + Created_Task : Task_Id); + -- Code shared between Create_Restricted_Task_Concurrent and + -- Create_Restricted_Task_Sequential. See comment of the former in the + -- specification of this package. + + procedure Activate_Tasks (Chain : Task_Id); + -- Activate the list of tasks started by Chain + procedure Init_RTS; -- This procedure performs the initialization of the GNARL. -- It consists of initializing the environment task, global locks, and @@ -301,6 +319,40 @@ package body System.Tasking.Restricted.Stages is -- Restricted GNARLI -- ----------------------- + ----------------------------------- + -- Activate_All_Tasks_Sequential -- + ----------------------------------- + + procedure Activate_All_Tasks_Sequential is + begin + pragma Assert (Partition_Elaboration_Policy = 'S'); + + Activate_Tasks (Tasks_Activation_Chain); + Tasks_Activation_Chain := Null_Task; + end Activate_All_Tasks_Sequential; + + ------------------------------- + -- Activate_Restricted_Tasks -- + ------------------------------- + + procedure Activate_Restricted_Tasks + (Chain_Access : Activation_Chain_Access) is + begin + if Partition_Elaboration_Policy = 'S' then + + -- In sequential elaboration policy, the chain must be empty. This + -- procedure can be called if the unit has been compiled without + -- partition elaboration policy, but the partition has a sequential + -- elaboration policy. + + pragma Assert (Chain_Access.T_ID = Null_Task); + null; + else + Activate_Tasks (Chain_Access.T_ID); + Chain_Access.T_ID := Null_Task; + end if; + end Activate_Restricted_Tasks; + -------------------- -- Activate_Tasks -- -------------------- @@ -311,7 +363,7 @@ package body System.Tasking.Restricted.Stages is -- created before the activated task. That satisfies our -- in-order-of-creation ATCB locking policy. - procedure Activate_Tasks is + procedure Activate_Tasks (Chain : Task_Id) is Self_ID : constant Task_Id := STPO.Self; C : Task_Id; Activate_Prio : System.Any_Priority; @@ -333,7 +385,7 @@ package body System.Tasking.Restricted.Stages is -- Activate all the tasks in the chain. Creation of the thread of -- control was deferred until activation. So create it now. - C := Tasks_Activation_Chain; + C := Chain; while C /= null loop if C.Common.State /= Terminated then pragma Assert (C.Common.State = Unactivated); @@ -381,10 +433,6 @@ package body System.Tasking.Restricted.Stages is if Single_Lock then Unlock_RTS; end if; - - -- Remove the tasks from the chain - - Tasks_Activation_Chain := null; end Activate_Tasks; ------------------------------------ @@ -557,9 +605,66 @@ package body System.Tasking.Restricted.Stages is -- may be used by the operation of Ada code within the task. SSL.Create_TSD (Created_Task.Common.Compiler_Data); + end Create_Restricted_Task; + + procedure Create_Restricted_Task + (Priority : Integer; + Stack_Address : System.Address; + Size : System.Parameters.Size_Type; + Task_Info : System.Task_Info.Task_Info_Type; + CPU : Integer; + State : Task_Procedure_Access; + Discriminants : System.Address; + Elaborated : Access_Boolean; + Chain : in out Activation_Chain; + Task_Image : String; + Created_Task : Task_Id) is + begin + Create_Restricted_Task (Priority, Stack_Address, Size, Task_Info, + CPU, State, Discriminants, Elaborated, + Task_Image, Created_Task); + + -- Append this task to the activation chain + + if Partition_Elaboration_Policy = 'S' then + + -- In fact the elaboration policy is sequential, add this task to + -- the global activation chain to defer its activation. + + Created_Task.Common.Activation_Link := Tasks_Activation_Chain; + Tasks_Activation_Chain := Created_Task; + + else + Created_Task.Common.Activation_Link := Chain.T_ID; + Chain.T_ID := Created_Task; + end if; + end Create_Restricted_Task; + + --------------------------------------- + -- Create_Restricted_Task_Sequential -- + --------------------------------------- + + procedure Create_Restricted_Task_Sequential + (Priority : Integer; + Stack_Address : System.Address; + Size : System.Parameters.Size_Type; + Task_Info : System.Task_Info.Task_Info_Type; + CPU : Integer; + State : Task_Procedure_Access; + Discriminants : System.Address; + Elaborated : Access_Boolean; + Task_Image : String; + Created_Task : Task_Id) is + begin + Create_Restricted_Task (Priority, Stack_Address, Size, Task_Info, + CPU, State, Discriminants, Elaborated, + Task_Image, Created_Task); + + -- Append this task to the activation chain + Created_Task.Common.Activation_Link := Tasks_Activation_Chain; Tasks_Activation_Chain := Created_Task; - end Create_Restricted_Task; + end Create_Restricted_Task_Sequential; --------------------------- -- Finalize_Global_Tasks -- |