diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-06 09:44:51 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-06 09:44:51 +0000 |
commit | d4f55b2a19778152929495a3eb02f6b295c5f5cd (patch) | |
tree | a6504859fca4e60b28f22d72a2d374e0cfd7e0a9 /gcc/ada/s-tarest.ads | |
parent | b261877aa2bd3f3bf8e31490144c0dd05ebb0369 (diff) | |
download | gcc-d4f55b2a19778152929495a3eb02f6b295c5f5cd.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193214 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-tarest.ads')
-rw-r--r-- | gcc/ada/s-tarest.ads | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/gcc/ada/s-tarest.ads b/gcc/ada/s-tarest.ads index c8769754707..6313be626ab 100644 --- a/gcc/ada/s-tarest.ads +++ b/gcc/ada/s-tarest.ads @@ -43,10 +43,6 @@ -- The restricted GNARLI is also composed of System.Protected_Objects and -- System.Protected_Objects.Single_Entry -pragma Partition_Elaboration_Policy (Sequential); --- This package only implements the sequential elaboration policy. This pragma --- will enforce it (and detect conflicts with user specified policy). - with System.Task_Info; with System.Parameters; @@ -124,6 +120,13 @@ package System.Tasking.Restricted.Stages is -- t1S : constant String := "t1"; -- tIP (t1, 3, _chain, t1S, 1); + Partition_Elaboration_Policy : Character := 'C'; + pragma Export (C, Partition_Elaboration_Policy, + "__gnat_partition_elaboration_policy"); + -- Partition elaboration policy. Value can be either 'C' for concurrent, + -- which is the default or 'S' for sequential. This value can be modified + -- by the binder generated code, before calling elaboration code. + procedure Create_Restricted_Task (Priority : Integer; Stack_Address : System.Address; @@ -133,10 +136,12 @@ package System.Tasking.Restricted.Stages is State : Task_Procedure_Access; Discriminants : System.Address; Elaborated : Access_Boolean; + Chain : in out Activation_Chain; Task_Image : String; Created_Task : Task_Id); -- Compiler interface only. Do not call from within the RTS. - -- This must be called to create a new task. + -- This must be called to create a new task, when the partition + -- elaboration policy is not specified (or is concurrent). -- -- Priority is the task's priority (assumed to be in the -- System.Any_Priority'Range) @@ -165,19 +170,58 @@ package System.Tasking.Restricted.Stages is -- Elaborated is a pointer to a Boolean that must be set to true on exit -- if the task could be successfully elaborated. -- + -- Chain is a linked list of task that needs to be created. On exit, + -- Created_Task.Activation_Link will be Chain.T_ID, and Chain.T_ID will be + -- Created_Task (the created task will be linked at the front of Chain). + -- -- Task_Image is a string created by the compiler that the run time can -- store to ease the debugging and the Ada.Task_Identification facility. -- -- Created_Task is the resulting task. -- -- This procedure can raise Storage_Error if the task creation fails + + 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); + -- Compiler interface only. Do not call from within the RTS. + -- This must be called to create a new task, when the sequential partition + -- elaboration policy is used. + -- + -- The parameters are the same as Create_Restricted_Task_Concurrent, + -- except there is no Chain parameter (for the activation chain), as there + -- is only one global activation chain, which is declared in the body of + -- this package. + + procedure Activate_Restricted_Tasks + (Chain_Access : Activation_Chain_Access); + -- Compiler interface only. Do not call from within the RTS. + -- This must be called by the creator of a chain of one or more new tasks, + -- to activate them. The chain is a linked list that up to this point is + -- only known to the task that created them, though the individual tasks + -- are already in the All_Tasks_List. + -- + -- The compiler builds the chain in LIFO order (as a stack). Another + -- version of this procedure had code to reverse the chain, so as to + -- activate the tasks in the order of declaration. This might be nice, but + -- it is not needed if priority-based scheduling is supported, since all + -- the activated tasks synchronize on the activators lock before they start + -- activating and so they should start activating in priority order. -- - -- Contrary to Create_Task, there is no Chain parameter (for the activation - -- chain), as there is only one global activation chain, which is declared - -- in the body of this package. + -- When the partition elaboration policy is sequential, this procedure + -- does nothing, tasks will be activated at end of elaboration. - procedure Activate_Tasks; - pragma Export (C, Activate_Tasks, "__gnat_activate_tasks"); + procedure Activate_All_Tasks_Sequential; + pragma Export (C, Activate_All_Tasks_Sequential, + "__gnat_activate_all_tasks"); -- Binder interface only. Do not call from within the RTS. This must be -- called an the end of the elaboration to activate all tasks, in order -- to implement the sequential elaboration policy. |