WBI (" pragma Import (C, XDR_Stream, ""__gl_xdr_stream"");");
end if;
- -- Import entry point for elaboration time signal handler
- -- installation, and indication of if it's been called previously.
+ -- Import entry point for initialization of the runtime
WBI ("");
WBI (" procedure Runtime_Initialize " &
WBI (" pragma Import (C, Runtime_Initialize, " &
"""__gnat_runtime_initialize"");");
+ -- Import entry point for initialization of the tasking runtime
+
+ if With_GNARL then
+ WBI ("");
+ WBI (" procedure Tasking_Runtime_Initialize;");
+ WBI (" pragma Import (C, Tasking_Runtime_Initialize, " &
+ """__gnat_tasking_runtime_initialize"");");
+ end if;
+
-- Import handlers attach procedure for sequential elaboration policy
if System_Interrupts_Used
-- Generate call to Runtime_Initialize
WBI (" Runtime_Initialize (1);");
+
+ -- Generate call to Tasking_Runtime_Initialize
+
+ if With_GNARL then
+ WBI (" Tasking_Runtime_Initialize;");
+ end if;
end if;
-- Generate call to set Initialize_Scalar values if active
procedure Release_RTS_Lock (Addr : Address);
-- Release the RTS lock at Addr
- ------------------------
- -- Local Subprograms --
- ------------------------
-
----------------------------
-- Tasking Initialization --
----------------------------
-- of initializing global locks, and installing tasking versions of certain
-- operations used by the compiler. Init_RTS is called during elaboration.
+ procedure Tasking_Runtime_Initialize;
+ pragma Export (Ada, Tasking_Runtime_Initialize,
+ "__gnat_tasking_runtime_initialize");
+ -- This procedure starts the initialization of the GNARL. It installs the
+ -- tasking versions of the RTS_Lock manipulation routines. It is called
+ -- very early before the elaboration of all the Ada units of the program,
+ -- including those of the runtime, because this elaboration may require
+ -- the initialization of RTS_Lock objects.
+
--------------------------
-- Change_Base_Priority --
--------------------------
SSL.Task_Name := Task_Name'Access;
SSL.Get_Current_Excep := Get_Current_Excep'Access;
- SSL.Initialize_RTS_Lock := Initialize_RTS_Lock'Access;
- SSL.Finalize_RTS_Lock := Finalize_RTS_Lock'Access;
- SSL.Acquire_RTS_Lock := Acquire_RTS_Lock'Access;
- SSL.Release_RTS_Lock := Release_RTS_Lock'Access;
-
-- Initialize the tasking soft links (if not done yet) that are common
-- to the full and the restricted run times.
Undefer_Abort (Environment_Task);
end Init_RTS;
+ --------------------------------
+ -- Tasking_Runtime_Initialize --
+ --------------------------------
+
+ procedure Tasking_Runtime_Initialize is
+ begin
+ SSL.Initialize_RTS_Lock := Initialize_RTS_Lock'Access;
+ SSL.Finalize_RTS_Lock := Finalize_RTS_Lock'Access;
+ SSL.Acquire_RTS_Lock := Acquire_RTS_Lock'Access;
+ SSL.Release_RTS_Lock := Release_RTS_Lock'Access;
+ end Tasking_Runtime_Initialize;
+
---------------------------
-- Locked_Abort_To_Level--
---------------------------
procedure Null_Set_Address (Addr : Address) is null;
-- Soft-Links are used for procedures that manipulate locks to avoid
- -- dragging the tasking run time when using access-to-controlled types.
+ -- dragging the tasking runtime when using access-to-controlled types.
Initialize_RTS_Lock : Set_Address_Call := Null_Set_Address'Access;
Finalize_RTS_Lock : Set_Address_Call := Null_Set_Address'Access;
Acquire_RTS_Lock : Set_Address_Call := Null_Set_Address'Access;
Release_RTS_Lock : Set_Address_Call := Null_Set_Address'Access;
+ -- The initialization of these variables must be static because the value
+ -- needs to be overridden very early when the tasking runtime is dragged.
--------------------------
-- Master_Id Soft-Links --