Commit 1a49cf99 by Arnaud Charlet

[multiple changes]

2005-03-08  Robert Dewar  <dewar@adacore.com>

	* s-bitops.adb, s-bitops.ads,
	s-taprop-os2.adb, s-intman-vms.ads, s-intman-vxworks.ads,
	s-taprop-vxworks.adb, a-caldel.ads, a-calend.adb, a-tasatt.adb,
	tbuild.ads, s-finimp.adb, s-imgwch.adb, s-intman.ads, s-intman.ads,
	s-memory.adb, s-soflin.ads, s-taasde.ads, s-taprob.adb, s-taprop.ads,
	s-taprop.ads, s-tasini.adb, s-tasini.ads, s-tasini.ads, s-tasini.ads,
	s-taskin.ads, s-tasren.adb, s-tassta.adb, s-tassta.ads, s-tassta.ads,
	s-tasuti.ads, s-tataat.ads, s-tataat.ads, s-tataat.ads, s-tataat.ads,
	s-tpoben.adb, s-tpoben.adb, s-tpobop.ads: Update comments. Minor
	reformatting.

2005-03-08  Eric Botcazou  <ebotcazou@adacore.com>

	* utils2.c (build_binary_op): Fix typo.

2005-03-08  Doug Rupp  <rupp@adacore.com>

	* s-crtl.ads (popen,pclose): New imports.

2005-03-08  Cyrille Comar  <comar@adacore.com>

	* comperr.adb (Compiler_Abort): remove references to obsolete
	procedures in the bug boxes for various GNAT builds.

2005-03-08  Vincent Celier  <celier@adacore.com>

	* snames.ads, snames.adb: Save as Unix text file, not as DOS text file

From-SVN: r96512
parent 728c3084
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-1998, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -39,18 +39,17 @@ ...@@ -39,18 +39,17 @@
package Ada.Calendar.Delays is package Ada.Calendar.Delays is
procedure Delay_For (D : Duration); procedure Delay_For (D : Duration);
-- Delay until an interval of length (at least) D seconds has passed, -- Delay until an interval of length (at least) D seconds has passed, or
-- or the task is aborted to at least the current ATC nesting level. -- the task is aborted to at least the current ATC nesting level. This is
-- This is an abort completion point. -- an abort completion point. The body of this procedure must perform all
-- The body of this procedure must perform all the processing -- the processing required for an abort point.
-- required for an abortion point.
procedure Delay_Until (T : Time); procedure Delay_Until (T : Time);
-- Delay until Clock has reached (at least) time T, -- Delay until Clock has reached (at least) time T, or the task is aborted
-- or the task is aborted to at least the current ATC nesting level. -- to at least the current ATC nesting level. The body of this procedure
-- The body of this procedure must perform all the processing -- must perform all the processing required for an abort point.
-- required for an abortion point.
function To_Duration (T : Time) return Duration; function To_Duration (T : Time) return Duration;
-- Convert Time to Duration
end Ada.Calendar.Delays; end Ada.Calendar.Delays;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -91,15 +91,16 @@ package body Ada.Calendar is ...@@ -91,15 +91,16 @@ package body Ada.Calendar is
-- The following constants are used in adjusting Ada dates so that they -- The following constants are used in adjusting Ada dates so that they
-- fit into a 56 year range that can be handled by Unix (1970 included - -- fit into a 56 year range that can be handled by Unix (1970 included -
-- 2026 excluded). Dates that are not in this 56 year range are shifted -- 2026 excluded). Dates that are not in this 56 year range are shifted
-- by multiples of 56 years to fit in this range -- by multiples of 56 years to fit in this range.
-- The trick is that the number of days in any four year period in the Ada -- The trick is that the number of days in any four year period in the Ada
-- range of years (1901 - 2099) has a constant number of days. This is -- range of years (1901 - 2099) has a constant number of days. This is
-- because we have the special case of 2000 which, contrary to the normal -- because we have the special case of 2000 which, contrary to the normal
-- exception for centuries, is a leap year after all. -- exception for centuries, is a leap year after all. 56 has been chosen,
-- 56 has been chosen, because it is not only a multiple of 4, but also -- because it is not only a multiple of 4, but also a multiple of 7. Thus
-- a multiple of 7. Thus two dates 56 years apart fall on the same day of -- two dates 56 years apart fall on the same day of the week, and the
-- the week, and the Daylight Saving Time change dates are usually the same -- Daylight Saving Time change dates are usually the same for these two
-- for these two years. -- years.
Unix_Year_Min : constant := 1970; Unix_Year_Min : constant := 1970;
Unix_Year_Max : constant := 2026; Unix_Year_Max : constant := 2026;
...@@ -125,7 +126,6 @@ package body Ada.Calendar is ...@@ -125,7 +126,6 @@ package body Ada.Calendar is
pragma Unsuppress (Overflow_Check); pragma Unsuppress (Overflow_Check);
begin begin
return (Left + Time (Right)); return (Left + Time (Right));
exception exception
when Constraint_Error => when Constraint_Error =>
raise Time_Error; raise Time_Error;
...@@ -135,7 +135,6 @@ package body Ada.Calendar is ...@@ -135,7 +135,6 @@ package body Ada.Calendar is
pragma Unsuppress (Overflow_Check); pragma Unsuppress (Overflow_Check);
begin begin
return (Time (Left) + Right); return (Time (Left) + Right);
exception exception
when Constraint_Error => when Constraint_Error =>
raise Time_Error; raise Time_Error;
...@@ -149,7 +148,6 @@ package body Ada.Calendar is ...@@ -149,7 +148,6 @@ package body Ada.Calendar is
pragma Unsuppress (Overflow_Check); pragma Unsuppress (Overflow_Check);
begin begin
return Left - Time (Right); return Left - Time (Right);
exception exception
when Constraint_Error => when Constraint_Error =>
raise Time_Error; raise Time_Error;
...@@ -159,7 +157,6 @@ package body Ada.Calendar is ...@@ -159,7 +157,6 @@ package body Ada.Calendar is
pragma Unsuppress (Overflow_Check); pragma Unsuppress (Overflow_Check);
begin begin
return Duration (Left) - Duration (Right); return Duration (Left) - Duration (Right);
exception exception
when Constraint_Error => when Constraint_Error =>
raise Time_Error; raise Time_Error;
...@@ -219,7 +216,6 @@ package body Ada.Calendar is ...@@ -219,7 +216,6 @@ package body Ada.Calendar is
DM : Month_Number; DM : Month_Number;
DD : Day_Number; DD : Day_Number;
DS : Day_Duration; DS : Day_Duration;
begin begin
Split (Date, DY, DM, DD, DS); Split (Date, DY, DM, DD, DS);
return DD; return DD;
...@@ -234,7 +230,6 @@ package body Ada.Calendar is ...@@ -234,7 +230,6 @@ package body Ada.Calendar is
DM : Month_Number; DM : Month_Number;
DD : Day_Number; DD : Day_Number;
DS : Day_Duration; DS : Day_Duration;
begin begin
Split (Date, DY, DM, DD, DS); Split (Date, DY, DM, DD, DS);
return DM; return DM;
...@@ -249,7 +244,6 @@ package body Ada.Calendar is ...@@ -249,7 +244,6 @@ package body Ada.Calendar is
DM : Month_Number; DM : Month_Number;
DD : Day_Number; DD : Day_Number;
DS : Day_Duration; DS : Day_Duration;
begin begin
Split (Date, DY, DM, DD, DS); Split (Date, DY, DM, DD, DS);
return DS; return DS;
...@@ -291,11 +285,11 @@ package body Ada.Calendar is ...@@ -291,11 +285,11 @@ package body Ada.Calendar is
D := Duration (Date); D := Duration (Date);
-- First of all, filter out completely ludicrous values. Remember -- First of all, filter out completely ludicrous values. Remember that
-- that we use the full stored range of duration values, which may -- we use the full stored range of duration values, which may be
-- be significantly larger than the allowed range of Ada times. Note -- significantly larger than the allowed range of Ada times. Note that
-- that these checks are wider than required to make absolutely sure -- these checks are wider than required to make absolutely sure that
-- that there are no end effects from time zone differences. -- there are no end effects from time zone differences.
if D < LowD or else D > HighD then if D < LowD or else D > HighD then
raise Time_Error; raise Time_Error;
...@@ -306,11 +300,11 @@ package body Ada.Calendar is ...@@ -306,11 +300,11 @@ package body Ada.Calendar is
-- required range of years (the guaranteed range available is only -- required range of years (the guaranteed range available is only
-- EPOCH through EPOCH + N seconds). N is in practice 2 ** 31 - 1. -- EPOCH through EPOCH + N seconds). N is in practice 2 ** 31 - 1.
-- If we have a value outside this range, then we first adjust it -- If we have a value outside this range, then we first adjust it to be
-- to be in the required range by adding multiples of 56 years. -- in the required range by adding multiples of 56 years. For the range
-- For the range we are interested in, the number of days in any -- we are interested in, the number of days in any consecutive 56 year
-- consecutive 56 year period is constant. Then we do the split -- period is constant. Then we do the split on the adjusted value, and
-- on the adjusted value, and readjust the years value accordingly. -- readjust the years value accordingly.
Year_Val := 0; Year_Val := 0;
...@@ -325,13 +319,13 @@ package body Ada.Calendar is ...@@ -325,13 +319,13 @@ package body Ada.Calendar is
end loop; end loop;
-- Now we need to take the value D, which is now non-negative, and -- Now we need to take the value D, which is now non-negative, and
-- break it down into seconds (to pass to the localtime_r function) -- break it down into seconds (to pass to the localtime_r function) and
-- and fractions of seconds (for the adjustment below). -- fractions of seconds (for the adjustment below).
-- Surprisingly there is no easy way to do this in Ada, and certainly -- Surprisingly there is no easy way to do this in Ada, and certainly
-- no easy way to do it and generate efficient code. Therefore we -- no easy way to do it and generate efficient code. Therefore we do it
-- do it at a low level, knowing that it is really represented as -- at a low level, knowing that it is really represented as an integer
-- an integer with units of Small -- with units of Small
declare declare
type D_Int is range 0 .. 2 ** (Duration'Size - 1) - 1; type D_Int is range 0 .. 2 ** (Duration'Size - 1) - 1;
...@@ -356,18 +350,18 @@ package body Ada.Calendar is ...@@ -356,18 +350,18 @@ package body Ada.Calendar is
Day := Tm_Val.tm_mday; Day := Tm_Val.tm_mday;
-- The Seconds value is a little complex. The localtime function -- The Seconds value is a little complex. The localtime function
-- returns the integral number of seconds, which is what we want, -- returns the integral number of seconds, which is what we want, but
-- but we want to retain the fractional part from the original -- we want to retain the fractional part from the original Time value,
-- Time value, since this is typically stored more accurately. -- since this is typically stored more accurately.
Seconds := Duration (Tm_Val.tm_hour * 3600 + Seconds := Duration (Tm_Val.tm_hour * 3600 +
Tm_Val.tm_min * 60 + Tm_Val.tm_min * 60 +
Tm_Val.tm_sec) Tm_Val.tm_sec)
+ Frac_Sec; + Frac_Sec;
-- Note: the above expression is pretty horrible, one of these days -- Note: the above expression is pretty horrible, one of these days we
-- we should stop using time_of and do everything ourselves to avoid -- should stop using time_of and do everything ourselves to avoid these
-- these unnecessary divides and multiplies???. -- unnecessary divides and multiplies???.
-- The Year may still be out of range, since our entry test was -- The Year may still be out of range, since our entry test was
-- deliberately crude. Trying to make this entry test accurate is -- deliberately crude. Trying to make this entry test accurate is
...@@ -404,8 +398,8 @@ package body Ada.Calendar is ...@@ -404,8 +398,8 @@ package body Ada.Calendar is
begin begin
-- The following checks are redundant with respect to the constraint -- The following checks are redundant with respect to the constraint
-- error checks that should normally be made on parameters, but we -- error checks that should normally be made on parameters, but we
-- decide to raise Constraint_Error in any case if bad values come -- decide to raise Constraint_Error in any case if bad values come in
-- in (as a result of checks being off in the caller, or for other -- (as a result of checks being off in the caller, or for other
-- erroneous or bounded error cases). -- erroneous or bounded error cases).
if not Year 'Valid if not Year 'Valid
...@@ -433,10 +427,10 @@ package body Ada.Calendar is ...@@ -433,10 +427,10 @@ package body Ada.Calendar is
TM_Val.tm_mon := Month - 1; TM_Val.tm_mon := Month - 1;
-- For the year, we have to adjust it to a year that Unix can handle. -- For the year, we have to adjust it to a year that Unix can handle.
-- We do this in 56 year steps, since the number of days in 56 years -- We do this in 56 year steps, since the number of days in 56 years is
-- is constant, so the timezone effect on the conversion from local -- constant, so the timezone effect on the conversion from local time
-- time to GMT is unaffected; also the DST change dates are usually -- to GMT is unaffected; also the DST change dates are usually not
-- not modified. -- modified.
while Year_Val < Unix_Year_Min loop while Year_Val < Unix_Year_Min loop
Year_Val := Year_Val + 56; Year_Val := Year_Val + 56;
...@@ -450,8 +444,8 @@ package body Ada.Calendar is ...@@ -450,8 +444,8 @@ package body Ada.Calendar is
TM_Val.tm_year := Year_Val - 1900; TM_Val.tm_year := Year_Val - 1900;
-- Since we do not have information on daylight savings, -- Since we do not have information on daylight savings, rely on the
-- rely on the default information. -- default information.
TM_Val.tm_isdst := -1; TM_Val.tm_isdst := -1;
Result_Secs := mktime (TM_Val'Unchecked_Access); Result_Secs := mktime (TM_Val'Unchecked_Access);
...@@ -459,14 +453,13 @@ package body Ada.Calendar is ...@@ -459,14 +453,13 @@ package body Ada.Calendar is
-- That gives us the basic value in seconds. Two adjustments are -- That gives us the basic value in seconds. Two adjustments are
-- needed. First we must undo the year adjustment carried out above. -- needed. First we must undo the year adjustment carried out above.
-- Second we put back the fraction seconds value since in general the -- Second we put back the fraction seconds value since in general the
-- Day_Duration value we received has additional precision which we -- Day_Duration value we received has additional precision which we do
-- do not want to lose in the constructed result. -- not want to lose in the constructed result.
return return
Time (Duration (Result_Secs) + Time (Duration (Result_Secs) +
Duration_Adjust + Duration_Adjust +
(Seconds - Duration (Int_Secs))); (Seconds - Duration (Int_Secs)));
end Time_Of; end Time_Of;
---------- ----------
...@@ -478,7 +471,6 @@ package body Ada.Calendar is ...@@ -478,7 +471,6 @@ package body Ada.Calendar is
DM : Month_Number; DM : Month_Number;
DD : Day_Number; DD : Day_Number;
DS : Day_Duration; DS : Day_Duration;
begin begin
Split (Date, DY, DM, DD, DS); Split (Date, DY, DM, DD, DS);
return DY; return DY;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2004, Ada Core Technologies -- -- Copyright (C) 1995-2005, Ada Core Technologies --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -32,174 +32,171 @@ ...@@ -32,174 +32,171 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- The following notes are provided in case someone decides the -- The following notes are provided in case someone decides the implementation
-- implementation of this package is too complicated, or too slow. -- of this package is too complicated, or too slow. Please read this before
-- Please read this before making any "simplifications". -- making any "simplifications".
-- Correct implementation of this package is more difficult than one -- Correct implementation of this package is more difficult than one might
-- might expect. After considering (and coding) several alternatives, -- expect. After considering (and coding) several alternatives, we settled on
-- we settled on the present compromise. Things we do not like about -- the present compromise. Things we do not like about this implementation
-- this implementation include: -- include:
-- - It is vulnerable to bad Task_Id values, to the extent of -- - It is vulnerable to bad Task_Id values, to the extent of possibly
-- possibly trashing memory and crashing the runtime system. -- trashing memory and crashing the runtime system.
-- - It requires dynamic storage allocation for each new attribute value, -- - It requires dynamic storage allocation for each new attribute value,
-- except for types that happen to be the same size as System.Address, -- except for types that happen to be the same size as System.Address, or
-- or shorter. -- shorter.
-- - Instantiations at other than the library level rely on being able to -- - Instantiations at other than the library level rely on being able to
-- do down-level calls to a procedure declared in the generic package body. -- do down-level calls to a procedure declared in the generic package body.
-- This makes it potentially vulnerable to compiler changes. -- This makes it potentially vulnerable to compiler changes.
-- The main implementation issue here is that the connection from -- The main implementation issue here is that the connection from task to
-- task to attribute is a potential source of dangling references. -- attribute is a potential source of dangling references.
-- When a task goes away, we want to be able to recover all the storage -- When a task goes away, we want to be able to recover all the storage
-- associated with its attributes. The Ada mechanism for this is -- associated with its attributes. The Ada mechanism for this is
-- finalization, via controlled attribute types. For this reason, -- finalization, via controlled attribute types. For this reason, the ARM
-- the ARM requires finalization of attribute values when the -- requires finalization of attribute values when the associated task
-- associated task terminates. -- terminates.
-- This finalization must be triggered by the tasking runtime system, -- This finalization must be triggered by the tasking runtime system, during
-- during termination of the task. Given the active set of instantiations -- termination of the task. Given the active set of instantiations of
-- of Ada.Task_Attributes is dynamic, the number and types of attributes -- Ada.Task_Attributes is dynamic, the number and types of attributes
-- belonging to a task will not be known until the task actually terminates. -- belonging to a task will not be known until the task actually terminates.
-- Some of these types may be controlled and some may not. The RTS must find -- Some of these types may be controlled and some may not. The RTS must find
-- some way to determine which of these attributes need finalization, and -- some way to determine which of these attributes need finalization, and
-- invoke the appropriate finalization on them. -- invoke the appropriate finalization on them.
-- One way this might be done is to create a special finalization chain -- One way this might be done is to create a special finalization chain for
-- for each task, similar to the finalization chain that is used for -- each task, similar to the finalization chain that is used for controlled
-- controlled objects within the task. This would differ from the usual -- objects within the task. This would differ from the usual finalization
-- finalization chain in that it would not have a LIFO structure, since -- chain in that it would not have a LIFO structure, since attributes may be
-- attributes may be added to a task at any time during its lifetime. -- added to a task at any time during its lifetime. This might be the right
-- This might be the right way to go for the longer term, but at present -- way to go for the longer term, but at present this approach is not open,
-- this approach is not open, since GNAT does not provide such special -- since GNAT does not provide such special finalization support.
-- finalization support.
-- Lacking special compiler support, the RTS is limited to the -- Lacking special compiler support, the RTS is limited to the normal ways an
-- normal ways an application invokes finalization, i.e. -- application invokes finalization, i.e.
-- a) Explicit call to the procedure Finalize, if we know the type -- a) Explicit call to the procedure Finalize, if we know the type has this
-- has this operation defined on it. This is not sufficient, since -- operation defined on it. This is not sufficient, since we have no way
-- we have no way of determining whether a given generic formal -- of determining whether a given generic formal Attribute type is
-- Attribute type is controlled, and no visibility of the associated -- controlled, and no visibility of the associated Finalize procedure, in
-- Finalize procedure, in the generic body. -- the generic body.
-- b) Leaving the scope of a local object of a controlled type. -- b) Leaving the scope of a local object of a controlled type. This does not
-- This does not help, since the lifetime of an instantiation of -- help, since the lifetime of an instantiation of Ada.Task_Attributes
-- Ada.Task_Attributes does not correspond to the lifetimes of the -- does not correspond to the lifetimes of the various tasks which may
-- various tasks which may have that attribute. -- have that attribute.
-- c) Assignment of another value to the object. This would not help, -- c) Assignment of another value to the object. This would not help, since
-- since we then have to finalize the new value of the object. -- we then have to finalize the new value of the object.
-- d) Unchecked deallocation of an object of a controlled type. -- d) Unchecked deallocation of an object of a controlled type. This seems to
-- This seems to be the only mechanism available to the runtime -- be the only mechanism available to the runtime system for finalization
-- system for finalization of task attributes. -- of task attributes.
-- We considered two ways of using unchecked deallocation, both based -- We considered two ways of using unchecked deallocation, both based on a
-- on a linked list of that would hang from the task control block. -- linked list of that would hang from the task control block.
-- In the first approach the objects on the attribute list are all derived -- In the first approach the objects on the attribute list are all derived
-- from one controlled type, say T, and are linked using an access type to -- from one controlled type, say T, and are linked using an access type to
-- T'Class. The runtime system has an Unchecked_Deallocation for T'Class -- T'Class. The runtime system has an Unchecked_Deallocation for T'Class with
-- with access type T'Class, and uses this to deallocate and finalize all -- access type T'Class, and uses this to deallocate and finalize all the
-- the items in the list. The limitation of this approach is that each -- items in the list. The limitation of this approach is that each
-- instantiation of the package Ada.Task_Attributes derives a new record -- instantiation of the package Ada.Task_Attributes derives a new record
-- extension of T, and since T is controlled (RM 3.9.1 (3)), instantiation -- extension of T, and since T is controlled (RM 3.9.1 (3)), instantiation is
-- is only allowed at the library level. -- only allowed at the library level.
-- In the second approach the objects on the attribute list are of -- In the second approach the objects on the attribute list are of unrelated
-- unrelated but structurally similar types. Unchecked conversion is -- but structurally similar types. Unchecked conversion is used to circument
-- used to circument Ada type checking. Each attribute-storage node -- Ada type checking. Each attribute-storage node contains not only the
-- contains not only the attribute value and a link for chaining, but -- attribute value and a link for chaining, but also a pointer to descriptor
-- also a pointer to a descriptor for the corresponding instantiation -- for the corresponding instantiation of Task_Attributes. The instantiation
-- of Task_Attributes. The instantiation-descriptor contains a -- descriptor contains pointer to a procedure that can do the correct
-- pointer to a procedure that can do the correct deallocation and -- deallocation and finalization for that type of attribute. On task
-- finalization for that type of attribute. On task termination, the -- termination, the runtime system uses the pointer to call the appropriate
-- runtime system uses the pointer to call the appropriate deallocator. -- deallocator.
-- While this gets around the limitation that instantations be at -- While this gets around the limitation that instantations be at the library
-- the library level, it relies on an implementation feature that -- level, it relies on an implementation feature that may not always be safe,
-- may not always be safe, i.e. that it is safe to call the -- i.e. that it is safe to call the Deallocate procedure for an instantiation
-- Deallocate procedure for an instantiation of Ada.Task_Attributes -- of Ada.Task_Attributes that no longer exists. In general, it seems this
-- that no longer exists. In general, it seems this might result in -- might result in dangling references.
-- dangling references.
-- Another problem with instantiations deeper than the library level is that
-- Another problem with instantiations deeper than the library level -- there is risk of storage leakage, or dangling references to reused
-- is that there is risk of storage leakage, or dangling references -- storage. That is, if an instantiation of Ada.Task_Attributes is made
-- to reused storage. That is, if an instantiation of Ada.Task_Attributes -- within a procedure, what happens to the storage allocated for attributes,
-- is made within a procedure, what happens to the storage allocated for -- when the procedure call returns? Apparently (RM 7.6.1 (4)) any such
-- attributes, when the procedure call returns? Apparently (RM 7.6.1 (4)) -- objects must be finalized, since they will no longer be accessible, and in
-- any such objects must be finalized, since they will no longer be -- general one would expect that the storage they occupy would be recovered
-- accessible, and in general one would expect that the storage they occupy -- for later reuse. (If not, we would have a case of storage leakage.)
-- would be recovered for later reuse. (If not, we would have a case of -- Assuming the storage is recovered and later reused, we have potentially
-- storage leakage.) Assuming the storage is recovered and later reused, -- dangerous dangling references. When the procedure containing the
-- we have potentially dangerous dangling references. When the procedure -- instantiation of Ada.Task_Attributes returns, there may still be
-- containing the instantiation of Ada.Task_Attributes returns, there -- unterminated tasks with associated attribute values for that instantiation.
-- may still be unterminated tasks with associated attribute values for -- When such tasks eventually terminate, the RTS will attempt to call the
-- that instantiation. When such tasks eventually terminate, the RTS -- Deallocate procedure on them. If the corresponding storage has already
-- will attempt to call the Deallocate procedure on them. If the -- been deallocated, when the master of the access type was left, we have a
-- corresponding storage has already been deallocated, when the master -- potential disaster. This disaster is compounded since the pointer to
-- of the access type was left, we have a potential disaster. This -- Deallocate is probably through a "trampoline" which will also have been
-- disaster is compounded since the pointer to Deallocate is probably -- destroyed.
-- through a "trampoline" which will also have been destroyed.
-- For this reason, we arrange to remove all dangling references before
-- For this reason, we arrange to remove all dangling references -- leaving the scope of an instantiation. This is ugly, since it requires
-- before leaving the scope of an instantiation. This is ugly, since -- traversing the list of all tasks, but it is no more ugly than a similar
-- it requires traversing the list of all tasks, but it is no more ugly -- traversal that we must do at the point of instantiation in order to
-- than a similar traversal that we must do at the point of instantiation -- initialize the attributes of all tasks. At least we only need to do these
-- in order to initialize the attributes of all tasks. At least we only -- traversals if the type is controlled.
-- need to do these traversals if the type is controlled.
-- We chose to defer allocation of storage for attributes until the Reference
-- We chose to defer allocation of storage for attributes until the -- function is called or the attribute is first set to a value different from
-- Reference function is called or the attribute is first set to a value -- the default initial one. This allows a potential savings in allocation,
-- different from the default initial one. This allows a potential -- for attributes that are not used by all tasks.
-- savings in allocation, for attributes that are not used by all tasks.
-- For efficiency, we reserve space in the TCB for a fixed number of -- For efficiency, we reserve space in the TCB for a fixed number of
-- direct-access attributes. These are required to be of a size that -- direct-access attributes. These are required to be of a size that fits in
-- fits in the space of an object of type System.Address. Because -- the space of an object of type System.Address. Because we must use
-- we must use unchecked bitwise copy operations on these values, they -- unchecked bitwise copy operations on these values, they cannot be of a
-- cannot be of a controlled type, but that is covered automatically -- controlled type, but that is covered automatically since controlled
-- since controlled objects are too large to fit in the spaces. -- objects are too large to fit in the spaces.
-- We originally deferred the initialization of these direct-access -- We originally deferred the initialization of these direct-access
-- attributes, just as we do for the indirect-access attributes, and -- attributes, just as we do for the indirect-access attributes, and used a
-- used a per-task bit vector to keep track of which attributes were -- per-task bit vector to keep track of which attributes were currently
-- currently defined for that task. We found that the overhead of -- defined for that task. We found that the overhead of maintaining this
-- maintaining this bit-vector seriously slowed down access to the -- bit-vector seriously slowed down access to the attributes, and made the
-- attributes, and made the fetch operation non-atomic, so that even -- fetch operation non-atomic, so that even to read an attribute value
-- to read an attribute value required locking the TCB. Therefore, -- required locking the TCB. Therefore, we now initialize such attributes for
-- we now initialize such attributes for all existing tasks at the time -- all existing tasks at the time of the attribute instantiation, and
-- of the attribute instantiation, and initialize existing attributes -- initialize existing attributes for each new task at the time it is
-- for each new task at the time it is created. -- created.
-- The latter initialization requires a list of all the instantiation -- The latter initialization requires a list of all the instantiation
-- descriptors. Updates to this list, as well as the bit-vector that -- descriptors. Updates to this list, as well as the bit-vector that is used
-- is used to reserve slots for attributes in the TCB, require mutual -- to reserve slots for attributes in the TCB, require mutual exclusion. That
-- exclusion. That is provided by the Lock/Unlock_RTS. -- is provided by the Lock/Unlock_RTS.
-- One special problem that added complexity to the design is that -- One special problem that added complexity to the design is that the
-- the per-task list of indirect attributes contains objects of -- per-task list of indirect attributes contains objects of different types.
-- different types. We use unchecked pointer conversion to link -- We use unchecked pointer conversion to link these nodes together and
-- these nodes together and access them, but the records may not have -- access them, but the records may not have identical internal structure.
-- identical internal structure. Initially, we thought it would be -- Initially, we thought it would be enough to allocate all the common
-- enough to allocate all the common components of the records at the -- components of the records at the front of each record, so that their
-- front of each record, so that their positions would correspond. -- positions would correspond. Unfortunately, GNAT adds "dope" information at
-- Unfortunately, GNAT adds "dope" information at the front of a record, -- the front of a record, if the record contains any controlled-type
-- if the record contains any controlled-type components. -- components.
-- --
-- This means that the offset of the fields we use to link the nodes is -- This means that the offset of the fields we use to link the nodes is at
-- at different positions on nodes of different types. To get around this, -- different positions on nodes of different types. To get around this, each
-- each attribute storage record consists of a core node and wrapper. -- attribute storage record consists of a core node and wrapper. The core
-- The core nodes are all of the same type, and it is these that are -- nodes are all of the same type, and it is these that are linked together
-- linked together and generally "seen" by the RTS. Each core node -- and generally "seen" by the RTS. Each core node contains a pointer to its
-- contains a pointer to its own wrapper, which is a record that contains -- own wrapper, which is a record that contains the core node along with an
-- the core node along with an attribute value, approximately -- attribute value, approximately as follows:
-- as follows:
-- type Node; -- type Node;
-- type Node_Access is access all Node; -- type Node_Access is access all Node;
...@@ -211,51 +208,50 @@ ...@@ -211,51 +208,50 @@
-- Wrapper : Access_Wrapper; -- Wrapper : Access_Wrapper;
-- end record; -- end record;
-- type Wrapper is record -- type Wrapper is record
-- Noed : aliased Node; -- Dummy_Node : aliased Node;
-- Value : aliased Attribute; -- the generic formal type -- Value : aliased Attribute; -- the generic formal type
-- end record; -- end record;
-- Another interesting problem is with the initialization of -- Another interesting problem is with the initialization of the
-- the instantiation descriptors. Originally, we did this all via -- instantiation descriptors. Originally, we did this all via the Initialize
-- the Initialize procedure of the descriptor type and code in the -- procedure of the descriptor type and code in the package body. It turned
-- package body. It turned out that the Initialize procedure needed -- out that the Initialize procedure needed quite a bit of information,
-- quite a bit of information, including the size of the attribute -- including the size of the attribute type, the initial value of the
-- type, the initial value of the attribute (if it fits in the TCB), -- attribute (if it fits in the TCB), and a pointer to the deallocator
-- and a pointer to the deallocator procedure. These needed to be -- procedure. These needed to be "passed" in via access discriminants. GNAT
-- "passed" in via access discriminants. GNAT was having trouble -- was having trouble with access discriminants, so all this work was moved
-- with access discriminants, so all this work was moved to the -- to the package body.
-- package body.
with Ada.Task_Identification; with Ada.Task_Identification;
-- used for Task_Id -- Used for Task_Id
-- Null_Task_Id -- Null_Task_Id
-- Current_Task -- Current_Task
with System.Error_Reporting; with System.Error_Reporting;
-- used for Shutdown; -- Used for Shutdown;
with System.Storage_Elements; with System.Storage_Elements;
-- used for Integer_Address -- Used for Integer_Address
with System.Task_Primitives.Operations; with System.Task_Primitives.Operations;
-- used for Write_Lock -- Used for Write_Lock
-- Unlock -- Unlock
-- Lock/Unlock_RTS -- Lock/Unlock_RTS
with System.Tasking; with System.Tasking;
-- used for Access_Address -- Used for Access_Address
-- Task_Id -- Task_Id
-- Direct_Index_Vector -- Direct_Index_Vector
-- Direct_Index -- Direct_Index
with System.Tasking.Initialization; with System.Tasking.Initialization;
-- used for Defer_Abortion -- Used for Defer_Abortion
-- Undefer_Abortion -- Undefer_Abortion
-- Initialize_Attributes_Link -- Initialize_Attributes_Link
-- Finalize_Attributes_Link -- Finalize_Attributes_Link
with System.Tasking.Task_Attributes; with System.Tasking.Task_Attributes;
-- used for Access_Node -- Used for Access_Node
-- Access_Dummy_Wrapper -- Access_Dummy_Wrapper
-- Deallocator -- Deallocator
-- Instance -- Instance
...@@ -263,13 +259,13 @@ with System.Tasking.Task_Attributes; ...@@ -263,13 +259,13 @@ with System.Tasking.Task_Attributes;
-- Access_Instance -- Access_Instance
with Ada.Exceptions; with Ada.Exceptions;
-- used for Raise_Exception -- Used for Raise_Exception
with Unchecked_Conversion; with Unchecked_Conversion;
with Unchecked_Deallocation; with Unchecked_Deallocation;
pragma Elaborate_All (System.Tasking.Task_Attributes); pragma Elaborate_All (System.Tasking.Task_Attributes);
-- to ensure the initialization of object Local (below) will work -- To ensure the initialization of object Local (below) will work
package body Ada.Task_Attributes is package body Ada.Task_Attributes is
...@@ -295,11 +291,10 @@ package body Ada.Task_Attributes is ...@@ -295,11 +291,10 @@ package body Ada.Task_Attributes is
pragma Warnings (Off); pragma Warnings (Off);
-- We turn warnings off for the following declarations of the -- We turn warnings off for the following declarations of the
-- To_Attribute_Handle conversions, since these are used only -- To_Attribute_Handle conversions, since these are used only for small
-- for small attributes where we know that there are no problems -- attributes where we know that there are no problems with alignment, but
-- with alignment, but the compiler will generate warnings for -- the compiler will generate warnings for the occurrences in the large
-- the occurrences in the large attribute case, even though -- attribute case, even though they will not actually be used.
-- they will not actually be used.
function To_Attribute_Handle is new Unchecked_Conversion function To_Attribute_Handle is new Unchecked_Conversion
(System.Address, Attribute_Handle); (System.Address, Attribute_Handle);
...@@ -327,10 +322,10 @@ package body Ada.Task_Attributes is ...@@ -327,10 +322,10 @@ package body Ada.Task_Attributes is
(Access_Dummy_Wrapper, Access_Wrapper); (Access_Dummy_Wrapper, Access_Wrapper);
pragma Warnings (On); pragma Warnings (On);
-- To fetch pointer to actual wrapper of attribute node. We turn off -- To fetch pointer to actual wrapper of attribute node. We turn off
-- warnings since this may generate an alignment warning. The warning -- warnings since this may generate an alignment warning. The warning can
-- can be ignored since Dummy_Wrapper is only a non-generic standin -- be ignored since Dummy_Wrapper is only a non-generic standin for the
-- for the real wrapper type (we never actually allocate objects of -- real wrapper type (we never actually allocate objects of type
-- type Dummy_Wrapper). -- Dummy_Wrapper).
function To_Access_Dummy_Wrapper is new Unchecked_Conversion function To_Access_Dummy_Wrapper is new Unchecked_Conversion
(Access_Wrapper, Access_Dummy_Wrapper); (Access_Wrapper, Access_Dummy_Wrapper);
...@@ -364,7 +359,7 @@ package body Ada.Task_Attributes is ...@@ -364,7 +359,7 @@ package body Ada.Task_Attributes is
-- Initialized in package body -- Initialized in package body
type Wrapper is record type Wrapper is record
Noed : aliased Node; Dummy_Node : aliased Node;
Value : aliased Attribute := Initial_Value; Value : aliased Attribute := Initial_Value;
-- The generic formal type, may be controlled -- The generic formal type, may be controlled
...@@ -450,7 +445,7 @@ package body Ada.Task_Attributes is ...@@ -450,7 +445,7 @@ package body Ada.Task_Attributes is
((null, Local'Unchecked_Access, null), Initial_Value); ((null, Local'Unchecked_Access, null), Initial_Value);
POP.Lock_RTS; POP.Lock_RTS;
P := W.Noed'Unchecked_Access; P := W.Dummy_Node'Unchecked_Access;
P.Wrapper := To_Access_Dummy_Wrapper (W); P.Wrapper := To_Access_Dummy_Wrapper (W);
P.Next := To_Access_Node (TT.Indirect_Attributes); P.Next := To_Access_Node (TT.Indirect_Attributes);
TT.Indirect_Attributes := To_Access_Address (P); TT.Indirect_Attributes := To_Access_Address (P);
...@@ -605,14 +600,14 @@ package body Ada.Task_Attributes is ...@@ -605,14 +600,14 @@ package body Ada.Task_Attributes is
P := P.Next; P := P.Next;
end loop; end loop;
-- Unlock RTS here to follow the lock ordering rule that -- Unlock RTS here to follow the lock ordering rule that prevent us
-- prevent us from using new (i.e the Global_Lock) while -- from using new (i.e the Global_Lock) while holding any other
-- holding any other lock. -- lock.
POP.Unlock_RTS; POP.Unlock_RTS;
W := new Wrapper'((null, Local'Unchecked_Access, null), Val); W := new Wrapper'((null, Local'Unchecked_Access, null), Val);
POP.Lock_RTS; POP.Lock_RTS;
P := W.Noed'Unchecked_Access; P := W.Dummy_Node'Unchecked_Access;
P.Wrapper := To_Access_Dummy_Wrapper (W); P.Wrapper := To_Access_Dummy_Wrapper (W);
P.Next := To_Access_Node (TT.Indirect_Attributes); P.Next := To_Access_Node (TT.Indirect_Attributes);
TT.Indirect_Attributes := To_Access_Address (P); TT.Indirect_Attributes := To_Access_Address (P);
...@@ -661,9 +656,9 @@ package body Ada.Task_Attributes is ...@@ -661,9 +656,9 @@ package body Ada.Task_Attributes is
if Local.Index /= 0 then if Local.Index /= 0 then
-- Get value of attribute. Warnings off, because for large -- Get value of attribute. Warnings off, because for large
-- attributes, this code can generate alignment warnings. -- attributes, this code can generate alignment warnings. But of
-- But of course large attributes are never directly addressed -- course large attributes are never directly addressed so in fact
-- so in fact we will never execute the code in this case. -- we will never execute the code in this case.
pragma Warnings (Off); pragma Warnings (Off);
return To_Attribute_Handle return To_Attribute_Handle
...@@ -734,13 +729,13 @@ begin ...@@ -734,13 +729,13 @@ begin
POP.Lock_RTS; POP.Lock_RTS;
-- Add this instantiation to the list of all instantiations. -- Add this instantiation to the list of all instantiations
Local.Next := System.Tasking.Task_Attributes.All_Attributes; Local.Next := System.Tasking.Task_Attributes.All_Attributes;
System.Tasking.Task_Attributes.All_Attributes := System.Tasking.Task_Attributes.All_Attributes :=
Local'Unchecked_Access; Local'Unchecked_Access;
-- Try to find space for the attribute in the TCB. -- Try to find space for the attribute in the TCB
Local.Index := 0; Local.Index := 0;
Two_To_J := 1; Two_To_J := 1;
...@@ -754,9 +749,9 @@ begin ...@@ -754,9 +749,9 @@ begin
In_Use := In_Use or Two_To_J; In_Use := In_Use or Two_To_J;
Local.Index := J; Local.Index := J;
-- This unchecked conversions can give a warning when the -- This unchecked conversions can give a warning when the the
-- the alignment is incorrect, but it will not be used in -- alignment is incorrect, but it will not be used in such a
-- such a case anyway, so the warning can be safely ignored. -- case anyway, so the warning can be safely ignored.
pragma Warnings (Off); pragma Warnings (Off);
To_Attribute_Handle (Local.Initial_Value'Access).all := To_Attribute_Handle (Local.Initial_Value'Access).all :=
...@@ -773,13 +768,13 @@ begin ...@@ -773,13 +768,13 @@ begin
-- Attribute goes directly in the TCB -- Attribute goes directly in the TCB
if Local.Index /= 0 then if Local.Index /= 0 then
-- Replace stub for initialization routine -- Replace stub for initialization routine that is called at task
-- that is called at task creation. -- creation.
Initialization.Initialize_Attributes_Link := Initialization.Initialize_Attributes_Link :=
System.Tasking.Task_Attributes.Initialize_Attributes'Access; System.Tasking.Task_Attributes.Initialize_Attributes'Access;
-- Initialize the attribute, for all tasks. -- Initialize the attribute, for all tasks
declare declare
C : System.Tasking.Task_Id := System.Tasking.All_Tasks_List; C : System.Tasking.Task_Id := System.Tasking.All_Tasks_List;
...@@ -795,8 +790,8 @@ begin ...@@ -795,8 +790,8 @@ begin
-- Attribute goes into a node onto a linked list -- Attribute goes into a node onto a linked list
else else
-- Replace stub for finalization routine -- Replace stub for finalization routine that is called at task
-- that is called at task termination. -- termination.
Initialization.Finalize_Attributes_Link := Initialization.Finalize_Attributes_Link :=
System.Tasking.Task_Attributes.Finalize_Attributes'Access; System.Tasking.Task_Attributes.Finalize_Attributes'Access;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
-- MA 02111-1307, USA. -- -- MA 02111-1307, USA. --
-- -- -- --
-- GNAT was originally developed by the GNAT team at New York University. -- -- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. -- -- Extensive contributions were provided by AdaCore. --
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
...@@ -78,7 +78,7 @@ package body Comperr is ...@@ -78,7 +78,7 @@ package body Comperr is
-- the cause of the compiler abort and about the preferred method -- the cause of the compiler abort and about the preferred method
-- of reporting bugs. The default is a bug box appropriate for -- of reporting bugs. The default is a bug box appropriate for
-- the FSF version of GNAT, but there are specializations for -- the FSF version of GNAT, but there are specializations for
-- the GNATPRO and Public releases by Ada Core Technologies. -- the GNATPRO and Public releases by AdaCore.
procedure End_Line; procedure End_Line;
-- Add blanks up to column 76, and then a final vertical bar -- Add blanks up to column 76, and then a final vertical bar
...@@ -95,7 +95,6 @@ package body Comperr is ...@@ -95,7 +95,6 @@ package body Comperr is
Is_Public_Version : constant Boolean := Get_Gnat_Build_Type = Public; Is_Public_Version : constant Boolean := Get_Gnat_Build_Type = Public;
Is_FSF_Version : constant Boolean := Get_Gnat_Build_Type = FSF; Is_FSF_Version : constant Boolean := Get_Gnat_Build_Type = FSF;
Is_GAP_Version : constant Boolean := Get_Gnat_Build_Type = GAP;
-- Start of processing for Compiler_Abort -- Start of processing for Compiler_Abort
...@@ -268,22 +267,43 @@ package body Comperr is ...@@ -268,22 +267,43 @@ package body Comperr is
" http://gcc.gnu.org/bugs.html."); " http://gcc.gnu.org/bugs.html.");
End_Line; End_Line;
elsif Is_Public_Version then
Write_Str
("| submit bug report by email " &
"to report@adacore.com.");
End_Line;
Write_Str
("| See gnatinfo.txt for full info on procedure " &
"for submitting bugs.");
End_Line;
else else
Write_Str Write_Str
("| Please submit bug report by email " & ("| Please submit a bug report using GNAT Tracker:");
"to report@gnat.com.");
End_Line; End_Line;
Write_Str Write_Str
("| Use a subject line meaningful to you" & ("| http://www.adacore.com/gnattracker/ " &
" and us to track the bug."); "section 'send a report'.");
End_Line;
Write_Str
("| alternatively submit a bug report by email " &
"to report@adacore.com.");
End_Line; End_Line;
end if; end if;
Write_Str
("| Use a subject line meaningful to you" &
" and us to track the bug.");
End_Line;
if not (Is_Public_Version or Is_FSF_Version) then if not (Is_Public_Version or Is_FSF_Version) then
Write_Str Write_Str
("| (include your customer number #nnn " & ("| Include your customer number #nnn " &
"in the subject line)."); "in the subject line.");
End_Line; End_Line;
end if; end if;
...@@ -305,35 +325,9 @@ package body Comperr is ...@@ -305,35 +325,9 @@ package body Comperr is
("| (concatenated together with no headers between files)."); ("| (concatenated together with no headers between files).");
End_Line; End_Line;
if Is_Public_Version then if not Is_FSF_Version then
Write_Str Write_Str
("| (use plain ASCII or MIME attachment)."); ("| Use plain ASCII or MIME attachment.");
End_Line;
Write_Str
("| See gnatinfo.txt for full info on procedure " &
"for submitting bugs.");
End_Line;
elsif Is_GAP_Version then
Write_Str
("| (use plain ASCII or MIME attachment, or FTP "
& "to your GAP account.).");
End_Line;
Write_Str
("| Please use your GAP account to report this.");
End_Line;
elsif not Is_FSF_Version then
Write_Str
("| (use plain ASCII or MIME attachment, or FTP "
& "to your customer directory).");
End_Line;
Write_Str
("| See README.GNATPRO for full info on procedure " &
"for submitting bugs.");
End_Line; End_Line;
end if; end if;
end if; end if;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1996-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -107,8 +107,7 @@ package body System.Bit_Ops is ...@@ -107,8 +107,7 @@ package body System.Bit_Ops is
(Left : Address; (Left : Address;
Llen : Natural; Llen : Natural;
Right : Address; Right : Address;
Rlen : Natural) Rlen : Natural) return Boolean
return Boolean
is is
LeftB : constant Bits := To_Bits (Left); LeftB : constant Bits := To_Bits (Left);
RightB : constant Bits := To_Bits (Right); RightB : constant Bits := To_Bits (Right);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -40,7 +40,8 @@ package System.Bit_Ops is ...@@ -40,7 +40,8 @@ package System.Bit_Ops is
-- Note: in all the following routines, the System.Address parameters -- Note: in all the following routines, the System.Address parameters
-- represent the address of the first byte of an array used to represent -- represent the address of the first byte of an array used to represent
-- a packed array (of type System.Unsigned_Types.Packed_Bytes{1,2,4}) -- a packed array (of type System.Unsigned_Types.Packed_Bytes{1,2,4})
-- The length in bits is passed as a separate parameter. -- The length in bits is passed as a separate parameter. Note that all
-- addresses must be of byte aligned arrays.
procedure Bit_And procedure Bit_And
(Left : System.Address; (Left : System.Address;
...@@ -57,8 +58,7 @@ package System.Bit_Ops is ...@@ -57,8 +58,7 @@ package System.Bit_Ops is
(Left : System.Address; (Left : System.Address;
Llen : Natural; Llen : Natural;
Right : System.Address; Right : System.Address;
Rlen : Natural) Rlen : Natural) return Boolean;
return Boolean;
-- Left and Right are the addresses of two bit packed arrays with Llen -- Left and Right are the addresses of two bit packed arrays with Llen
-- and Rlen being the respective length in bits. The routine compares the -- and Rlen being the respective length in bits. The routine compares the
-- two bit strings for equality, being careful not to include the unused -- two bit strings for equality, being careful not to include the unused
......
...@@ -139,6 +139,12 @@ pragma Preelaborate (CRTL); ...@@ -139,6 +139,12 @@ pragma Preelaborate (CRTL);
function opendir (file_name : String) return DIRs; function opendir (file_name : String) return DIRs;
pragma Import (C, opendir, "opendir"); pragma Import (C, opendir, "opendir");
function pclose (stream : System.Address) return int;
pragma Import (C, pclose, "pclose");
function popen (command, mode : System.Address) return System.Address;
pragma Import (C, popen, "popen");
function read (fd : int; buffer : chars; nbytes : int) return int; function read (fd : int; buffer : chars; nbytes : int) return int;
pragma Import (C, read, "read"); pragma Import (C, read, "read");
......
...@@ -383,19 +383,22 @@ package body System.Finalization_Implementation is ...@@ -383,19 +383,22 @@ package body System.Finalization_Implementation is
procedure Finalize_Global_List is procedure Finalize_Global_List is
begin begin
-- There are three case here: -- There are three case here:
-- a. the application uses tasks, in which case Finalize_Global_Tasks -- a. the application uses tasks, in which case Finalize_Global_Tasks
-- will defer abortion -- will defer abort.
-- b. the application doesn't use tasks but uses other tasking -- b. the application doesn't use tasks but uses other tasking
-- constructs, such as ATCs and protected objects. In this case, -- constructs, such as ATCs and protected objects. In this case,
-- the binder will call Finalize_Global_List instead of -- the binder will call Finalize_Global_List instead of
-- Finalize_Global_Tasks, letting abort undeferred, and leading -- Finalize_Global_Tasks, letting abort undeferred, and leading
-- to assertion failures in the GNULL -- to assertion failures in the GNULL
-- c. the application doesn't use any tasking construct in which case -- c. the application doesn't use any tasking construct in which case
-- deferring abort isn't necessary. -- deferring abort isn't necessary.
--
-- Until another solution is found to deal with case b, we need to -- Until another solution is found to deal with case b, we need to
-- call abort_defer here to pass the checks, but we do not need to -- call abort_defer here to pass the checks, but we do not need to
-- undefer abortion, since Finalize_Global_List is the last procedure -- undefer abort, since Finalize_Global_List is the last procedure
-- called before exiting the partition. -- called before exiting the partition.
SSL.Abort_Defer.all; SSL.Abort_Defer.all;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1991-2003 Free Software Foundation, Inc. -- -- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,30 +31,31 @@ ...@@ -31,30 +31,31 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This is the Alpha/VMS version of this package. -- This is the Alpha/VMS version of this package
--
-- This package encapsulates and centralizes information about
-- all uses of interrupts (or signals), including the
-- target-dependent mapping of interrupts (or signals) to exceptions.
-- PLEASE DO NOT add any with-clauses to this package. -- This package encapsulates and centralizes information about all uses of
-- This is designed to work for both tasking and non-tasking systems, -- interrupts (or signals), including the target-dependent mapping of
-- without pulling in any of the tasking support. -- interrupts (or signals) to exceptions.
-- PLEASE DO NOT add any with-clauses to this package
-- This is designed to work for both tasking and non-tasking systems, without
-- pulling in any of the tasking support.
-- PLEASE DO NOT remove the Elaborate_Body pragma from this package. -- PLEASE DO NOT remove the Elaborate_Body pragma from this package.
-- Elaboration of this package should happen early, as most other -- Elaboration of this package should happen early, as most other
-- initializations depend on it.
-- Forcing immediate elaboration of the body also helps to enforce -- Forcing immediate elaboration of the body also helps to enforce the design
-- the design assumption that this is a second-level -- assumption that this is a second-level package, just one level above
-- package, just one level above System.OS_Interface, with no -- System.OS_Interface, with no cross-dependences.
-- cross-dependences.
-- PLEASE DO NOT put any subprogram declarations with arguments of type
-- PLEASE DO NOT put any subprogram declarations with arguments of -- Interrupt_ID into the visible part of this package.
-- type Interrupt_ID into the visible part of this package.
-- The type Interrupt_ID is used to derive the type in Ada.Interrupts, -- The type Interrupt_ID is used to derive the type in Ada.Interrupts, and
-- and adding more operations to that type would be illegal according -- adding more operations to that type would be illegal according to the Ada
-- to the Ada Reference Manual. (This is the reason why the signals sets -- Reference Manual. (This is the reason why the signals sets below are
-- below are implemented as visible arrays rather than functions.) -- implemented as visible arrays rather than functions.)
with System.OS_Interface; with System.OS_Interface;
-- used for Signal -- used for Signal
...@@ -70,49 +71,44 @@ package System.Interrupt_Management is ...@@ -70,49 +71,44 @@ package System.Interrupt_Management is
type Interrupt_Set is array (Interrupt_ID) of Boolean; type Interrupt_Set is array (Interrupt_ID) of Boolean;
-- The following objects serve as constants, but are initialized -- The following objects serve as constants, but are initialized in the
-- in the body to aid portability. This permits us -- body to aid portability. This permits us to use more portable names for
-- to use more portable names for interrupts, -- interrupts, where distinct names may map to the same interrupt ID
-- where distinct names may map to the same interrupt ID value. -- value. For example, suppose SIGRARE is a signal that is not defined on
-- For example, suppose SIGRARE is a signal that is not defined on -- all systems, but is always reserved when it is defined. If we have the
-- all systems, but is always reserved when it is defined. -- convention that ID zero is not used for any "real" signals, and SIGRARE
-- If we have the convention that ID zero is not used for any "real" -- = 0 when SIGRARE is not one of the locally supported signals, we can
-- signals, and SIGRARE = 0 when SIGRARE is not one of the locally -- write
-- supported signals, we can write
-- Reserved (SIGRARE) := true; -- Reserved (SIGRARE) := true;
-- and the initialization code will be portable.
-- Then the initialization code will be portable
Abort_Task_Interrupt : Interrupt_ID; Abort_Task_Interrupt : Interrupt_ID;
-- The interrupt that is used to implement task abortion, -- The interrupt that is used to implement task abort, if an interrupt is
-- if an interrupt is used for that purpose. -- used for that purpose. This is one of the reserved interrupts.
-- This is one of the reserved interrupts.
Keep_Unmasked : Interrupt_Set := (others => False); Keep_Unmasked : Interrupt_Set := (others => False);
-- Keep_Unmasked (I) is true iff the interrupt I is -- Keep_Unmasked (I) is true iff the interrupt I is one that must be kept
-- one that must be kept unmasked at all times, -- unmasked at all times, except (perhaps) for short critical sections.
-- except (perhaps) for short critical sections. -- This includes interrupts that are mapped to exceptions (see
-- This includes interrupts that are mapped to exceptions -- System.Interrupt_Exceptions.Is_Exception), but may also include
-- (see System.Interrupt_Exceptions.Is_Exception), but may also -- interrupts (e.g. timer) that need to be kept unmasked for other
-- include interrupts (e.g. timer) that need to be kept unmasked -- reasons. Where interrupts are implemented as OS signals, and signal
-- for other reasons. -- masking is per-task, the interrupt should be unmasked in ALL TASKS.
-- Where interrupts are implemented as OS signals, and signal masking
-- is per-task, the interrupt should be unmasked in ALL TASKS.
Reserve : Interrupt_Set := (others => False); Reserve : Interrupt_Set := (others => False);
-- Reserve (I) is true iff the interrupt I is one that -- Reserve (I) is true iff the interrupt I is one that cannot be permitted
-- cannot be permitted to be attached to a user handler. -- to be attached to a user handler. The possible reasons are many. For
-- The possible reasons are many. For example, -- example it may be mapped to an exception used to implement task abort.
-- it may be mapped to an exception, used to implement task abortion,
-- or used to implement time delays.
Keep_Masked : Interrupt_Set := (others => False); Keep_Masked : Interrupt_Set := (others => False);
-- Keep_Masked (I) is true iff the interrupt I must always be masked. -- Keep_Masked (I) is true iff the interrupt I must always be masked.
-- Where interrupts are implemented as OS signals, and signal masking -- Where interrupts are implemented as OS signals, and signal masking is
-- is per-task, the interrupt should be masked in ALL TASKS. -- per-task, the interrupt should be masked in ALL TASKS. There might not
-- There might not be any interrupts in this class, depending on -- be any interrupts in this class, depending on the environment. For
-- the environment. For example, if interrupts are OS signals -- example, if interrupts are OS signals and signal masking is per-task,
-- and signal masking is per-task, use of the sigwait operation -- use of the sigwait operation requires the signal be masked in all tasks.
-- requires the signal be masked in all tasks.
procedure Initialize_Interrupts; procedure Initialize_Interrupts;
-- On systems where there is no signal inheritance between tasks (e.g -- On systems where there is no signal inheritance between tasks (e.g
...@@ -121,7 +117,6 @@ package System.Interrupt_Management is ...@@ -121,7 +117,6 @@ package System.Interrupt_Management is
-- only be called by initialize in this package body. -- only be called by initialize in this package body.
private private
use type System.OS_Interface.unsigned_long; use type System.OS_Interface.unsigned_long;
type Interrupt_Mask is new System.OS_Interface.sigset_t; type Interrupt_Mask is new System.OS_Interface.sigset_t;
...@@ -136,7 +131,7 @@ private ...@@ -136,7 +131,7 @@ private
Rcv_Interrupt_Chan : System.OS_Interface.unsigned_short := 0; Rcv_Interrupt_Chan : System.OS_Interface.unsigned_short := 0;
Snd_Interrupt_Chan : System.OS_Interface.unsigned_short := 0; Snd_Interrupt_Chan : System.OS_Interface.unsigned_short := 0;
Interrupt_Mailbox : Interrupt_ID := 0; Interrupt_Mailbox : Interrupt_ID := 0;
Interrupt_Bufquo : System.OS_Interface.unsigned_long Interrupt_Bufquo : System.OS_Interface.unsigned_long :=
:= 1000 * (Interrupt_ID'Size / 8); 1000 * (Interrupt_ID'Size / 8);
end System.Interrupt_Management; end System.Interrupt_Management;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2003 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This is the VxWorks version of this package. -- This is the VxWorks version of this package
-- This package encapsulates and centralizes information about all -- This package encapsulates and centralizes information about all
-- uses of interrupts (or signals), including the target-dependent -- uses of interrupts (or signals), including the target-dependent
...@@ -76,48 +76,48 @@ package System.Interrupt_Management is ...@@ -76,48 +76,48 @@ package System.Interrupt_Management is
type Signal_Set is array (Signal_ID) of Boolean; type Signal_Set is array (Signal_ID) of Boolean;
-- The following objects serve as constants, but are initialized -- The following objects serve as constants, but are initialized in the
-- in the body to aid portability. This permits us to use more -- body to aid portability. This permits us to use more portable names for
-- portable names for interrupts, where distinct names may map to -- interrupts, where distinct names may map to the same interrupt ID
-- the same interrupt ID value. -- value.
--
-- For example, suppose SIGRARE is a signal that is not defined on -- For example, suppose SIGRARE is a signal that is not defined on all
-- all systems, but is always reserved when it is defined. If we -- systems, but is always reserved when it is defined. If we have the
-- have the convention that ID zero is not used for any "real" -- convention that ID zero is not used for any "real" signals, and SIGRARE
-- signals, and SIGRARE = 0 when SIGRARE is not one of the locally -- = 0 when SIGRARE is not one of the locally supported signals, we can
-- supported signals, we can write -- write:
-- Reserved (SIGRARE) := true; -- Reserved (SIGRARE) := true;
-- and the initialization code will be portable. -- and the initialization code will be portable.
Abort_Task_Signal : Signal_ID; Abort_Task_Signal : Signal_ID;
-- The signal that is used to implement task abortion if -- The signal that is used to implement task abort if an interrupt is used
-- an interrupt is used for that purpose. This is one of the -- for that purpose. This is one of the reserved signals.
-- reserved signals.
Keep_Unmasked : Signal_Set := (others => False); Keep_Unmasked : Signal_Set := (others => False);
-- Keep_Unmasked (I) is true iff the signal I is one that must -- Keep_Unmasked (I) is true iff the signal I is one that must that must
-- that must be kept unmasked at all times, except (perhaps) for -- be kept unmasked at all times, except (perhaps) for short critical
-- short critical sections. This includes signals that are -- sections. This includes signals that are mapped to exceptions, but may
-- mapped to exceptions, but may also include interrupts -- also include interrupts (e.g. timer) that need to be kept unmasked for
-- (e.g. timer) that need to be kept unmasked for other -- other reasons. Where signal masking is per-task, the signal should be
-- reasons. Where signal masking is per-task, the signal should be
-- unmasked in ALL TASKS. -- unmasked in ALL TASKS.
Reserve : Interrupt_Set := (others => False); Reserve : Interrupt_Set := (others => False);
-- Reserve (I) is true iff the interrupt I is one that cannot be -- Reserve (I) is true iff the interrupt I is one that cannot be permitted
-- permitted to be attached to a user handler. The possible reasons -- to be attached to a user handler. The possible reasons are many. For
-- are many. For example, it may be mapped to an exception used to -- example, it may be mapped to an exception used to implement task abort,
-- implement task abortion, or used to implement time delays. -- or used to implement time delays.
procedure Initialize_Interrupts; procedure Initialize_Interrupts;
-- On systems where there is no signal inheritance between tasks (e.g -- On systems where there is no signal inheritance between tasks (e.g
-- VxWorks, GNU/LinuxThreads), this procedure is used to initialize -- VxWorks, GNU/LinuxThreads), this procedure is used to initialize
-- interrupts handling in each task. Otherwise this function should -- interrupts handling in each task. Otherwise this function should only
-- only be called by initialize in this package body. -- be called by initialize in this package body.
private private
type Interrupt_Mask is new System.OS_Interface.sigset_t; type Interrupt_Mask is new System.OS_Interface.sigset_t;
-- In some implementation Interrupt_Mask can be represented -- In some implementation Interrupt_Mask can be represented as a linked
-- as a linked list. -- list.
end System.Interrupt_Management; end System.Interrupt_Management;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2003 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,26 +31,26 @@ ...@@ -31,26 +31,26 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This package encapsulates and centralizes information about all -- This package encapsulates and centralizes information about all uses of
-- uses of interrupts (or signals), including the target-dependent -- interrupts (or signals), including the target-dependent mapping of
-- mapping of interrupts (or signals) to exceptions. -- interrupts (or signals) to exceptions.
-- Unlike the original design, System.Interrupt_Management can only -- Unlike the original design, System.Interrupt_Management can only be used
-- be used for tasking systems. -- for tasking systems.
-- PLEASE DO NOT remove the Elaborate_Body pragma from this package. -- PLEASE DO NOT remove the Elaborate_Body pragma from this package.
-- Elaboration of this package should happen early, as most other -- Elaboration of this package should happen early, as most other
-- initializations depend on it. Forcing immediate elaboration of -- initializations depend on it. Forcing immediate elaboration of the body
-- the body also helps to enforce the design assumption that this -- also helps to enforce the design assumption that this is a second-level
-- is a second-level package, just one level above System.OS_Interface -- package, just one level above System.OS_Interface with no
-- with no cross-dependencies. -- cross-dependencies.
-- PLEASE DO NOT put any subprogram declarations with arguments of -- PLEASE DO NOT put any subprogram declarations with arguments of type
-- type Interrupt_ID into the visible part of this package. The type -- Interrupt_ID into the visible part of this package. The type Interrupt_ID
-- Interrupt_ID is used to derive the type in Ada.Interrupts, and -- is used to derive the type in Ada.Interrupts, and adding more operations
-- adding more operations to that type would be illegal according -- to that type would be illegal according to the Ada Reference Manual. This
-- to the Ada Reference Manual. This is the reason why the signals -- is the reason why the signals sets are implemeneted using visible arrays
-- sets are implemeneted using visible arrays rather than functions. -- rather than functions.
with System.OS_Interface; with System.OS_Interface;
-- used for sigset_t -- used for sigset_t
...@@ -69,49 +69,49 @@ package System.Interrupt_Management is ...@@ -69,49 +69,49 @@ package System.Interrupt_Management is
type Interrupt_Set is array (Interrupt_ID) of Boolean; type Interrupt_Set is array (Interrupt_ID) of Boolean;
-- The following objects serve as constants, but are initialized -- The following objects serve as constants, but are initialized in the
-- in the body to aid portability. This permits us to use more -- body to aid portability. This permits us to use more portable names for
-- portable names for interrupts, where distinct names may map to -- interrupts, where distinct names may map to the same interrupt ID
-- the same interrupt ID value. -- value.
--
-- For example, suppose SIGRARE is a signal that is not defined on -- For example, suppose SIGRARE is a signal that is not defined on all
-- all systems, but is always reserved when it is defined. If we -- systems, but is always reserved when it is defined. If we have the
-- have the convention that ID zero is not used for any "real" -- convention that ID zero is not used for any "real" signals, and SIGRARE
-- signals, and SIGRARE = 0 when SIGRARE is not one of the locally -- = 0 when SIGRARE is not one of the locally supported signals, we can
-- supported signals, we can write -- write
-- Reserved (SIGRARE) := true;
-- Reserved (SIGRARE) := True;
-- and the initialization code will be portable. -- and the initialization code will be portable.
Abort_Task_Interrupt : Interrupt_ID; Abort_Task_Interrupt : Interrupt_ID;
-- The interrupt that is used to implement task abortion if -- The interrupt that is used to implement task abort if an interrupt is
-- an interrupt is used for that purpose. This is one of the -- used for that purpose. This is one of the reserved interrupts.
-- reserved interrupts.
Keep_Unmasked : Interrupt_Set := (others => False); Keep_Unmasked : Interrupt_Set := (others => False);
-- Keep_Unmasked (I) is true iff the interrupt I is one that must -- Keep_Unmasked (I) is true iff the interrupt I is one that must that
-- that must be kept unmasked at all times, except (perhaps) for -- must be kept unmasked at all times, except (perhaps) for short critical
-- short critical sections. This includes interrupts that are -- sections. This includes interrupts that are mapped to exceptions (see
-- mapped to exceptions (see System.Interrupt_Exceptions.Is_Exception), -- System.Interrupt_Exceptions.Is_Exception), but may also include
-- but may also include interrupts (e.g. timer) that need to be kept -- interrupts (e.g. timer) that need to be kept unmasked for other
-- unmasked for other reasons. Where interrupts are implemented as -- reasons. Where interrupts are implemented as OS signals, and signal
-- OS signals, and signal masking is per-task, the interrupt should -- masking is per-task, the interrupt should be unmasked in ALL TASKS.
-- be unmasked in ALL TASKS.
Reserve : Interrupt_Set := (others => False); Reserve : Interrupt_Set := (others => False);
-- Reserve (I) is true iff the interrupt I is one that cannot be -- Reserve (I) is true iff the interrupt I is one that cannot be permitted
-- permitted to be attached to a user handler. The possible reasons -- to be attached to a user handler. The possible reasons are many. For
-- are many. For example, it may be mapped to an exception used to -- example, it may be mapped to an exception used to implement task abort,
-- implement task abortion, or used to implement time delays. -- or used to implement time delays.
procedure Initialize_Interrupts; procedure Initialize_Interrupts;
-- On systems where there is no signal inheritance between tasks (e.g -- On systems where there is no signal inheritance between tasks (e.g
-- VxWorks, GNU/LinuxThreads), this procedure is used to initialize -- VxWorks, GNU/LinuxThreads), this procedure is used to initialize
-- interrupts handling in each task. Otherwise this function should -- interrupts handling in each task. Otherwise this function should only
-- only be called by initialize in this package body. -- be called by initialize in this package body.
private private
type Interrupt_Mask is new System.OS_Interface.sigset_t; type Interrupt_Mask is new System.OS_Interface.sigset_t;
-- In some implementation Interrupt_Mask can be represented -- In some implementations Interrupt_Mask can be represented as a linked
-- as a linked list. -- list.
end System.Interrupt_Management; end System.Interrupt_Management;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2003 Free Software Foundation, Inc. -- -- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -35,13 +35,13 @@ ...@@ -35,13 +35,13 @@
-- This implementation assumes that the underlying malloc/free/realloc -- This implementation assumes that the underlying malloc/free/realloc
-- implementation is thread safe, and thus, no additional lock is required. -- implementation is thread safe, and thus, no additional lock is required.
-- Note that we still need to defer abortion because on most systems, -- Note that we still need to defer abort because on most systems, an
-- an asynchronous signal (as used for implementing asynchronous abortion -- asynchronous signal (as used for implementing asynchronous abort of
-- of task) cannot safely be handled while malloc is executing. -- task) cannot safely be handled while malloc is executing.
-- If you are not using Ada constructs containing the "abort" keyword, -- If you are not using Ada constructs containing the "abort" keyword, then
-- then you can remove the calls to Abort_Defer.all and Abort_Undefer.all -- you can remove the calls to Abort_Defer.all and Abort_Undefer.all from
-- from this unit. -- this unit.
with Ada.Exceptions; with Ada.Exceptions;
with System.Soft_Links; with System.Soft_Links;
......
...@@ -52,7 +52,7 @@ package System.Soft_Links is ...@@ -52,7 +52,7 @@ package System.Soft_Links is
pragma Import pragma Import
(Ada, Current_Target_Exception, (Ada, Current_Target_Exception,
"__gnat_current_target_exception"); "__gnat_current_target_exception");
-- Import this subprogram from the private part of Ada.Exceptions. -- Import this subprogram from the private part of Ada.Exceptions
-- First we have the access subprogram types used to establish the links. -- First we have the access subprogram types used to establish the links.
-- The approach is to establish variables containing access subprogram -- The approach is to establish variables containing access subprogram
...@@ -112,20 +112,20 @@ package System.Soft_Links is ...@@ -112,20 +112,20 @@ package System.Soft_Links is
-- Declarations for the no tasking versions of the required routines -- Declarations for the no tasking versions of the required routines
procedure Abort_Defer_NT; procedure Abort_Defer_NT;
-- Defer task abortion (non-tasking case, does nothing) -- Defer task abort (non-tasking case, does nothing)
procedure Abort_Undefer_NT; procedure Abort_Undefer_NT;
-- Undefer task abortion (non-tasking case, does nothing) -- Undefer task abort (non-tasking case, does nothing)
procedure Abort_Handler_NT; procedure Abort_Handler_NT;
-- Handle task abortion (non-tasking case, does nothing). Currently, -- Handle task abort (non-tasking case, does nothing). Currently, only VMS
-- only VMS uses this. -- uses this.
procedure Update_Exception_NT (X : EO := Current_Target_Exception); procedure Update_Exception_NT (X : EO := Current_Target_Exception);
-- Handle exception setting. This routine is provided for targets -- Handle exception setting. This routine is provided for targets which
-- which have built-in exception handling such as the Java Virtual -- have built-in exception handling such as the Java Virtual Machine.
-- Machine. Currently, only JGNAT uses this. See 4jexcept.ads for -- Currently, only JGNAT uses this. See 4jexcept.ads for an explanation on
-- an explanation on how this routine is used. -- how this routine is used.
function Check_Abort_Status_NT return Integer; function Check_Abort_Status_NT return Integer;
-- Returns Boolean'Pos (True) iff abort signal should raise -- Returns Boolean'Pos (True) iff abort signal should raise
...@@ -143,14 +143,14 @@ package System.Soft_Links is ...@@ -143,14 +143,14 @@ package System.Soft_Links is
Abort_Defer : No_Param_Proc := Abort_Defer_NT'Access; Abort_Defer : No_Param_Proc := Abort_Defer_NT'Access;
pragma Suppress (Access_Check, Abort_Defer); pragma Suppress (Access_Check, Abort_Defer);
-- Defer task abortion (task/non-task case as appropriate) -- Defer task abort (task/non-task case as appropriate)
Abort_Undefer : No_Param_Proc := Abort_Undefer_NT'Access; Abort_Undefer : No_Param_Proc := Abort_Undefer_NT'Access;
pragma Suppress (Access_Check, Abort_Undefer); pragma Suppress (Access_Check, Abort_Undefer);
-- Undefer task abortion (task/non-task case as appropriate) -- Undefer task abort (task/non-task case as appropriate)
Abort_Handler : No_Param_Proc := Abort_Handler_NT'Access; Abort_Handler : No_Param_Proc := Abort_Handler_NT'Access;
-- Handle task abortion (task/non-task case as appropriate) -- Handle task abort (task/non-task case as appropriate)
Update_Exception : Special_EO_Call := Update_Exception_NT'Access; Update_Exception : Special_EO_Call := Update_Exception_NT'Access;
-- Handle exception setting and tasking polling when appropriate -- Handle exception setting and tasking polling when appropriate
...@@ -196,7 +196,7 @@ package System.Soft_Links is ...@@ -196,7 +196,7 @@ package System.Soft_Links is
-- explicitly or implicitly during the critical locked region. -- explicitly or implicitly during the critical locked region.
Adafinal : No_Param_Proc := Null_Adafinal'Access; Adafinal : No_Param_Proc := Null_Adafinal'Access;
-- Performs the finalization of the Ada Runtime. -- Performs the finalization of the Ada Runtime
function Get_Jmpbuf_Address_NT return Address; function Get_Jmpbuf_Address_NT return Address;
procedure Set_Jmpbuf_Address_NT (Addr : Address); procedure Set_Jmpbuf_Address_NT (Addr : Address);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1998-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This package contains the procedures to implements timeouts (delays) -- This package contains the procedures to implements timeouts (delays) for
-- for asynchronous select statements. -- asynchronous select statements.
-- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes. -- Any changes to this interface may require corresponding compiler changes.
...@@ -100,8 +100,8 @@ package System.Tasking.Async_Delays is ...@@ -100,8 +100,8 @@ package System.Tasking.Async_Delays is
(T : in Duration; (T : in Duration;
D : Delay_Block_Access) return Boolean; D : Delay_Block_Access) return Boolean;
-- Enqueue the specified relative delay. Returns True if the delay has -- Enqueue the specified relative delay. Returns True if the delay has
-- been enqueued, False if it has already expired. -- been enqueued, False if it has already expired. If the delay has been
-- If the delay has been enqueued, abortion is deferred. -- enqueued, abort is deferred.
procedure Cancel_Async_Delay (D : Delay_Block_Access); procedure Cancel_Async_Delay (D : Delay_Block_Access);
-- Cancel the specified asynchronous delay -- Cancel the specified asynchronous delay
...@@ -117,10 +117,10 @@ package System.Tasking.Async_Delays is ...@@ -117,10 +117,10 @@ package System.Tasking.Async_Delays is
private private
type Delay_Block is record type Delay_Block is record
Self_Id : Task_Id; Self_Id : Task_Id;
-- ID of the calling task -- ID of the calling task
Level : ATC_Level_Base; Level : ATC_Level_Base;
-- Normally Level is the ATC nesting level of the -- Normally Level is the ATC nesting level of the
-- async. select statement to which this delay belongs, but -- async. select statement to which this delay belongs, but
-- after a call has been dequeued we set it to -- after a call has been dequeued we set it to
...@@ -130,10 +130,10 @@ private ...@@ -130,10 +130,10 @@ private
Resume_Time : Duration; Resume_Time : Duration;
-- The absolute wake up time, represented as Duration -- The absolute wake up time, represented as Duration
Timed_Out : Boolean := False; Timed_Out : Boolean := False;
-- Set to true if the delay has timed out -- Set to true if the delay has timed out
Succ, Pred : Delay_Block_Access; Succ, Pred : Delay_Block_Access;
-- A double linked list -- A double linked list
end record; end record;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2004, Ada Core Technologies -- -- Copyright (C) 1995-2005, Ada Core Technologies --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -90,15 +90,15 @@ package body System.Tasking.Protected_Objects is ...@@ -90,15 +90,15 @@ package body System.Tasking.Protected_Objects is
Ceiling_Violation : Boolean; Ceiling_Violation : Boolean;
begin begin
-- The lock is made without defering abortion. -- The lock is made without defering abort
-- Therefore the abortion has to be deferred before calling this -- Therefore the abort has to be deferred before calling this routine.
-- routine. This means that the compiler has to generate a Defer_Abort -- This means that the compiler has to generate a Defer_Abort call
-- call before the call to Lock. -- before the call to Lock.
-- The caller is responsible for undeferring abortion, and compiler -- The caller is responsible for undeferring abort, and compiler
-- generated calls must be protected with cleanup handlers to ensure -- generated calls must be protected with cleanup handlers to ensure
-- that abortion is undeferred in all cases. -- that abort is undeferred in all cases.
Write_Lock (Object.L'Access, Ceiling_Violation); Write_Lock (Object.L'Access, Ceiling_Violation);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -112,7 +112,7 @@ package body System.Task_Primitives.Operations is ...@@ -112,7 +112,7 @@ package body System.Task_Primitives.Operations is
-- Local Data -- -- Local Data --
----------------- -----------------
-- The OS/2 DosAllocThreadLocalMemory API is used to allocate our TCB_Ptr. -- The OS/2 DosAllocThreadLocalMemory API is used to allocate our TCB_Ptr
-- This API reserves a small range of virtual addresses that is backed -- This API reserves a small range of virtual addresses that is backed
-- by different physical memory for each running thread. In this case we -- by different physical memory for each running thread. In this case we
...@@ -141,7 +141,7 @@ package body System.Task_Primitives.Operations is ...@@ -141,7 +141,7 @@ package body System.Task_Primitives.Operations is
-- Used mainly in Single_Lock mode, but also to protect All_Tasks_List -- Used mainly in Single_Lock mode, but also to protect All_Tasks_List
Environment_Task_Id : Task_Id; Environment_Task_Id : Task_Id;
-- A variable to hold Task_Id for the environment task. -- A variable to hold Task_Id for the environment task
----------------------- -----------------------
-- Local Subprograms -- -- Local Subprograms --
...@@ -223,7 +223,7 @@ package body System.Task_Primitives.Operations is ...@@ -223,7 +223,7 @@ package body System.Task_Primitives.Operations is
Self_ID : Task_Id renames Thread_Local_Data_Ptr.Self_ID; Self_ID : Task_Id renames Thread_Local_Data_Ptr.Self_ID;
begin begin
-- Check that the thread local data has been initialized. -- Check that the thread local data has been initialized
pragma Assert pragma Assert
((Thread_Local_Data_Ptr /= null ((Thread_Local_Data_Ptr /= null
...@@ -458,7 +458,7 @@ package body System.Task_Primitives.Operations is ...@@ -458,7 +458,7 @@ package body System.Task_Primitives.Operations is
Count : aliased ULONG; -- Used to store dummy result Count : aliased ULONG; -- Used to store dummy result
begin begin
-- Must reset Cond BEFORE L is unlocked. -- Must reset Cond BEFORE L is unlocked
Sem_Must_Not_Fail Sem_Must_Not_Fail
(DosResetEventSem (Self_ID.Common.LL.CV, Count'Unchecked_Access)); (DosResetEventSem (Self_ID.Common.LL.CV, Count'Unchecked_Access));
...@@ -475,7 +475,7 @@ package body System.Task_Primitives.Operations is ...@@ -475,7 +475,7 @@ package body System.Task_Primitives.Operations is
Sem_Must_Not_Fail Sem_Must_Not_Fail
(DosWaitEventSem (Self_ID.Common.LL.CV, SEM_INDEFINITE_WAIT)); (DosWaitEventSem (Self_ID.Common.LL.CV, SEM_INDEFINITE_WAIT));
-- Since L was previously accquired, lock operation should not fail. -- Since L was previously accquired, lock operation should not fail
if Single_Lock then if Single_Lock then
Lock_RTS; Lock_RTS;
...@@ -516,7 +516,7 @@ package body System.Task_Primitives.Operations is ...@@ -516,7 +516,7 @@ package body System.Task_Primitives.Operations is
Count : aliased ULONG; -- Used to store dummy result Count : aliased ULONG; -- Used to store dummy result
begin begin
-- Must reset Cond BEFORE Self_ID is unlocked. -- Must reset Cond BEFORE Self_ID is unlocked
Sem_Must_Not_Fail Sem_Must_Not_Fail
(DosResetEventSem (Self_ID.Common.LL.CV, (DosResetEventSem (Self_ID.Common.LL.CV,
...@@ -611,7 +611,7 @@ package body System.Task_Primitives.Operations is ...@@ -611,7 +611,7 @@ package body System.Task_Primitives.Operations is
Write_Lock (Self_ID); Write_Lock (Self_ID);
end if; end if;
-- Must reset Cond BEFORE Self_ID is unlocked. -- Must reset Cond BEFORE Self_ID is unlocked
Sem_Must_Not_Fail Sem_Must_Not_Fail
(DosResetEventSem (Self_ID.Common.LL.CV, (DosResetEventSem (Self_ID.Common.LL.CV,
...@@ -767,7 +767,7 @@ package body System.Task_Primitives.Operations is ...@@ -767,7 +767,7 @@ package body System.Task_Primitives.Operations is
procedure Enter_Task (Self_ID : Task_Id) is procedure Enter_Task (Self_ID : Task_Id) is
begin begin
-- Initialize thread local data. Must be done first. -- Initialize thread local data. Must be done first
Thread_Local_Data_Ptr.Self_ID := Self_ID; Thread_Local_Data_Ptr.Self_ID := Self_ID;
Thread_Local_Data_Ptr.Lock_Prio_Level := 0; Thread_Local_Data_Ptr.Lock_Prio_Level := 0;
...@@ -927,7 +927,7 @@ package body System.Task_Primitives.Operations is ...@@ -927,7 +927,7 @@ package body System.Task_Primitives.Operations is
T.Common.LL.Wrapper := To_PFNTHREAD (Wrapper); T.Common.LL.Wrapper := To_PFNTHREAD (Wrapper);
-- The OS implicitly gives the new task the priority of this task. -- The OS implicitly gives the new task the priority of this task
T.Common.LL.Current_Priority := Self.Common.LL.Current_Priority; T.Common.LL.Current_Priority := Self.Common.LL.Current_Priority;
...@@ -1007,7 +1007,7 @@ package body System.Task_Primitives.Operations is ...@@ -1007,7 +1007,7 @@ package body System.Task_Primitives.Operations is
begin begin
null; null;
-- Task abortion not implemented yet. -- Task abort not implemented yet.
-- Should perform other action ??? -- Should perform other action ???
end Abort_Task; end Abort_Task;
...@@ -1103,9 +1103,9 @@ package body System.Task_Primitives.Operations is ...@@ -1103,9 +1103,9 @@ package body System.Task_Primitives.Operations is
Environment_Task_Id := Environment_Task; Environment_Task_Id := Environment_Task;
Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level); Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level);
-- Initialize the lock used to synchronize chain of all ATCBs. -- Initialize the lock used to synchronize chain of all ATCBs
-- Set ID of environment task. -- Set ID of environment task
Thread_Local_Data_Ptr.Self_ID := Environment_Task; Thread_Local_Data_Ptr.Self_ID := Environment_Task;
Environment_Task.Common.LL.Thread := 1; -- By definition Environment_Task.Common.LL.Thread := 1; -- By definition
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -91,12 +91,12 @@ package body System.Task_Primitives.Operations is ...@@ -91,12 +91,12 @@ package body System.Task_Primitives.Operations is
-- Local Data -- -- Local Data --
---------------- ----------------
-- The followings are logically constants, but need to be initialized -- The followings are logically constants, but need to be initialized at
-- at run time. -- run time.
Single_RTS_Lock : aliased RTS_Lock; Single_RTS_Lock : aliased RTS_Lock;
-- This is a lock to allow only one thread of control in the RTS at -- This is a lock to allow only one thread of control in the RTS at a
-- a time; it is used to execute in mutual exclusion from all other tasks. -- time; it is used to execute in mutual exclusion from all other tasks.
-- Used mainly in Single_Lock mode, but also to protect All_Tasks_List -- Used mainly in Single_Lock mode, but also to protect All_Tasks_List
ATCB_Key : aliased System.Address := System.Null_Address; ATCB_Key : aliased System.Address := System.Null_Address;
...@@ -109,12 +109,12 @@ package body System.Task_Primitives.Operations is ...@@ -109,12 +109,12 @@ package body System.Task_Primitives.Operations is
-- targets. -- targets.
Environment_Task_Id : Task_Id; Environment_Task_Id : Task_Id;
-- A variable to hold Task_Id for the environment task. -- A variable to hold Task_Id for the environment task
Unblocked_Signal_Mask : aliased sigset_t; Unblocked_Signal_Mask : aliased sigset_t;
-- The set of signals that should unblocked in all tasks -- The set of signals that should unblocked in all tasks
-- The followings are internal configuration constants needed. -- The followings are internal configuration constants needed
Time_Slice_Val : Integer; Time_Slice_Val : Integer;
pragma Import (C, Time_Slice_Val, "__gl_time_slice_val"); pragma Import (C, Time_Slice_Val, "__gl_time_slice_val");
...@@ -126,12 +126,12 @@ package body System.Task_Primitives.Operations is ...@@ -126,12 +126,12 @@ package body System.Task_Primitives.Operations is
pragma Import (C, Dispatching_Policy, "__gl_task_dispatching_policy"); pragma Import (C, Dispatching_Policy, "__gl_task_dispatching_policy");
FIFO_Within_Priorities : constant Boolean := Dispatching_Policy = 'F'; FIFO_Within_Priorities : constant Boolean := Dispatching_Policy = 'F';
-- Indicates whether FIFO_Within_Priorities is set. -- Indicates whether FIFO_Within_Priorities is set
Mutex_Protocol : Priority_Type; Mutex_Protocol : Priority_Type;
Foreign_Task_Elaborated : aliased Boolean := True; Foreign_Task_Elaborated : aliased Boolean := True;
-- Used to identified fake tasks (i.e., non-Ada Threads). -- Used to identified fake tasks (i.e., non-Ada Threads)
-------------------- --------------------
-- Local Packages -- -- Local Packages --
...@@ -145,23 +145,23 @@ package body System.Task_Primitives.Operations is ...@@ -145,23 +145,23 @@ package body System.Task_Primitives.Operations is
procedure Set (Self_Id : Task_Id); procedure Set (Self_Id : Task_Id);
pragma Inline (Set); pragma Inline (Set);
-- Set the self id for the current task. -- Set the self id for the current task
function Self return Task_Id; function Self return Task_Id;
pragma Inline (Self); pragma Inline (Self);
-- Return a pointer to the Ada Task Control Block of the calling task. -- Return a pointer to the Ada Task Control Block of the calling task
end Specific; end Specific;
package body Specific is separate; package body Specific is separate;
-- The body of this package is target specific. -- The body of this package is target specific
--------------------------------- ---------------------------------
-- Support for foreign threads -- -- Support for foreign threads --
--------------------------------- ---------------------------------
function Register_Foreign_Thread (Thread : Thread_Id) return Task_Id; function Register_Foreign_Thread (Thread : Thread_Id) return Task_Id;
-- Allocate and Initialize a new ATCB for the current Thread. -- Allocate and Initialize a new ATCB for the current Thread
function Register_Foreign_Thread function Register_Foreign_Thread
(Thread : Thread_Id) return Task_Id is separate; (Thread : Thread_Id) return Task_Id is separate;
...@@ -171,7 +171,7 @@ package body System.Task_Primitives.Operations is ...@@ -171,7 +171,7 @@ package body System.Task_Primitives.Operations is
----------------------- -----------------------
procedure Abort_Handler (signo : Signal); procedure Abort_Handler (signo : Signal);
-- Handler for the abort (SIGABRT) signal to handle asynchronous abortion. -- Handler for the abort (SIGABRT) signal to handle asynchronous abort
procedure Install_Signal_Handlers; procedure Install_Signal_Handlers;
-- Install the default signal handlers for the current task -- Install the default signal handlers for the current task
...@@ -409,7 +409,8 @@ package body System.Task_Primitives.Operations is ...@@ -409,7 +409,8 @@ package body System.Task_Primitives.Operations is
begin begin
pragma Assert (Self_ID = Self); pragma Assert (Self_ID = Self);
-- Release the mutex before sleeping. -- Release the mutex before sleeping
if Single_Lock then if Single_Lock then
Result := semGive (Single_RTS_Lock.Mutex); Result := semGive (Single_RTS_Lock.Mutex);
else else
...@@ -418,15 +419,16 @@ package body System.Task_Primitives.Operations is ...@@ -418,15 +419,16 @@ package body System.Task_Primitives.Operations is
pragma Assert (Result = 0); pragma Assert (Result = 0);
-- Perform a blocking operation to take the CV semaphore. -- Perform a blocking operation to take the CV semaphore. Note that a
-- Note that a blocking operation in VxWorks will reenable -- blocking operation in VxWorks will reenable task scheduling. When we
-- task scheduling. When we are no longer blocked and control -- are no longer blocked and control is returned, task scheduling will
-- is returned, task scheduling will again be disabled. -- again be disabled.
Result := semTake (Self_ID.Common.LL.CV, WAIT_FOREVER); Result := semTake (Self_ID.Common.LL.CV, WAIT_FOREVER);
pragma Assert (Result = 0); pragma Assert (Result = 0);
-- Take the mutex back. -- Take the mutex back
if Single_Lock then if Single_Lock then
Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER); Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER);
else else
...@@ -440,9 +442,8 @@ package body System.Task_Primitives.Operations is ...@@ -440,9 +442,8 @@ package body System.Task_Primitives.Operations is
-- Timed_Sleep -- -- Timed_Sleep --
----------------- -----------------
-- This is for use within the run-time system, so abort is -- This is for use within the run-time system, so abort is assumed to be
-- assumed to be already deferred, and the caller should be -- already deferred, and the caller should be holding its own ATCB lock.
-- holding its own ATCB lock.
procedure Timed_Sleep procedure Timed_Sleep
(Self_ID : Task_Id; (Self_ID : Task_Id;
...@@ -467,9 +468,9 @@ package body System.Task_Primitives.Operations is ...@@ -467,9 +468,9 @@ package body System.Task_Primitives.Operations is
if Mode = Relative then if Mode = Relative then
Absolute := Orig + Time; Absolute := Orig + Time;
-- Systematically add one since the first tick will delay -- Systematically add one since the first tick will delay *at most*
-- *at most* 1 / Rate_Duration seconds, so we need to add one to -- 1 / Rate_Duration seconds, so we need to add one to be on the
-- be on the safe side. -- safe side.
Ticks := To_Clock_Ticks (Time); Ticks := To_Clock_Ticks (Time);
...@@ -484,7 +485,8 @@ package body System.Task_Primitives.Operations is ...@@ -484,7 +485,8 @@ package body System.Task_Primitives.Operations is
if Ticks > 0 then if Ticks > 0 then
loop loop
-- Release the mutex before sleeping. -- Release the mutex before sleeping
if Single_Lock then if Single_Lock then
Result := semGive (Single_RTS_Lock.Mutex); Result := semGive (Single_RTS_Lock.Mutex);
else else
...@@ -493,14 +495,15 @@ package body System.Task_Primitives.Operations is ...@@ -493,14 +495,15 @@ package body System.Task_Primitives.Operations is
pragma Assert (Result = 0); pragma Assert (Result = 0);
-- Perform a blocking operation to take the CV semaphore. -- Perform a blocking operation to take the CV semaphore. Note
-- Note that a blocking operation in VxWorks will reenable -- that a blocking operation in VxWorks will reenable task
-- task scheduling. When we are no longer blocked and control -- scheduling. When we are no longer blocked and control is
-- is returned, task scheduling will again be disabled. -- returned, task scheduling will again be disabled.
Result := semTake (Self_ID.Common.LL.CV, Ticks); Result := semTake (Self_ID.Common.LL.CV, Ticks);
if Result = 0 then if Result = 0 then
-- Somebody may have called Wakeup for us -- Somebody may have called Wakeup for us
Wakeup := True; Wakeup := True;
...@@ -508,10 +511,11 @@ package body System.Task_Primitives.Operations is ...@@ -508,10 +511,11 @@ package body System.Task_Primitives.Operations is
else else
if errno /= S_objLib_OBJ_TIMEOUT then if errno /= S_objLib_OBJ_TIMEOUT then
Wakeup := True; Wakeup := True;
else else
-- If Ticks = int'last, it was most probably truncated -- If Ticks = int'last, it was most probably truncated so
-- so let's make another round after recomputing Ticks -- let's make another round after recomputing Ticks from
-- from the the absolute time. -- the the absolute time.
if Ticks /= int'Last then if Ticks /= int'Last then
Timedout := True; Timedout := True;
...@@ -525,7 +529,8 @@ package body System.Task_Primitives.Operations is ...@@ -525,7 +529,8 @@ package body System.Task_Primitives.Operations is
end if; end if;
end if; end if;
-- Take the mutex back. -- Take the mutex back
if Single_Lock then if Single_Lock then
Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER); Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER);
else else
...@@ -540,7 +545,8 @@ package body System.Task_Primitives.Operations is ...@@ -540,7 +545,8 @@ package body System.Task_Primitives.Operations is
else else
Timedout := True; Timedout := True;
-- Should never hold a lock while yielding. -- Should never hold a lock while yielding
if Single_Lock then if Single_Lock then
Result := semGive (Single_RTS_Lock.Mutex); Result := semGive (Single_RTS_Lock.Mutex);
taskDelay (0); taskDelay (0);
...@@ -558,8 +564,8 @@ package body System.Task_Primitives.Operations is ...@@ -558,8 +564,8 @@ package body System.Task_Primitives.Operations is
-- Timed_Delay -- -- Timed_Delay --
----------------- -----------------
-- This is for use in implementing delay statements, so -- This is for use in implementing delay statements, so we assume the
-- we assume the caller is holding no locks. -- caller is holding no locks.
procedure Timed_Delay procedure Timed_Delay
(Self_ID : Task_Id; (Self_ID : Task_Id;
...@@ -582,9 +588,8 @@ package body System.Task_Primitives.Operations is ...@@ -582,9 +588,8 @@ package body System.Task_Primitives.Operations is
if Ticks > 0 and then Ticks < int'Last then if Ticks > 0 and then Ticks < int'Last then
-- The first tick will delay anytime between 0 and -- First tick will delay anytime between 0 and 1 / sysClkRateGet
-- 1 / sysClkRateGet seconds, so we need to add one to -- seconds, so we need to add one to be on the safe side.
-- be on the safe side.
Ticks := Ticks + 1; Ticks := Ticks + 1;
end if; end if;
...@@ -595,7 +600,9 @@ package body System.Task_Primitives.Operations is ...@@ -595,7 +600,9 @@ package body System.Task_Primitives.Operations is
end if; end if;
if Ticks > 0 then if Ticks > 0 then
-- Modifying State and Pending_Priority_Change, locking the TCB.
-- Modifying State and Pending_Priority_Change, locking the TCB
if Single_Lock then if Single_Lock then
Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER); Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER);
else else
...@@ -630,6 +637,7 @@ package body System.Task_Primitives.Operations is ...@@ -630,6 +637,7 @@ package body System.Task_Primitives.Operations is
Result := semTake (Self_ID.Common.LL.CV, Ticks); Result := semTake (Self_ID.Common.LL.CV, Ticks);
if Result /= 0 then if Result /= 0 then
-- If Ticks = int'last, it was most probably truncated -- If Ticks = int'last, it was most probably truncated
-- so let's make another round after recomputing Ticks -- so let's make another round after recomputing Ticks
-- from the the absolute time. -- from the the absolute time.
...@@ -749,6 +757,7 @@ package body System.Task_Primitives.Operations is ...@@ -749,6 +757,7 @@ package body System.Task_Primitives.Operations is
if FIFO_Within_Priorities then if FIFO_Within_Priorities then
-- Annex D requirement [RM D.2.2 par. 9]: -- Annex D requirement [RM D.2.2 par. 9]:
-- If the task drops its priority due to the loss of inherited -- If the task drops its priority due to the loss of inherited
-- priority, it is added at the head of the ready queue for its -- priority, it is added at the head of the ready queue for its
-- new active priority. -- new active priority.
...@@ -794,7 +803,7 @@ package body System.Task_Primitives.Operations is ...@@ -794,7 +803,7 @@ package body System.Task_Primitives.Operations is
procedure Enter_Task (Self_ID : Task_Id) is procedure Enter_Task (Self_ID : Task_Id) is
procedure Init_Float; procedure Init_Float;
pragma Import (C, Init_Float, "__gnat_init_float"); pragma Import (C, Init_Float, "__gnat_init_float");
-- Properly initializes the FPU for PPC/MIPS systems. -- Properly initializes the FPU for PPC/MIPS systems
begin begin
Self_ID.Common.LL.Thread := taskIdSelf; Self_ID.Common.LL.Thread := taskIdSelf;
...@@ -802,7 +811,8 @@ package body System.Task_Primitives.Operations is ...@@ -802,7 +811,8 @@ package body System.Task_Primitives.Operations is
Init_Float; Init_Float;
-- Install the signal handlers. -- Install the signal handlers
-- This is called for each task since there is no signal inheritance -- This is called for each task since there is no signal inheritance
-- between VxWorks tasks. -- between VxWorks tasks.
...@@ -892,28 +902,26 @@ package body System.Task_Primitives.Operations is ...@@ -892,28 +902,26 @@ package body System.Task_Primitives.Operations is
Adjusted_Stack_Size := size_t (Stack_Size); Adjusted_Stack_Size := size_t (Stack_Size);
end if; end if;
-- Ask for 4 extra bytes of stack space so that the ATCB -- Ask for four extra bytes of stack space so that the ATCB pointer can
-- pointer can be stored below the stack limit, plus extra -- be stored below the stack limit, plus extra space for the frame of
-- space for the frame of Task_Wrapper. This is so the user -- Task_Wrapper. This is so the user gets the amount of stack requested
-- gets the amount of stack requested exclusive of the needs -- exclusive of the needs
-- of the runtime.
-- --
-- We also have to allocate n more bytes for the task name -- We also have to allocate n more bytes for the task name storage and
-- storage and enough space for the Wind Task Control Block -- enough space for the Wind Task Control Block which is around 0x778
-- which is around 0x778 bytes. VxWorks also seems to carve out -- bytes. VxWorks also seems to carve out additional space, so use 2048
-- additional space, so use 2048 as a nice round number. -- as a nice round number. We might want to increment to the nearest
-- We might want to increment to the nearest page size in -- page size in case we ever support VxVMI.
-- case we ever support VxVMI.
-- --
-- XXX - we should come back and visit this so we can -- XXX - we should come back and visit this so we can set the task name
-- set the task name to something appropriate. -- to something appropriate.
Adjusted_Stack_Size := Adjusted_Stack_Size + 2048; Adjusted_Stack_Size := Adjusted_Stack_Size + 2048;
-- Since the initial signal mask of a thread is inherited from the -- Since the initial signal mask of a thread is inherited from the
-- creator, and the Environment task has all its signals masked, we -- creator, and the Environment task has all its signals masked, we do
-- do not need to manipulate caller's signal mask at this point. -- not need to manipulate caller's signal mask at this point. All tasks
-- All tasks in RTS will have All_Tasks_Mask initially. -- in RTS will have All_Tasks_Mask initially.
if T.Common.Task_Image_Len = 0 then if T.Common.Task_Image_Len = 0 then
T.Common.LL.Thread := taskSpawn T.Common.LL.Thread := taskSpawn
...@@ -926,6 +934,7 @@ package body System.Task_Primitives.Operations is ...@@ -926,6 +934,7 @@ package body System.Task_Primitives.Operations is
else else
declare declare
Name : aliased String (1 .. T.Common.Task_Image_Len + 1); Name : aliased String (1 .. T.Common.Task_Image_Len + 1);
begin begin
Name (1 .. Name'Last - 1) := Name (1 .. Name'Last - 1) :=
T.Common.Task_Image (1 .. T.Common.Task_Image_Len); T.Common.Task_Image (1 .. T.Common.Task_Image_Len);
...@@ -1004,7 +1013,7 @@ package body System.Task_Primitives.Operations is ...@@ -1004,7 +1013,7 @@ package body System.Task_Primitives.Operations is
begin begin
Result := kill (T.Common.LL.Thread, Result := kill (T.Common.LL.Thread,
Signal (Interrupt_Management.Abort_Task_Signal)); Signal (Interrupt_Management.Abort_Task_Signal));
pragma Assert (Result = 0); pragma Assert (Result = 0);
end Abort_Task; end Abort_Task;
...@@ -1127,7 +1136,7 @@ package body System.Task_Primitives.Operations is ...@@ -1127,7 +1136,7 @@ package body System.Task_Primitives.Operations is
Environment_Task_Id := Environment_Task; Environment_Task_Id := Environment_Task;
-- Initialize the lock used to synchronize chain of all ATCBs. -- Initialize the lock used to synchronize chain of all ATCBs
Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level); Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level);
......
...@@ -82,23 +82,21 @@ package System.Task_Primitives.Operations is ...@@ -82,23 +82,21 @@ package System.Task_Primitives.Operations is
procedure Enter_Task (Self_ID : ST.Task_Id); procedure Enter_Task (Self_ID : ST.Task_Id);
pragma Inline (Enter_Task); pragma Inline (Enter_Task);
-- Initialize data structures specific to the calling task. -- Initialize data structures specific to the calling task. Self must be
-- Self must be the ID of the calling task. -- the ID of the calling task. It must be called (once) by the task
-- It must be called (once) by the task immediately after creation, -- immediately after creation, while abort is still deferred. The effects
-- while abortion is still deferred. -- of other operations defined below are not defined unless the caller has
-- The effects of other operations defined below are not defined -- previously called Initialize_Task.
-- unless the caller has previously called Initialize_Task.
procedure Exit_Task; procedure Exit_Task;
pragma Inline (Exit_Task); pragma Inline (Exit_Task);
-- Destroy the thread of control. -- Destroy the thread of control. Self must be the ID of the calling task.
-- Self must be the ID of the calling task. -- The effects of further calls to operations defined below on the task
-- The effects of further calls to operations defined below -- are undefined thereafter.
-- on the task are undefined thereafter.
function New_ATCB (Entry_Num : ST.Task_Entry_Index) return ST.Task_Id; function New_ATCB (Entry_Num : ST.Task_Entry_Index) return ST.Task_Id;
pragma Inline (New_ATCB); pragma Inline (New_ATCB);
-- Allocate a new ATCB with the specified number of entries. -- Allocate a new ATCB with the specified number of entries
procedure Initialize_TCB (Self_ID : ST.Task_Id; Succeeded : out Boolean); procedure Initialize_TCB (Self_ID : ST.Task_Id; Succeeded : out Boolean);
pragma Inline (Initialize_TCB); pragma Inline (Initialize_TCB);
...@@ -106,19 +104,17 @@ package System.Task_Primitives.Operations is ...@@ -106,19 +104,17 @@ package System.Task_Primitives.Operations is
procedure Finalize_TCB (T : ST.Task_Id); procedure Finalize_TCB (T : ST.Task_Id);
pragma Inline (Finalize_TCB); pragma Inline (Finalize_TCB);
-- Finalizes Private_Data of ATCB, and then deallocates it. -- Finalizes Private_Data of ATCB, and then deallocates it. This is also
-- This is also responsible for recovering any storage or other resources -- responsible for recovering any storage or other resources that were
-- that were allocated by Create_Task (the one in this package). -- allocated by Create_Task (the one in this package). This should only be
-- This should only be called from Free_Task. -- called from Free_Task. After it is called there should be no further
-- After it is called there should be no further
-- reference to the ATCB that corresponds to T. -- reference to the ATCB that corresponds to T.
procedure Abort_Task (T : ST.Task_Id); procedure Abort_Task (T : ST.Task_Id);
pragma Inline (Abort_Task); pragma Inline (Abort_Task);
-- Abort the task specified by T (the target task). This causes -- Abort the task specified by T (the target task). This causes the target
-- the target task to asynchronously raise Abort_Signal if -- task to asynchronously raise Abort_Signal if abort is not deferred, or
-- abort is not deferred, or if it is blocked on an interruptible -- if it is blocked on an interruptible system call.
-- system call.
-- --
-- precondition: -- precondition:
-- the calling task is holding T's lock and has abort deferred -- the calling task is holding T's lock and has abort deferred
...@@ -130,7 +126,7 @@ package System.Task_Primitives.Operations is ...@@ -130,7 +126,7 @@ package System.Task_Primitives.Operations is
function Self return ST.Task_Id; function Self return ST.Task_Id;
pragma Inline (Self); pragma Inline (Self);
-- Return a pointer to the Ada Task Control Block of the calling task. -- Return a pointer to the Ada Task Control Block of the calling task
type Lock_Level is type Lock_Level is
(PO_Level, (PO_Level,
...@@ -138,27 +134,27 @@ package System.Task_Primitives.Operations is ...@@ -138,27 +134,27 @@ package System.Task_Primitives.Operations is
RTS_Lock_Level, RTS_Lock_Level,
ATCB_Level); ATCB_Level);
-- Type used to describe kind of lock for second form of Initialize_Lock -- Type used to describe kind of lock for second form of Initialize_Lock
-- call specified below. -- call specified below. See locking rules in System.Tasking (spec) for
-- See locking rules in System.Tasking (spec) for more details. -- more details.
procedure Initialize_Lock (Prio : System.Any_Priority; L : access Lock); procedure Initialize_Lock (Prio : System.Any_Priority; L : access Lock);
procedure Initialize_Lock (L : access RTS_Lock; Level : Lock_Level); procedure Initialize_Lock (L : access RTS_Lock; Level : Lock_Level);
pragma Inline (Initialize_Lock); pragma Inline (Initialize_Lock);
-- Initialize a lock object. -- Initialize a lock object.
-- --
-- For Lock, Prio is the ceiling priority associated with the lock. -- For Lock, Prio is the ceiling priority associated with the lock. For
-- For RTS_Lock, the ceiling is implicitly Priority'Last. -- RTS_Lock, the ceiling is implicitly Priority'Last.
-- --
-- If the underlying system does not support priority ceiling -- If the underlying system does not support priority ceiling
-- locking, the Prio parameter is ignored. -- locking, the Prio parameter is ignored.
-- --
-- The effect of either initialize operation is undefined unless L -- The effect of either initialize operation is undefined unless is a lock
-- is a lock object that has not been initialized, or which has been -- object that has not been initialized, or which has been finalized since
-- finalized since it was last initialized. -- it was last initialized.
-- --
-- The effects of the other operations on lock objects -- The effects of the other operations on lock objects are undefined
-- are undefined unless the lock object has been initialized -- unless the lock object has been initialized and has not since been
-- and has not since been finalized. -- finalized.
-- --
-- Initialization of the per-task lock is implicit in Create_Task. -- Initialization of the per-task lock is implicit in Create_Task.
-- --
...@@ -230,89 +226,82 @@ package System.Task_Primitives.Operations is ...@@ -230,89 +226,82 @@ package System.Task_Primitives.Operations is
-- read or write permission. (That is, matching pairs of Lock and Unlock -- read or write permission. (That is, matching pairs of Lock and Unlock
-- operations on each lock object must be properly nested.) -- operations on each lock object must be properly nested.)
-- For the operation on RTS_Lock, Global_Lock should be set to True -- For the operation on RTS_Lock, Global_Lock should be set to True if L
-- if L is a global lock (Single_RTS_Lock, Global_Task_Lock). -- is a global lock (Single_RTS_Lock, Global_Task_Lock).
-- --
-- Note that Write_Lock for RTS_Lock does not have an out-parameter. -- Note that Write_Lock for RTS_Lock does not have an out-parameter.
-- RTS_Locks are used in situations where we have not made provision -- RTS_Locks are used in situations where we have not made provision for
-- for recovery from ceiling violations. We do not expect them to -- recovery from ceiling violations. We do not expect them to occur inside
-- occur inside the runtime system, because all RTS locks have ceiling -- the runtime system, because all RTS locks have ceiling Priority'Last.
-- Priority'Last.
-- There is one way there can be a ceiling violation. That is if the
-- There is one way there can be a ceiling violation. -- runtime system is called from a task that is executing in the
-- That is if the runtime system is called from a task that is -- Interrupt_Priority range.
-- executing in the Interrupt_Priority range.
-- It is not clear what to do about ceiling violations due to RTS calls
-- It is not clear what to do about ceiling violations due -- done at interrupt priority. In general, it is not acceptable to give
-- to RTS calls done at interrupt priority. In general, it -- all RTS locks interrupt priority, since that whould give terrible
-- is not acceptable to give all RTS locks interrupt priority, -- performance on systems where this has the effect of masking hardware
-- since that whould give terrible performance on systems where -- interrupts, though we could get away with allowing
-- this has the effect of masking hardware interrupts, though we -- Interrupt_Priority'last where we are layered on an OS that does not
-- could get away with allowing Interrupt_Priority'last where we -- allow us to mask interrupts. Ideally, we would like to raise
-- are layered on an OS that does not allow us to mask interrupts. -- Program_Error back at the original point of the RTS call, but this
-- Ideally, we would like to raise Program_Error back at the -- would require a lot of detailed analysis and recoding, with almost
-- original point of the RTS call, but this would require a lot of -- certain performance penalties.
-- detailed analysis and recoding, with almost certain performance
-- penalties. -- For POSIX systems, we considered just skipping setting priority ceiling
-- on RTS locks. This would mean there is no ceiling violation, but we
-- For POSIX systems, we considered just skipping setting a -- would end up with priority inversions inside the runtime system,
-- priority ceiling on RTS locks. This would mean there is no -- resulting in failure to satisfy the Ada priority rules, and possible
-- ceiling violation, but we would end up with priority inversions -- missed validation tests. This could be compensated-for by explicit
-- inside the runtime system, resulting in failure to satisfy the -- priority-change calls to raise the caller to Priority'Last whenever it
-- Ada priority rules, and possible missed validation tests. -- first enters the runtime system, but the expected overhead seems high,
-- This could be compensated-for by explicit priority-change calls -- though it might be lower than using locks with ceilings if the
-- to raise the caller to Priority'Last whenever it first enters -- underlying implementation of ceiling locks is an inefficient one.
-- the runtime system, but the expected overhead seems high, though
-- it might be lower than using locks with ceilings if the underlying -- This issue should be reconsidered whenever we get around to checking
-- implementation of ceiling locks is an inefficient one. -- for calls to potentially blocking operations from within protected
-- operations. If we check for such calls and catch them on entry to the
-- This issue should be reconsidered whenever we get around to -- OS, it may be that we can eliminate the possibility of ceiling
-- checking for calls to potentially blocking operations from -- violations inside the RTS. For this to work, we would have to forbid
-- within protected operations. If we check for such calls and -- explicitly setting the priority of a task to anything in the
-- catch them on entry to the OS, it may be that we can eliminate -- Interrupt_Priority range, at least. We would also have to check that
-- the possibility of ceiling violations inside the RTS. For this -- there are no RTS-lock operations done inside any operations that are
-- to work, we would have to forbid explicitly setting the priority -- not treated as potentially blocking.
-- of a task to anything in the Interrupt_Priority range, at least.
-- We would also have to check that there are no RTS-lock operations -- The latter approach seems to be the best, i.e. to check on entry to RTS
-- done inside any operations that are not treated as potentially -- calls that may need to use locks that the priority is not in the
-- blocking. -- interrupt range. If there are RTS operations that NEED to be called
-- from interrupt handlers, those few RTS locks should then be converted
-- The latter approach seems to be the best, i.e. to check on entry -- to PO-type locks, with ceiling Interrupt_Priority'Last.
-- to RTS calls that may need to use locks that the priority is not
-- in the interrupt range. If there are RTS operations that NEED to -- For now, we will just shut down the system if there is ceiling violation
-- be called from interrupt handlers, those few RTS locks should then
-- be converted to PO-type locks, with ceiling Interrupt_Priority'Last.
-- For now, we will just shut down the system if there is a
-- ceiling violation.
procedure Yield (Do_Yield : Boolean := True); procedure Yield (Do_Yield : Boolean := True);
pragma Inline (Yield); pragma Inline (Yield);
-- Yield the processor. Add the calling task to the tail of the -- Yield the processor. Add the calling task to the tail of the ready
-- ready queue for its active_priority. -- queue for its active_priority. The Do_Yield argument is only used in
-- The Do_Yield argument is only used in some very rare cases very -- some very rare cases very a yield should have an effect on a specific
-- a yield should have an effect on a specific target and not on regular -- target and not on regular ones.
-- ones.
procedure Set_Priority procedure Set_Priority
(T : ST.Task_Id; (T : ST.Task_Id;
Prio : System.Any_Priority; Prio : System.Any_Priority;
Loss_Of_Inheritance : Boolean := False); Loss_Of_Inheritance : Boolean := False);
pragma Inline (Set_Priority); pragma Inline (Set_Priority);
-- Set the priority of the task specified by T to T.Current_Priority. -- Set the priority of the task specified by T to T.Current_Priority. The
-- The priority set is what would correspond to the Ada concept of -- priority set is what would correspond to the Ada concept of "base
-- "base priority" in the terms of the lower layer system, but -- priority" in the terms of the lower layer system, but the operation may
-- the operation may be used by the upper layer to implement -- be used by the upper layer to implement changes in "active priority"
-- changes in "active priority" that are not due to lock effects. -- that are not due to lock effects. The effect should be consistent with
-- The effect should be consistent with the Ada Reference Manual. -- the Ada Reference Manual. In particular, when a task lowers its
-- In particular, when a task lowers its priority due to the loss of -- priority due to the loss of inherited priority, it goes at the head of
-- inherited priority, it goes at the head of the queue for its new -- the queue for its new priority (RM D.2.2 par 9). Loss_Of_Inheritance
-- priority (RM D.2.2 par 9). Loss_Of_Inheritance helps the underlying -- helps the underlying implementation to do it right when the OS doesn't.
-- implementation to do it right when the OS doesn't.
function Get_Priority (T : ST.Task_Id) return System.Any_Priority; function Get_Priority (T : ST.Task_Id) return System.Any_Priority;
pragma Inline (Get_Priority); pragma Inline (Get_Priority);
-- Returns the priority last set by Set_Priority for this task. -- Returns the priority last set by Set_Priority for this task
function Monotonic_Clock return Duration; function Monotonic_Clock return Duration;
pragma Inline (Monotonic_Clock); pragma Inline (Monotonic_Clock);
...@@ -343,17 +332,16 @@ package System.Task_Primitives.Operations is ...@@ -343,17 +332,16 @@ package System.Task_Primitives.Operations is
-- and has abort deferred -- and has abort deferred
-- --
-- postcondition: -- postcondition:
-- The calling task is holding its own ATCB lock -- The calling task is holding its own ATCB lock and has abort deferred.
-- and has abort deferred.
-- The effect is to atomically unlock T's lock and wait, so that another -- The effect is to atomically unlock T's lock and wait, so that another
-- task that is able to lock T's lock can be assured that the wait has -- task that is able to lock T's lock can be assured that the wait has
-- actually commenced, and that a Wakeup operation will cause the waiting -- actually commenced, and that a Wakeup operation will cause the waiting
-- task to become ready for execution once again. When Sleep returns, -- task to become ready for execution once again. When Sleep returns, the
-- the waiting task will again hold its own ATCB lock. The waiting task -- waiting task will again hold its own ATCB lock. The waiting task may
-- may become ready for execution at any time (that is, spurious wakeups -- become ready for execution at any time (that is, spurious wakeups are
-- are permitted), but it will definitely become ready for execution when -- permitted), but it will definitely become ready for execution when a
-- a Wakeup operation is performed for the same task. -- Wakeup operation is performed for the same task.
procedure Timed_Sleep procedure Timed_Sleep
(Self_ID : ST.Task_Id; (Self_ID : ST.Task_Id;
...@@ -399,21 +387,20 @@ package System.Task_Primitives.Operations is ...@@ -399,21 +387,20 @@ package System.Task_Primitives.Operations is
-- RTS Entrance/Exit -- -- RTS Entrance/Exit --
----------------------- -----------------------
-- Following two routines are used for possible operations needed -- Following two routines are used for possible operations needed to be
-- to be setup/cleared upon entrance/exit of RTS while maintaining -- setup/cleared upon entrance/exit of RTS while maintaining a single
-- a single thread of control in the RTS. Since we intend these -- thread of control in the RTS. Since we intend these routines to be used
-- routines to be used for implementing the Single_Lock RTS, -- for implementing the Single_Lock RTS, Lock_RTS should follow the first
-- Lock_RTS should follow the first Defer_Abortion operation -- Defer_Abortion operation entering RTS. In the same fashion Unlock_RTS
-- entering RTS. In the same fashion Unlock_RTS should preceed -- should preceed the last Undefer_Abortion exiting RTS.
-- the last Undefer_Abortion exiting RTS.
-- --
-- These routines also replace the functions Lock/Unlock_All_Tasks_List -- These routines also replace the functions Lock/Unlock_All_Tasks_List
procedure Lock_RTS; procedure Lock_RTS;
-- Take the global RTS lock. -- Take the global RTS lock
procedure Unlock_RTS; procedure Unlock_RTS;
-- Release the global RTS lock. -- Release the global RTS lock
-------------------- --------------------
-- Stack Checking -- -- Stack Checking --
...@@ -424,30 +411,29 @@ package System.Task_Primitives.Operations is ...@@ -424,30 +411,29 @@ package System.Task_Primitives.Operations is
-- an insufficient amount of stack space remains in the current task. -- an insufficient amount of stack space remains in the current task.
-- The exact mechanism for a stack probe is target dependent. Typical -- The exact mechanism for a stack probe is target dependent. Typical
-- possibilities are to use a load from a non-existent page, a store -- possibilities are to use a load from a non-existent page, a store to a
-- to a read-only page, or a comparison with some stack limit constant. -- read-only page, or a comparison with some stack limit constant. Where
-- Where possible we prefer to use a trap on a bad page access, since -- possible we prefer to use a trap on a bad page access, since this has
-- this has less overhead. The generation of stack probes is either -- less overhead. The generation of stack probes is either automatic if
-- automatic if the ABI requires it (as on for example DEC Unix), or -- the ABI requires it (as on for example DEC Unix), or is controlled by
-- is controlled by the gcc parameter -fstack-check. -- the gcc parameter -fstack-check.
-- When we are using bad-page accesses, we need a bad page, called a -- When we are using bad-page accesses, we need a bad page, called guard
-- guard page, at the end of each task stack. On some systems, this -- page, at the end of each task stack. On some systems, this is provided
-- is provided automatically, but on other systems, we need to create -- automatically, but on other systems, we need to create the guard page
-- the guard page ourselves, and the procedure Stack_Guard is provided -- ourselves, and the procedure Stack_Guard is provided for this purpose.
-- for this purpose.
procedure Stack_Guard (T : ST.Task_Id; On : Boolean); procedure Stack_Guard (T : ST.Task_Id; On : Boolean);
-- Ensure guard page is set if one is needed and the underlying thread -- Ensure guard page is set if one is needed and the underlying thread
-- system does not provide it. The procedure is as follows: -- system does not provide it. The procedure is as follows:
-- --
-- 1. When we create a task adjust its size so a guard page can -- 1. When we create a task adjust its size so a guard page can
-- safely be set at the bottom of the stack -- safely be set at the bottom of the stack.
-- --
-- 2. When the thread is created (and its stack allocated by the -- 2. When the thread is created (and its stack allocated by the
-- underlying thread system), get the stack base (and size, depending -- underlying thread system), get the stack base (and size, depending
-- how the stack is growing), and create the guard page taking care of -- how the stack is growing), and create the guard page taking care
-- page boundaries issues. -- of page boundaries issues.
-- --
-- 3. When the task is destroyed, remove the guard page. -- 3. When the task is destroyed, remove the guard page.
-- --
...@@ -467,11 +453,11 @@ package System.Task_Primitives.Operations is ...@@ -467,11 +453,11 @@ package System.Task_Primitives.Operations is
function Check_Exit (Self_ID : ST.Task_Id) return Boolean; function Check_Exit (Self_ID : ST.Task_Id) return Boolean;
pragma Inline (Check_Exit); pragma Inline (Check_Exit);
-- Check that the current task is holding only Global_Task_Lock. -- Check that the current task is holding only Global_Task_Lock
function Check_No_Locks (Self_ID : ST.Task_Id) return Boolean; function Check_No_Locks (Self_ID : ST.Task_Id) return Boolean;
pragma Inline (Check_No_Locks); pragma Inline (Check_No_Locks);
-- Check that current task is holding no locks. -- Check that current task is holding no locks
function Suspend_Task function Suspend_Task
(T : ST.Task_Id; (T : ST.Task_Id;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -41,30 +41,30 @@ pragma Polling (Off); ...@@ -41,30 +41,30 @@ pragma Polling (Off);
-- to poll it can cause infinite loops. -- to poll it can cause infinite loops.
with Ada.Exceptions; with Ada.Exceptions;
-- used for Exception_Occurrence_Access. -- Used for Exception_Occurrence_Access
with System.Tasking; with System.Tasking;
pragma Elaborate_All (System.Tasking); pragma Elaborate_All (System.Tasking);
-- ensure that the first step initializations have been performed -- Ensure that the first step initializations have been performed
with System.Task_Primitives; with System.Task_Primitives;
-- used for Lock -- Used for Lock
with System.Task_Primitives.Operations; with System.Task_Primitives.Operations;
-- used for Set_Priority -- Used for Set_Priority
-- Write_Lock -- Write_Lock
-- Unlock -- Unlock
-- Initialize_Lock -- Initialize_Lock
with System.Soft_Links; with System.Soft_Links;
-- used for the non-tasking routines (*_NT) that refer to global data. -- Used for the non-tasking routines (*_NT) that refer to global data.
-- They are needed here before the tasking run time has been elaborated. -- They are needed here before the tasking run time has been elaborated.
with System.Soft_Links.Tasking; with System.Soft_Links.Tasking;
-- Used for Init_Tasking_Soft_Links -- Used for Init_Tasking_Soft_Links
with System.Tasking.Debug; with System.Tasking.Debug;
-- used for Trace -- Used for Trace
with System.Stack_Checking; with System.Stack_Checking;
...@@ -88,7 +88,7 @@ package body System.Tasking.Initialization is ...@@ -88,7 +88,7 @@ package body System.Tasking.Initialization is
function Current_Target_Exception return AE.Exception_Occurrence; function Current_Target_Exception return AE.Exception_Occurrence;
pragma Import pragma Import
(Ada, Current_Target_Exception, "__gnat_current_target_exception"); (Ada, Current_Target_Exception, "__gnat_current_target_exception");
-- Import this subprogram from the private part of Ada.Exceptions. -- Import this subprogram from the private part of Ada.Exceptions
---------------------------------------------------------------------- ----------------------------------------------------------------------
-- Tasking versions of some services needed by non-tasking programs -- -- Tasking versions of some services needed by non-tasking programs --
...@@ -150,7 +150,7 @@ package body System.Tasking.Initialization is ...@@ -150,7 +150,7 @@ package body System.Tasking.Initialization is
-- Change_Base_Priority -- -- Change_Base_Priority --
-------------------------- --------------------------
-- Call only with abort deferred and holding Self_ID locked. -- Call only with abort deferred and holding Self_ID locked
procedure Change_Base_Priority (T : Task_Id) is procedure Change_Base_Priority (T : Task_Id) is
begin begin
...@@ -269,7 +269,7 @@ package body System.Tasking.Initialization is ...@@ -269,7 +269,7 @@ package body System.Tasking.Initialization is
-- while we had abort deferred below. -- while we had abort deferred below.
loop loop
-- Temporarily defer abortion so that we can lock Self_ID. -- Temporarily defer abort so that we can lock Self_ID
Self_ID.Deferral_Level := Self_ID.Deferral_Level + 1; Self_ID.Deferral_Level := Self_ID.Deferral_Level + 1;
...@@ -286,7 +286,7 @@ package body System.Tasking.Initialization is ...@@ -286,7 +286,7 @@ package body System.Tasking.Initialization is
Unlock_RTS; Unlock_RTS;
end if; end if;
-- Restore the original Deferral value. -- Restore the original Deferral value
Self_ID.Deferral_Level := Self_ID.Deferral_Level - 1; Self_ID.Deferral_Level := Self_ID.Deferral_Level - 1;
...@@ -401,11 +401,11 @@ package body System.Tasking.Initialization is ...@@ -401,11 +401,11 @@ package body System.Tasking.Initialization is
SSL.Tasking.Init_Tasking_Soft_Links; SSL.Tasking.Init_Tasking_Soft_Links;
-- Install tasking locks in the GCC runtime. -- Install tasking locks in the GCC runtime
Gnat_Install_Locks (Task_Lock'Access, Task_Unlock'Access); Gnat_Install_Locks (Task_Lock'Access, Task_Unlock'Access);
-- Abortion is deferred in a new ATCB, so we need to undefer abortion -- Abort is deferred in a new ATCB, so we need to undefer abort
-- at this stage to make the environment task abortable. -- at this stage to make the environment task abortable.
Undefer_Abort (Environment_Task); Undefer_Abort (Environment_Task);
...@@ -426,15 +426,16 @@ package body System.Tasking.Initialization is ...@@ -426,15 +426,16 @@ package body System.Tasking.Initialization is
-- hurt to uncomment the above call, until the error is corrected for -- hurt to uncomment the above call, until the error is corrected for
-- all targets. -- all targets.
-- See extended comments in package body System.Tasking.Abortion -- See extended comments in package body System.Tasking.Abort for the
-- for the overall design of the implementation of task abort. -- overall design of the implementation of task abort.
-- ??? there is no such package ???
-- If the task is sleeping it will be in an abort-deferred region, -- If the task is sleeping it will be in an abort-deferred region, and
-- and will not have Abort_Signal raised by Abort_Task. -- will not have Abort_Signal raised by Abort_Task. Such an "abort
-- Such an "abort deferral" is just to protect the RTS internals, -- deferral" is just to protect the RTS internals, and not necessarily
-- and not necessarily required to enforce Ada semantics. -- required to enforce Ada semantics. Abort_Task should wake the task up
-- Abort_Task should wake the task up and let it decide if it wants -- and let it decide if it wants to complete the aborted construct
-- to complete the aborted construct immediately. -- immediately.
-- Note that the effect of the lowl-level Abort_Task is not persistent. -- Note that the effect of the lowl-level Abort_Task is not persistent.
-- If the target task is not blocked, this wakeup will be missed. -- If the target task is not blocked, this wakeup will be missed.
...@@ -452,14 +453,13 @@ package body System.Tasking.Initialization is ...@@ -452,14 +453,13 @@ package body System.Tasking.Initialization is
-- implement delays). That still left the possibility of missed -- implement delays). That still left the possibility of missed
-- wakeups. -- wakeups.
-- We cannot safely call Vulnerable_Complete_Activation here, -- We cannot safely call Vulnerable_Complete_Activation here, since that
-- since that requires locking Self_ID.Parent. The anti-deadlock -- requires locking Self_ID.Parent. The anti-deadlock lock ordering rules
-- lock ordering rules would then require us to release the lock -- would then require us to release the lock on Self_ID first, which would
-- on Self_ID first, which would create a timing window for other -- create a timing window for other tasks to lock Self_ID. This is
-- tasks to lock Self_ID. This is significant for tasks that may be -- significant for tasks that may be aborted before their execution can
-- aborted before their execution can enter the task body, and so -- enter the task body, and so they do not get a chance to call
-- they do not get a chance to call Complete_Task. The actual work -- Complete_Task. The actual work for this case is done in Terminate_Task.
-- for this case is done in Terminate_Task.
procedure Locked_Abort_To_Level procedure Locked_Abort_To_Level
(Self_ID : Task_Id; (Self_ID : Task_Id;
...@@ -694,12 +694,12 @@ package body System.Tasking.Initialization is ...@@ -694,12 +694,12 @@ package body System.Tasking.Initialization is
-- Precondition : Self does not hold any locks! -- Precondition : Self does not hold any locks!
-- Undefer_Abort is called on any abortion completion point (aka. -- Undefer_Abort is called on any abort completion point (aka.
-- synchronization point). It performs the following actions if they -- synchronization point). It performs the following actions if they
-- are pending: (1) change the base priority, (2) abort the task. -- are pending: (1) change the base priority, (2) abort the task.
-- The priority change has to occur before abortion. Otherwise, it would -- The priority change has to occur before abort. Otherwise, it would
-- take effect no earlier than the next abortion completion point. -- take effect no earlier than the next abort completion point.
procedure Undefer_Abort (Self_ID : Task_Id) is procedure Undefer_Abort (Self_ID : Task_Id) is
begin begin
...@@ -761,8 +761,8 @@ package body System.Tasking.Initialization is ...@@ -761,8 +761,8 @@ package body System.Tasking.Initialization is
-- Undefer_Abortion -- -- Undefer_Abortion --
---------------------- ----------------------
-- Phase out RTS-internal use of Undefer_Abortion -- Phase out RTS-internal use of Undefer_Abortion to reduce overhead due
-- to reduce overhead due to multiple calls to Self. -- to multiple calls to Self.
procedure Undefer_Abortion is procedure Undefer_Abortion is
Self_ID : Task_Id; Self_ID : Task_Id;
...@@ -806,7 +806,7 @@ package body System.Tasking.Initialization is ...@@ -806,7 +806,7 @@ package body System.Tasking.Initialization is
-- Update_Exception -- -- Update_Exception --
---------------------- ----------------------
-- Call only when holding no locks. -- Call only when holding no locks
procedure Update_Exception procedure Update_Exception
(X : AE.Exception_Occurrence := Current_Target_Exception) (X : AE.Exception_Occurrence := Current_Target_Exception)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
package System.Tasking.Initialization is package System.Tasking.Initialization is
procedure Remove_From_All_Tasks_List (T : Task_Id); procedure Remove_From_All_Tasks_List (T : Task_Id);
-- Remove T from All_Tasks_List. -- Remove T from All_Tasks_List. Call this function with RTS_Lock taken
-- Call this function with RTS_Lock taken.
--------------------------------- ---------------------------------
-- Tasking-Specific Soft Links -- -- Tasking-Specific Soft Links --
...@@ -47,7 +46,8 @@ package System.Tasking.Initialization is ...@@ -47,7 +46,8 @@ package System.Tasking.Initialization is
-- These permit us to leave out certain portions of the tasking -- These permit us to leave out certain portions of the tasking
-- run-time system if they are not used. They are only used internally -- run-time system if they are not used. They are only used internally
-- by the tasking run-time system. -- by the tasking run-time system.
-- So far, the only example is support for Ada.Task_Attributes.
-- So far, the only example is support for Ada.Task_Attributes
type Proc_T is access procedure (T : Task_Id); type Proc_T is access procedure (T : Task_Id);
...@@ -55,10 +55,10 @@ package System.Tasking.Initialization is ...@@ -55,10 +55,10 @@ package System.Tasking.Initialization is
procedure Initialize_Attributes (T : Task_Id); procedure Initialize_Attributes (T : Task_Id);
Finalize_Attributes_Link : Proc_T := Finalize_Attributes'Access; Finalize_Attributes_Link : Proc_T := Finalize_Attributes'Access;
-- should be called with abortion deferred and T.L write-locked -- should be called with abort deferred and T.L write-locked
Initialize_Attributes_Link : Proc_T := Initialize_Attributes'Access; Initialize_Attributes_Link : Proc_T := Initialize_Attributes'Access;
-- should be called with abortion deferred, but holding no locks -- should be called with abort deferred, but holding no locks
------------------------- -------------------------
-- Abort Defer/Undefer -- -- Abort Defer/Undefer --
...@@ -68,43 +68,41 @@ package System.Tasking.Initialization is ...@@ -68,43 +68,41 @@ package System.Tasking.Initialization is
-- in the calling task until a matching Undefer_Abort call is executed. -- in the calling task until a matching Undefer_Abort call is executed.
-- Undefer_Abort DOES MORE than just undo the effects of one call to -- Undefer_Abort DOES MORE than just undo the effects of one call to
-- Defer_Abort. It is the universal "polling point" for deferred -- Defer_Abort. It is the universal "polling point" for deferred
-- processing, including the following: -- processing, including the following:
-- 1) base priority changes -- 1) base priority changes
-- 2) abort/ATC -- 2) abort/ATC
-- Abort deferral MAY be nested (Self_ID.Deferral_Level is a count), -- Abort deferral MAY be nested (Self_ID.Deferral_Level is a count), but
-- but to avoid waste and undetected errors, it generally SHOULD NOT -- to avoid waste and undetected errors, it generally SHOULD NOT be
-- be nested. The symptom of over-deferring abort is that an exception -- nested. The symptom of over-deferring abort is that an exception may
-- may fail to be raised, or an abort may fail to take place. -- fail to be raised, or an abort may fail to take place.
-- Therefore, there are two sets of the inlinable defer/undefer -- Therefore, there are two sets of the inlinable defer/undefer routines,
-- routines, which are the ones to be used inside GNARL. -- which are the ones to be used inside GNARL. One set allows nesting. The
-- One set allows nesting. The other does not. People who -- other does not. People who maintain the GNARL should try to avoid using
-- maintain the GNARL should try to avoid using the nested versions, -- the nested versions, or at least look very critically at the places
-- or at least look very critically at the places where they are -- where they are used.
-- used.
-- In general, any GNARL call that is potentially blocking, or -- In general, any GNARL call that is potentially blocking, or whose
-- whose semantics require that it sometimes raise an exception, -- semantics require that it sometimes raise an exception, or that is
-- or that is required to be an abort completion point, must be -- required to be an abort completion point, must be made with abort
-- made with abort Deferral_Level = 1. -- Deferral_Level = 1.
-- In general, non-blocking GNARL calls, which may be made from inside -- In general, non-blocking GNARL calls, which may be made from inside a
-- a protected action, are likely to need to allow nested abort -- protected action, are likely to need to allow nested abort deferral.
-- deferral.
-- With some critical exceptions (which are supposed to be documented), -- With some critical exceptions (which are supposed to be documented),
-- internal calls to the tasking runtime system assume abort is already -- internal calls to the tasking runtime system assume abort is already
-- deferred, and do not modify the deferral level. -- deferred, and do not modify the deferral level.
-- There is also a set of non-linable defer/undefer routines, -- There is also a set of non-linable defer/undefer routines, for direct
-- for direct call from the compiler. These are not in-lineable -- call from the compiler. These are not in-lineable because they may need
-- because they may need to be called via pointers ("soft links"). -- to be called via pointers ("soft links"). For the sake of efficiency,
-- For the sake of efficiency, the version with Self_ID as parameter -- the version with Self_ID as parameter should used wherever possible.
-- should used wherever possible. These are all nestable. -- These are all nestable.
-- Non-nestable inline versions -- Non-nestable inline versions
...@@ -128,16 +126,14 @@ package System.Tasking.Initialization is ...@@ -128,16 +126,14 @@ package System.Tasking.Initialization is
procedure Defer_Abortion; procedure Defer_Abortion;
procedure Undefer_Abortion; procedure Undefer_Abortion;
-- ????? -- Try to phase out all uses of the above versions ???
-- Try to phase out all uses of the above versions.
procedure Do_Pending_Action (Self_ID : Task_Id); procedure Do_Pending_Action (Self_ID : Task_Id);
-- Only call with no locks, and when Self_ID.Pending_Action = True -- Only call with no locks, and when Self_ID.Pending_Action = True Perform
-- Perform necessary pending actions (e.g. abortion, priority change). -- necessary pending actions (e.g. abort, priority change). This procedure
-- This procedure is usually called when needed as a result of -- is usually called when needed as a result of calling Undefer_Abort,
-- calling Undefer_Abort, although in the case of e.g. No_Abort -- although in the case of e.g. No_Abort restriction, it can be necessary
-- restriction, it can be necessary to force execution of pending -- to force execution of pending actions.
-- actions.
function Check_Abort_Status return Integer; function Check_Abort_Status return Integer;
-- Returns Boolean'Pos (True) iff abort signal should raise -- Returns Boolean'Pos (True) iff abort signal should raise
...@@ -148,9 +144,8 @@ package System.Tasking.Initialization is ...@@ -148,9 +144,8 @@ package System.Tasking.Initialization is
-------------------------- --------------------------
procedure Change_Base_Priority (T : Task_Id); procedure Change_Base_Priority (T : Task_Id);
-- Change the base priority of T. -- Change the base priority of T. Has to be called with the affected
-- Has to be called with the affected task's ATCB write-locked. -- task's ATCB write-locked. May temporariliy release the lock.
-- May temporariliy release the lock.
procedure Poll_Base_Priority_Change (Self_ID : Task_Id); procedure Poll_Base_Priority_Change (Self_ID : Task_Id);
-- Has to be called with Self_ID's ATCB write-locked. -- Has to be called with Self_ID's ATCB write-locked.
...@@ -170,44 +165,41 @@ package System.Tasking.Initialization is ...@@ -170,44 +165,41 @@ package System.Tasking.Initialization is
-- within the GNARL. -- within the GNARL.
procedure Final_Task_Unlock (Self_ID : Task_Id); procedure Final_Task_Unlock (Self_ID : Task_Id);
-- This version is only for use in Terminate_Task, when the task -- This version is only for use in Terminate_Task, when the task is
-- is relinquishing further rights to its own ATCB. -- relinquishing further rights to its own ATCB. There is a very
-- There is a very interesting potential race condition there, where -- interesting potential race condition there, where the old task may run
-- the old task may run concurrently with a new task that is allocated -- concurrently with a new task that is allocated the old tasks (now
-- the old tasks (now reused) ATCB. The critical thing here is to -- reused) ATCB. The critical thing here is to not make any reference to
-- not make any reference to the ATCB after the lock is released. -- the ATCB after the lock is released. See also comments on
-- See also comments on Terminate_Task and Unlock. -- Terminate_Task and Unlock.
procedure Wakeup_Entry_Caller procedure Wakeup_Entry_Caller
(Self_ID : Task_Id; (Self_ID : Task_Id;
Entry_Call : Entry_Call_Link; Entry_Call : Entry_Call_Link;
New_State : Entry_Call_State); New_State : Entry_Call_State);
pragma Inline (Wakeup_Entry_Caller); pragma Inline (Wakeup_Entry_Caller);
-- This is called at the end of service of an entry call, -- This is called at the end of service of an entry call, to abort the
-- to abort the caller if he is in an abortable part, and -- caller if he is in an abortable part, and to wake up the caller if he
-- to wake up the caller if he is on Entry_Caller_Sleep. -- is on Entry_Caller_Sleep. Call it holding the lock of Entry_Call.Self.
-- Call it holding the lock of Entry_Call.Self.
-- --
-- Timed_Call or Simple_Call: -- Timed_Call or Simple_Call:
-- The caller is waiting on Entry_Caller_Sleep, in -- The caller is waiting on Entry_Caller_Sleep, in Wait_For_Completion,
-- Wait_For_Completion, or Wait_For_Completion_With_Timeout. -- or Wait_For_Completion_With_Timeout.
-- --
-- Conditional_Call: -- Conditional_Call:
-- The caller might be in Wait_For_Completion, -- The caller might be in Wait_For_Completion,
-- waiting for a rendezvous (possibly requeued without abort) -- waiting for a rendezvous (possibly requeued without abort) to
-- to complete. -- complete.
-- --
-- Asynchronous_Call: -- Asynchronous_Call:
-- The caller may be executing in the abortable part o -- The caller may be executing in the abortable part an async. select,
-- an async. select, or on a time delay, -- or on a time delay, if Entry_Call.State >= Was_Abortable.
-- if Entry_Call.State >= Was_Abortable.
procedure Locked_Abort_To_Level procedure Locked_Abort_To_Level
(Self_ID : Task_Id; (Self_ID : Task_Id;
T : Task_Id; T : Task_Id;
L : ATC_Level); L : ATC_Level);
pragma Inline (Locked_Abort_To_Level); pragma Inline (Locked_Abort_To_Level);
-- Abort a task to a specified ATC level. -- Abort a task to a specified ATC level. Call this only with T locked
-- Call this only with T locked.
end System.Tasking.Initialization; end System.Tasking.Initialization;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This package provides necessary type definitions for compiler interface. -- This package provides necessary type definitions for compiler interface
-- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes. -- Any changes to this interface may require corresponding compiler changes.
...@@ -62,13 +62,12 @@ package System.Tasking is ...@@ -62,13 +62,12 @@ package System.Tasking is
-- The following rules must be followed at all times, to prevent -- The following rules must be followed at all times, to prevent
-- deadlock and generally ensure correct operation of locking. -- deadlock and generally ensure correct operation of locking.
-- . Never lock a lock unless abort is deferred. -- Never lock a lock unless abort is deferred
-- . Never undefer abort while holding a lock. -- Never undefer abort while holding a lock
-- . Overlapping critical sections must be properly nested, -- Overlapping critical sections must be properly nested, and locks must
-- and locks must be released in LIFO order. -- be released in LIFO order. e.g., the following is not allowed:
-- e.g., the following is not allowed:
-- Lock (X); -- Lock (X);
-- ... -- ...
...@@ -80,7 +79,6 @@ package System.Tasking is ...@@ -80,7 +79,6 @@ package System.Tasking is
-- Locks with lower (smaller) level number cannot be locked -- Locks with lower (smaller) level number cannot be locked
-- while holding a lock with a higher level number. (The level -- while holding a lock with a higher level number. (The level
-- number is the number at the left.)
-- 1. System.Tasking.PO_Simple.Protection.L (any PO lock) -- 1. System.Tasking.PO_Simple.Protection.L (any PO lock)
-- 2. System.Tasking.Initialization.Global_Task_Lock (in body) -- 2. System.Tasking.Initialization.Global_Task_Lock (in body)
...@@ -94,13 +92,13 @@ package System.Tasking is ...@@ -94,13 +92,13 @@ package System.Tasking is
-- clearly wrong since there can be calls to "new" inside protected -- clearly wrong since there can be calls to "new" inside protected
-- operations. The new ordering prevents these failures. -- operations. The new ordering prevents these failures.
-- Sometimes we need to hold two ATCB locks at the same time. To allow -- Sometimes we need to hold two ATCB locks at the same time. To allow us
-- us to order the locking, each ATCB is given a unique serial -- to order the locking, each ATCB is given a unique serial number. If one
-- number. If one needs to hold locks on several ATCBs at once, -- needs to hold locks on several ATCBs at once, the locks with lower
-- the locks with lower serial numbers must be locked first. -- serial numbers must be locked first.
-- We don't always need to check the serial numbers, since -- We don't always need to check the serial numbers, since the serial
-- the serial numbers are assigned sequentially, and so: -- numbers are assigned sequentially, and so:
-- . The parent of a task always has a lower serial number. -- . The parent of a task always has a lower serial number.
-- . The activator of a task always has a lower serial number. -- . The activator of a task always has a lower serial number.
...@@ -157,13 +155,13 @@ package System.Tasking is ...@@ -157,13 +155,13 @@ package System.Tasking is
-- alternatives have been awakened and have terminated themselves. -- alternatives have been awakened and have terminated themselves.
Activator_Sleep, Activator_Sleep,
-- Task is waiting for created tasks to complete activation. -- Task is waiting for created tasks to complete activation
Acceptor_Sleep, Acceptor_Sleep,
-- Task is waiting on an accept or selective wait statement. -- Task is waiting on an accept or selective wait statement
Entry_Caller_Sleep, Entry_Caller_Sleep,
-- Task is waiting on an entry call. -- Task is waiting on an entry call
Async_Select_Sleep, Async_Select_Sleep,
-- Task is waiting to start the abortable part of an -- Task is waiting to start the abortable part of an
...@@ -309,20 +307,20 @@ package System.Tasking is ...@@ -309,20 +307,20 @@ package System.Tasking is
State : Entry_Call_State; State : Entry_Call_State;
pragma Atomic (State); pragma Atomic (State);
-- Indicates part of the state of the call. -- Indicates part of the state of the call.
-- Protection: --
-- If the call is not on a queue, it should -- Protection: If the call is not on a queue, it should only be
-- only be accessed by Self, and Self does not need any -- accessed by Self, and Self does not need any lock to modify this
-- lock to modify this field. -- field.
-- Once the call is on a queue, the value should be --
-- something other than Done unless it is cancelled, and access is -- Once the call is on a queue, the value should be something other
-- controller by the "server" of the queue -- i.e., the lock -- than Done unless it is cancelled, and access is controller by the
-- of Checked_To_Protection (Call_Target) -- "server" of the queue -- i.e., the lock of Checked_To_Protection
-- if the call record is on the queue of a PO, or the lock -- (Call_Target) if the call record is on the queue of a PO, or the
-- of Called_Target if the call is on the queue of a task. -- lock of Called_Target if the call is on the queue of a task. See
-- See comments on type declaration for more details. -- comments on type declaration for more details.
Uninterpreted_Data : System.Address; Uninterpreted_Data : System.Address;
-- Data passed by the compiler. -- Data passed by the compiler
Exception_To_Raise : Ada.Exceptions.Exception_Id; Exception_To_Raise : Ada.Exceptions.Exception_Id;
-- The exception to raise once this call has been completed without -- The exception to raise once this call has been completed without
...@@ -351,7 +349,7 @@ package System.Tasking is ...@@ -351,7 +349,7 @@ package System.Tasking is
-- Ada_Task_Control_Block (ATCB) definition -- -- Ada_Task_Control_Block (ATCB) definition --
---------------------------------------------- ----------------------------------------------
-- Notes on protection (synchronization) of TRTS data structures. -- Notes on protection (synchronization) of TRTS data structures
-- Any field of the TCB can be written by the activator of a task when the -- Any field of the TCB can be written by the activator of a task when the
-- task is created, since no other task can access the new task's -- task is created, since no other task can access the new task's
...@@ -360,7 +358,7 @@ package System.Tasking is ...@@ -360,7 +358,7 @@ package System.Tasking is
-- The protection for each field is described in a comment starting with -- The protection for each field is described in a comment starting with
-- "Protection:". -- "Protection:".
-- When a lock is used to protect an ATCB field, this lock is simply named. -- When a lock is used to protect an ATCB field, this lock is simply named
-- Some protection is described in terms of tasks related to the -- Some protection is described in terms of tasks related to the
-- ATCB being protected. These are: -- ATCB being protected. These are:
...@@ -390,7 +388,8 @@ package System.Tasking is ...@@ -390,7 +388,8 @@ package System.Tasking is
-- Encodes some basic information about the state of a task, -- Encodes some basic information about the state of a task,
-- including whether it has been activated, whether it is sleeping, -- including whether it has been activated, whether it is sleeping,
-- and whether it is terminated. -- and whether it is terminated.
-- Protection: Self.L. --
-- Protection: Self.L
Parent : Task_Id; Parent : Task_Id;
-- The task on which this task depends. -- The task on which this task depends.
...@@ -399,7 +398,8 @@ package System.Tasking is ...@@ -399,7 +398,8 @@ package System.Tasking is
Base_Priority : System.Any_Priority; Base_Priority : System.Any_Priority;
-- Base priority, not changed during entry calls, only changed -- Base priority, not changed during entry calls, only changed
-- via dynamic priorities package. -- via dynamic priorities package.
-- Protection: Only written by Self, accessed by anyone. --
-- Protection: Only written by Self, accessed by anyone
Current_Priority : System.Any_Priority; Current_Priority : System.Any_Priority;
-- Active priority, except that the effects of protected object -- Active priority, except that the effects of protected object
...@@ -428,96 +428,104 @@ package System.Tasking is ...@@ -428,96 +428,104 @@ package System.Tasking is
Protected_Action_Nesting : Natural; Protected_Action_Nesting : Natural;
pragma Atomic (Protected_Action_Nesting); pragma Atomic (Protected_Action_Nesting);
-- The dynamic level of protected action nesting for this task. -- The dynamic level of protected action nesting for this task. This
-- This field is needed for checking whether potentially -- field is needed for checking whether potentially blocking operations
-- blocking operations are invoked from protected actions. -- are invoked from protected actions. pragma Atomic is used because it
-- pragma Atomic is used because it can be read/written from -- can be read/written from protected interrupt handlers.
-- protected interrupt handlers.
Task_Image : String (1 .. 32); Task_Image : String (1 .. 32);
-- Hold a string that provides a readable id for task, -- Hold a string that provides a readable id for task,
-- built from the variable of which it is a value or component. -- built from the variable of which it is a value or component.
Task_Image_Len : Natural; Task_Image_Len : Natural;
-- Actual length of Task_Image. -- Actual length of Task_Image
Call : Entry_Call_Link; Call : Entry_Call_Link;
-- The entry call that has been accepted by this task. -- The entry call that has been accepted by this task.
-- Protection: Self.L. Self will modify this field --
-- when Self.Accepting is False, and will not need the mutex to do so. -- Protection: Self.L. Self will modify this field when Self.Accepting
-- Once a task sets Pending_ATC_Level = 0, no other task can access -- is False, and will not need the mutex to do so. Once a task sets
-- this field. -- Pending_ATC_Level = 0, no other task can access this field.
LL : aliased Task_Primitives.Private_Data; LL : aliased Task_Primitives.Private_Data;
-- Control block used by the underlying low-level tasking -- Control block used by the underlying low-level tasking service
-- service (GNULLI). -- (GNULLI).
--
-- Protection: This is used only by the GNULLI implementation, which -- Protection: This is used only by the GNULLI implementation, which
-- takes care of all of its synchronization. -- takes care of all of its synchronization.
Task_Arg : System.Address; Task_Arg : System.Address;
-- The argument to task procedure. Provide a handle for discriminant -- The argument to task procedure. Provide a handle for discriminant
-- information. -- information
-- Protection: Part of the synchronization between Self and --
-- Activator. Activator writes it, once, before Self starts -- Protection: Part of the synchronization between Self and Activator.
-- executing. Thereafter, Self only reads it. -- Activator writes it, once, before Self starts executing. Thereafter,
-- Self only reads it.
Task_Entry_Point : Task_Procedure_Access; Task_Entry_Point : Task_Procedure_Access;
-- Information needed to call the procedure containing the code for -- Information needed to call the procedure containing the code for
-- the body of this task. -- the body of this task.
-- Protection: Part of the synchronization between Self and --
-- Activator. Activator writes it, once, before Self starts -- Protection: Part of the synchronization between Self and Activator.
-- executing. Self reads it, once, as part of its execution. -- Activator writes it, once, before Self starts executing. Self reads
-- it, once, as part of its execution.
Compiler_Data : System.Soft_Links.TSD; Compiler_Data : System.Soft_Links.TSD;
-- Task-specific data needed by the compiler to store -- Task-specific data needed by the compiler to store per-task
-- per-task structures. -- structures.
-- Protection: Only accessed by Self. --
-- Protection: Only accessed by Self
All_Tasks_Link : Task_Id; All_Tasks_Link : Task_Id;
-- Used to link this task to the list of all tasks in the system. -- Used to link this task to the list of all tasks in the system
-- Protection: RTS_Lock. --
-- Protection: RTS_Lock
Activation_Link : Task_Id; Activation_Link : Task_Id;
-- Used to link this task to a list of tasks to be activated. -- Used to link this task to a list of tasks to be activated
-- Protection: Only used by Activator. --
-- Protection: Only used by Activator
Activator : Task_Id; Activator : Task_Id;
-- The task that created this task, either by declaring it as a task -- The task that created this task, either by declaring it as a task
-- object or by executing a task allocator. -- object or by executing a task allocator. The value is null iff Self
-- The value is null iff Self has completed activation. -- has completed activation.
-- Protection: Set by Activator before Self is activated, and --
-- only read and modified by Self after that. -- Protection: Set by Activator before Self is activated, and only read
-- and modified by Self after that.
Wait_Count : Integer; Wait_Count : Integer;
-- This count is used by a task that is waiting for other tasks. -- This count is used by a task that is waiting for other tasks. At all
-- At all other times, the value should be zero. -- other times, the value should be zero. It is used differently in
-- It is used differently in several different states. -- several different states. Since a task cannot be in more than one of
-- Since a task cannot be in more than one of these states at the -- these states at the same time, a single counter suffices.
-- same time, a single counter suffices. --
-- Protection: Self.L. -- Protection: Self.L
-- Activator_Sleep -- Activator_Sleep
-- This is the number of tasks that this task is activating, i.e. the -- This is the number of tasks that this task is activating, i.e. the
-- children that have started activation but have not completed it. -- children that have started activation but have not completed it.
-- Protection: Self.L and Created.L. Both mutexes must be locked, --
-- since Self.Activation_Count and Created.State must be synchronized. -- Protection: Self.L and Created.L. Both mutexes must be locked, since
-- Self.Activation_Count and Created.State must be synchronized.
-- Master_Completion_Sleep (phase 1) -- Master_Completion_Sleep (phase 1)
-- This is the number dependent tasks of a master being -- This is the number dependent tasks of a master being completed by
-- completed by Self that are not activated, not terminated, and -- Self that are not activated, not terminated, and not waiting on a
-- not waiting on a terminate alternative. -- terminate alternative.
-- Master_Completion_2_Sleep (phase 2) -- Master_Completion_2_Sleep (phase 2)
-- This is the count of tasks dependent on a master being -- This is the count of tasks dependent on a master being completed by
-- completed by Self which are waiting on a terminate alternative. -- Self which are waiting on a terminate alternative.
Elaborated : Access_Boolean; Elaborated : Access_Boolean;
-- Pointer to a flag indicating that this task's body has been -- Pointer to a flag indicating that this task's body has been
-- elaborated. The flag is created and managed by the -- elaborated. The flag is created and managed by the
-- compiler-generated code. -- compiler-generated code.
--
-- Protection: The field itself is only accessed by Activator. The flag -- Protection: The field itself is only accessed by Activator. The flag
-- that it points to is updated by Master and read by Activator; access -- that it points to is updated by Master and read by Activator; access
-- is assumed to be atomic. -- is assumed to be atomic.
...@@ -539,6 +547,7 @@ package System.Tasking is ...@@ -539,6 +547,7 @@ package System.Tasking is
-- restricted GNULL implementations to allocate an ATCB (see -- restricted GNULL implementations to allocate an ATCB (see
-- System.Task_Primitives.Operations.New_ATCB) that will take -- System.Task_Primitives.Operations.New_ATCB) that will take
-- significantly less memory. -- significantly less memory.
-- Note that the restricted GNARLI should only access fields that are -- Note that the restricted GNARLI should only access fields that are
-- present in the Restricted_Ada_Task_Control_Block structure. -- present in the Restricted_Ada_Task_Control_Block structure.
...@@ -564,7 +573,7 @@ package System.Tasking is ...@@ -564,7 +573,7 @@ package System.Tasking is
----------------------- -----------------------
All_Tasks_List : Task_Id; All_Tasks_List : Task_Id;
-- Global linked list of all tasks. -- Global linked list of all tasks
------------------------------------------ ------------------------------------------
-- Regular (non restricted) definitions -- -- Regular (non restricted) definitions --
...@@ -577,13 +586,13 @@ package System.Tasking is ...@@ -577,13 +586,13 @@ package System.Tasking is
subtype Master_Level is Integer; subtype Master_Level is Integer;
subtype Master_ID is Master_Level; subtype Master_ID is Master_Level;
-- Normally, a task starts out with internal master nesting level -- Normally, a task starts out with internal master nesting level one
-- one larger than external master nesting level. It is incremented -- larger than external master nesting level. It is incremented to one by
-- to one by Enter_Master, which is called in the task body only if -- Enter_Master, which is called in the task body only if the compiler
-- the compiler thinks the task may have dependent tasks. It is set to 1 -- thinks the task may have dependent tasks. It is set to for the
-- for the environment task, the level 2 is reserved for server tasks of -- environment task, the level 2 is reserved for server tasks of the
-- the run-time system (the so called "independent tasks"), and the level -- run-time system (the so called "independent tasks"), and the level 3 is
-- 3 is for the library level tasks. -- for the library level tasks.
Environment_Task_Level : constant Master_Level := 1; Environment_Task_Level : constant Master_Level := 1;
Independent_Task_Level : constant Master_Level := 2; Independent_Task_Level : constant Master_Level := 2;
...@@ -596,7 +605,7 @@ package System.Tasking is ...@@ -596,7 +605,7 @@ package System.Tasking is
Unspecified_Priority : constant Integer := System.Priority'First - 1; Unspecified_Priority : constant Integer := System.Priority'First - 1;
Priority_Not_Boosted : constant Integer := System.Priority'First - 1; Priority_Not_Boosted : constant Integer := System.Priority'First - 1;
-- Definition of Priority actually has to come from the RTS configuration. -- Definition of Priority actually has to come from the RTS configuration
subtype Rendezvous_Priority is Integer subtype Rendezvous_Priority is Integer
range Priority_Not_Boosted .. System.Any_Priority'Last; range Priority_Not_Boosted .. System.Any_Priority'Last;
...@@ -652,21 +661,19 @@ package System.Tasking is ...@@ -652,21 +661,19 @@ package System.Tasking is
State : Entry_Call_State; State : Entry_Call_State;
pragma Atomic (State); pragma Atomic (State);
-- Indicates part of the state of the call. -- Indicates part of the state of the call
-- Protection: --
-- If the call is not on a queue, it should -- Protection: If the call is not on a queue, it should only be
-- only be accessed by Self, and Self does not need any -- accessed by Self, and Self does not need any lock to modify this
-- lock to modify this field. -- field. Once the call is on a queue, the value should be something
-- Once the call is on a queue, the value should be -- other than Done unless it is cancelled, and access is controller by
-- something other than Done unless it is cancelled, and access is -- the "server" of the queue -- i.e., the lock of Checked_To_Protection
-- controller by the "server" of the queue -- i.e., the lock -- (Call_Target) if the call record is on the queue of a PO, or the
-- of Checked_To_Protection (Call_Target) -- lock of Called_Target if the call is on the queue of a task. See
-- if the call record is on the queue of a PO, or the lock -- comments on type declaration for more details.
-- of Called_Target if the call is on the queue of a task.
-- See comments on type declaration for more details.
Uninterpreted_Data : System.Address; Uninterpreted_Data : System.Address;
-- Data passed by the compiler. -- Data passed by the compiler
Exception_To_Raise : Ada.Exceptions.Exception_Id; Exception_To_Raise : Ada.Exceptions.Exception_Id;
-- The exception to raise once this call has been completed without -- The exception to raise once this call has been completed without
...@@ -693,42 +700,39 @@ package System.Tasking is ...@@ -693,42 +700,39 @@ package System.Tasking is
Called_Task : Task_Id; Called_Task : Task_Id;
pragma Atomic (Called_Task); pragma Atomic (Called_Task);
-- Use for task entry calls. -- Use for task entry calls. The value is null if the call record is
-- The value is null if the call record is not in use. -- not in use. Conversely, unless State is Done and Onqueue is false,
-- Conversely, unless State is Done and Onqueue is false,
-- Called_Task points to an ATCB. -- Called_Task points to an ATCB.
-- Protection: Called_Task.L. --
-- Protection: Called_Task.L
Called_PO : System.Address; Called_PO : System.Address;
pragma Atomic (Called_PO); pragma Atomic (Called_PO);
-- Similar to Called_Task but for protected objects. -- Similar to Called_Task but for protected objects
--
-- Note that the previous implementation tried to merge both -- Note that the previous implementation tried to merge both
-- Called_Task and Called_PO but this ended up in many unexpected -- Called_Task and Called_PO but this ended up in many unexpected
-- complications (e.g having to add a magic number in the ATCB, which -- complications (e.g having to add a magic number in the ATCB, which
-- caused gdb lots of confusion) with no real gain since the Lock_Server -- caused gdb lots of confusion) with no real gain since the
-- implementation still need to loop around chasing for pointer changes -- Lock_Server implementation still need to loop around chasing for
-- even with a single pointer. -- pointer changes even with a single pointer.
Acceptor_Prev_Call : Entry_Call_Link; Acceptor_Prev_Call : Entry_Call_Link;
-- For task entry calls only. -- For task entry calls only
Acceptor_Prev_Priority : Rendezvous_Priority := Priority_Not_Boosted; Acceptor_Prev_Priority : Rendezvous_Priority := Priority_Not_Boosted;
-- For task entry calls only. -- For task entry calls only. The priority of the most recent prior
-- The priority of the most recent prior call being serviced. -- call being serviced. For protected entry calls, this function should
-- For protected entry calls, this function should be performed by -- be performed by GNULLI ceiling locking.
-- GNULLI ceiling locking.
Cancellation_Attempted : Boolean := False; Cancellation_Attempted : Boolean := False;
pragma Atomic (Cancellation_Attempted); pragma Atomic (Cancellation_Attempted);
-- Cancellation of the call has been attempted. -- Cancellation of the call has been attempted.
-- If it has succeeded, State = Cancelled. -- Consider merging this into State???
-- ?????
-- Consider merging this into State?
Requeue_With_Abort : Boolean := False; Requeue_With_Abort : Boolean := False;
-- Temporary to tell caller whether requeue is with abort. -- Temporary to tell caller whether requeue is with abort.
-- ????? -- Find a better way of doing this ???
-- Find a better way of doing this.
Needs_Requeue : Boolean := False; Needs_Requeue : Boolean := False;
-- Temporary to tell acceptor of task entry call that -- Temporary to tell acceptor of task entry call that
...@@ -756,10 +760,10 @@ package System.Tasking is ...@@ -756,10 +760,10 @@ package System.Tasking is
type Direct_Index is range 0 .. Parameters.Default_Attribute_Count; type Direct_Index is range 0 .. Parameters.Default_Attribute_Count;
subtype Direct_Index_Range is Direct_Index range 1 .. Direct_Index'Last; subtype Direct_Index_Range is Direct_Index range 1 .. Direct_Index'Last;
-- Attributes with indices in this range are stored directly in -- Attributes with indices in this range are stored directly in the task
-- the task control block. Such attributes must be Address-sized. -- control block. Such attributes must be Address-sized. Other attributes
-- Other attributes will be held in dynamically allocated records -- will be held in dynamically allocated records chained off of the task
-- chained off of the task control block. -- control block.
type Direct_Attribute_Element is mod Memory_Size; type Direct_Attribute_Element is mod Memory_Size;
pragma Atomic (Direct_Attribute_Element); pragma Atomic (Direct_Attribute_Element);
...@@ -772,86 +776,95 @@ package System.Tasking is ...@@ -772,86 +776,95 @@ package System.Tasking is
-- the usage of the direct attribute fields. -- the usage of the direct attribute fields.
type Task_Serial_Number is mod 2 ** 64; type Task_Serial_Number is mod 2 ** 64;
-- Used to give each task a unique serial number. -- Used to give each task a unique serial number
type Ada_Task_Control_Block (Entry_Num : Task_Entry_Index) is record type Ada_Task_Control_Block (Entry_Num : Task_Entry_Index) is record
Common : Common_ATCB; Common : Common_ATCB;
-- The common part between various tasking implementations -- The common part between various tasking implementations
Entry_Calls : Entry_Call_Array; Entry_Calls : Entry_Call_Array;
-- An array of entry calls. -- An array of entry calls
--
-- Protection: The elements of this array are on entry call queues -- Protection: The elements of this array are on entry call queues
-- associated with protected objects or task entries, and are protected -- associated with protected objects or task entries, and are protected
-- by the protected object lock or Acceptor.L, respectively. -- by the protected object lock or Acceptor.L, respectively.
New_Base_Priority : System.Any_Priority; New_Base_Priority : System.Any_Priority;
-- New value for Base_Priority (for dynamic priorities package). -- New value for Base_Priority (for dynamic priorities package)
-- Protection: Self.L. --
-- Protection: Self.L
Global_Task_Lock_Nesting : Natural := 0; Global_Task_Lock_Nesting : Natural := 0;
-- This is the current nesting level of calls to -- This is the current nesting level of calls to
-- System.Tasking.Stages.Lock_Task_T. -- System.Tasking.Stages.Lock_Task_T. This allows a task to call
-- This allows a task to call Lock_Task_T multiple times without -- Lock_Task_T multiple times without deadlocking. A task only locks
-- deadlocking. A task only locks All_Task_Lock when its -- All_Task_Lock when its All_Tasks_Nesting goes from 0 to 1, and only
-- All_Tasks_Nesting goes from 0 to 1, and only unlocked when it -- unlocked when it goes from 1 to 0.
-- goes from 1 to 0. --
-- Protection: Only accessed by Self. -- Protection: Only accessed by Self
Open_Accepts : Accept_List_Access; Open_Accepts : Accept_List_Access;
-- This points to the Open_Accepts array of accept alternatives passed -- This points to the Open_Accepts array of accept alternatives passed
-- to the RTS by the compiler-generated code to Selective_Wait. -- to the RTS by the compiler-generated code to Selective_Wait. It is
-- It is non-null iff this task is ready to accept an entry call. -- non-null iff this task is ready to accept an entry call.
-- Protection: Self.L. --
-- Protection: Self.L
Chosen_Index : Select_Index; Chosen_Index : Select_Index;
-- The index in Open_Accepts of the entry call accepted by a selective -- The index in Open_Accepts of the entry call accepted by a selective
-- wait executed by this task. -- wait executed by this task.
-- Protection: Written by both Self and Caller. Usually protected --
-- by Self.L. However, once the selection is known to have been -- Protection: Written by both Self and Caller. Usually protected by
-- written it can be accessed without protection. This happens -- Self.L. However, once the selection is known to have been written it
-- after Self has updated it itself using information from a suspended -- can be accessed without protection. This happens after Self has
-- Caller, or after Caller has updated it and awakened Self. -- updated it itself using information from a suspended Caller, or
-- after Caller has updated it and awakened Self.
Master_of_Task : Master_Level; Master_of_Task : Master_Level;
-- The task executing the master of this task, and the ID of this task's -- The task executing the master of this task, and the ID of this task's
-- master (unique only among masters currently active within Parent). -- master (unique only among masters currently active within Parent).
-- Protection: Set by Activator before Self is activated, and --
-- read after Self is activated. -- Protection: Set by Activator before Self is activated, and read
-- after Self is activated.
Master_Within : Master_Level; Master_Within : Master_Level;
-- The ID of the master currently executing within this task; that is, -- The ID of the master currently executing within this task; that is,
-- the most deeply nested currently active master. -- the most deeply nested currently active master.
--
-- Protection: Only written by Self, and only read by Self or by -- Protection: Only written by Self, and only read by Self or by
-- dependents when Self is attempting to exit a master. Since Self -- dependents when Self is attempting to exit a master. Since Self will
-- will not write this field until the master is complete, the -- not write this field until the master is complete, the
-- synchronization should be adequate to prevent races. -- synchronization should be adequate to prevent races.
Alive_Count : Integer := 0; Alive_Count : Integer := 0;
-- Number of tasks directly dependent on this task (including itself) -- Number of tasks directly dependent on this task (including itself)
-- that are still "alive", i.e. not terminated. -- that are still "alive", i.e. not terminated.
-- Protection: Self.L. --
-- Protection: Self.L
Awake_Count : Integer := 0; Awake_Count : Integer := 0;
-- Number of tasks directly dependent on this task (including itself) -- Number of tasks directly dependent on this task (including itself)
-- still "awake", i.e., are not terminated and not waiting on a -- still "awake", i.e., are not terminated and not waiting on a
-- terminate alternative. -- terminate alternative.
--
-- Invariant: Awake_Count <= Alive_Count -- Invariant: Awake_Count <= Alive_Count
-- Protection: Self.L.
-- beginning of flags -- Protection: Self.L
-- Beginning of flags
Aborting : Boolean := False; Aborting : Boolean := False;
pragma Atomic (Aborting); pragma Atomic (Aborting);
-- Self is in the process of aborting. While set, prevents multiple -- Self is in the process of aborting. While set, prevents multiple
-- abortion signals from being sent by different aborter while abortion -- abort signals from being sent by different aborter while abort
-- is acted upon. This is essential since an aborter which calls -- is acted upon. This is essential since an aborter which calls
-- Abort_To_Level could set the Pending_ATC_Level to yet a lower level -- Abort_To_Level could set the Pending_ATC_Level to yet a lower level
-- (than the current level), may be preempted and would send the -- (than the current level), may be preempted and would send the
-- abortion signal when resuming execution. At this point, the abortee -- abort signal when resuming execution. At this point, the abortee
-- may have completed abortion to the proper level such that the -- may have completed abort to the proper level such that the
-- signal (and resulting abortion exception) are not handled any more. -- signal (and resulting abort exception) are not handled any more.
-- In other words, the flag prevents a race between multiple aborters -- In other words, the flag prevents a race between multiple aborters
-- and the abortee. --
-- Protection: protected by atomic access. -- Protection: protected by atomic access.
ATC_Hack : Boolean := False; ATC_Hack : Boolean := False;
...@@ -863,17 +876,17 @@ package System.Tasking is ...@@ -863,17 +876,17 @@ package System.Tasking is
-- handler itself. -- handler itself.
Callable : Boolean := True; Callable : Boolean := True;
-- It is OK to call entries of this task. -- It is OK to call entries of this task
Dependents_Aborted : Boolean := False; Dependents_Aborted : Boolean := False;
-- This is set to True by whichever task takes responsibility -- This is set to True by whichever task takes responsibility for
-- for aborting the dependents of this task. -- aborting the dependents of this task.
-- Protection: Self.L. --
-- Protection: Self.L
Interrupt_Entry : Boolean := False; Interrupt_Entry : Boolean := False;
-- Indicates if one or more Interrupt Entries are attached to -- Indicates if one or more Interrupt Entries are attached to the task.
-- the task. This flag is needed for cleaning up the Interrupt -- This flag is needed for cleaning up the Interrupt Entry bindings.
-- Entry bindings.
Pending_Action : Boolean := False; Pending_Action : Boolean := False;
-- Unified flag indicating some action needs to be take when abort -- Unified flag indicating some action needs to be take when abort
...@@ -884,65 +897,68 @@ package System.Tasking is ...@@ -884,65 +897,68 @@ package System.Tasking is
-- (Abortable field may have changed and the Wait_Until_Abortable -- (Abortable field may have changed and the Wait_Until_Abortable
-- has to recheck the abortable status of the call.) -- has to recheck the abortable status of the call.)
-- . Exception_To_Raise is non-null -- . Exception_To_Raise is non-null
-- Protection: Self.L. --
-- This should never be reset back to False outside of the -- Protection: Self.L
-- procedure Do_Pending_Action, which is called by Undefer_Abort. --
-- It should only be set to True by Set_Priority and Abort_To_Level. -- This should never be reset back to False outside of the procedure
-- Do_Pending_Action, which is called by Undefer_Abort. It should only
-- be set to True by Set_Priority and Abort_To_Level.
Pending_Priority_Change : Boolean := False; Pending_Priority_Change : Boolean := False;
-- Flag to indicate pending priority change (for dynamic priorities -- Flag to indicate pending priority change (for dynamic priorities
-- package). The base priority is updated on the next abortion -- package). The base priority is updated on the next abort
-- completion point (aka. synchronization point). -- completion point (aka. synchronization point).
-- Protection: Self.L. --
-- Protection: Self.L
Terminate_Alternative : Boolean := False; Terminate_Alternative : Boolean := False;
-- Task is accepting Select with Terminate Alternative. -- Task is accepting Select with Terminate Alternative
-- Protection: Self.L. --
-- Protection: Self.L
-- end of flags -- End of flags
-- beginning of counts -- Beginning of counts
ATC_Nesting_Level : ATC_Level := 1; ATC_Nesting_Level : ATC_Level := 1;
-- The dynamic level of ATC nesting (currently executing nested -- The dynamic level of ATC nesting (currently executing nested
-- asynchronous select statements) in this task. -- asynchronous select statements) in this task.
-- Protection: Self_ID.L.
-- Only Self reads or updates this field. -- Protection: Self_ID.L. Only Self reads or updates this field.
-- Decrementing it deallocates an Entry_Calls component, and care must -- Decrementing it deallocates an Entry_Calls component, and care must
-- be taken that all references to that component are eliminated -- be taken that all references to that component are eliminated before
-- before doing the decrement. This in turn will require locking -- doing the decrement. This in turn will require locking a protected
-- a protected object (for a protected entry call) or the Acceptor's -- object (for a protected entry call) or the Acceptor's lock (for a
-- lock (for a task entry call). -- task entry call). No other task should attempt to read or modify
-- No other task should attempt to read or modify this value. -- this value.
Deferral_Level : Natural := 1; Deferral_Level : Natural := 1;
-- This is the number of times that Defer_Abortion has been called by -- This is the number of times that Defer_Abortion has been called by
-- this task without a matching Undefer_Abortion call. Abortion is -- this task without a matching Undefer_Abortion call. Abortion is only
-- only allowed when this zero. -- allowed when this zero. It is initially 1, to protect the task at
-- It is initially 1, to protect the task at startup. -- startup.
-- Protection: Only updated by Self; access assumed to be atomic.
-- Protection: Only updated by Self; access assumed to be atomic
Pending_ATC_Level : ATC_Level_Base := ATC_Level_Infinity; Pending_ATC_Level : ATC_Level_Base := ATC_Level_Infinity;
-- The ATC level to which this task is currently being aborted. -- The ATC level to which this task is currently being aborted. If the
-- If the value is zero, the entire task has "completed". -- value is zero, the entire task has "completed". That may be via
-- That may be via abort, exception propagation, or normal exit. -- abort, exception propagation, or normal exit. If the value is
-- If the value is ATC_Level_Infinity, the task is not being -- ATC_Level_Infinity, the task is not being aborted to any level. If
-- aborted to any level. -- the value is positive, the task has not completed. This should ONLY
-- If the value is positive, the task has not completed. -- be modified by Abort_To_Level and Exit_One_ATC_Level.
-- This should ONLY be modified by --
-- Abort_To_Level and Exit_One_ATC_Level. -- Protection: Self.L
-- Protection: Self.L.
Serial_Number : Task_Serial_Number; Serial_Number : Task_Serial_Number;
-- A growing number to provide some way to check locking -- A growing number to provide some way to check locking rules/ordering
-- rules/ordering.
Known_Tasks_Index : Integer := -1; Known_Tasks_Index : Integer := -1;
-- Index in the System.Tasking.Debug.Known_Tasks array. -- Index in the System.Tasking.Debug.Known_Tasks array
User_State : Long_Integer := 0; User_State : Long_Integer := 0;
-- User-writeable location, for use in debugging tasks; -- User-writeable location, for use in debugging tasks; also provides a
-- also provides a simple task specific data. -- simple task specific data.
Direct_Attributes : Direct_Attribute_Array; Direct_Attributes : Direct_Attribute_Array;
-- For task attributes that have same size as Address -- For task attributes that have same size as Address
...@@ -951,11 +967,12 @@ package System.Tasking is ...@@ -951,11 +967,12 @@ package System.Tasking is
-- Bit I is 1 iff Direct_Attributes (I) is defined -- Bit I is 1 iff Direct_Attributes (I) is defined
Indirect_Attributes : Access_Address; Indirect_Attributes : Access_Address;
-- A pointer to chain of records for other attributes that -- A pointer to chain of records for other attributes that are not
-- are not address-sized, including all tagged types. -- address-sized, including all tagged types.
Entry_Queues : Task_Entry_Queue_Array (1 .. Entry_Num); Entry_Queues : Task_Entry_Queue_Array (1 .. Entry_Num);
-- An array of task entry queues. -- An array of task entry queues
--
-- Protection: Self.L. Once a task has set Self.Stage to Completing, it -- Protection: Self.L. Once a task has set Self.Stage to Completing, it
-- has exclusive access to this field. -- has exclusive access to this field.
end record; end record;
...@@ -975,18 +992,18 @@ package System.Tasking is ...@@ -975,18 +992,18 @@ package System.Tasking is
Stack_Size : System.Parameters.Size_Type; Stack_Size : System.Parameters.Size_Type;
T : Task_Id; T : Task_Id;
Success : out Boolean); Success : out Boolean);
-- Initialize fields of a TCB and link into global TCB structures -- Initialize fields of a TCB and link into global TCB structures Call
-- Call this only with abort deferred and holding RTS_Lock. -- this only with abort deferred and holding RTS_Lock. Need more
-- Need more documentation, mention T, and describe Success ??? -- documentation, mention T, and describe Success ???
private private
Null_Task : constant Task_Id := null; Null_Task : constant Task_Id := null;
GL_Detect_Blocking : Integer; GL_Detect_Blocking : Integer;
pragma Import (C, GL_Detect_Blocking, "__gl_detect_blocking"); pragma Import (C, GL_Detect_Blocking, "__gl_detect_blocking");
-- Global variable exported by the binder generated file. A value -- Global variable exported by the binder generated file. A value equal to
-- equal to 1 indicates that pragma Detect_Blocking is active, -- 1 indicates that pragma Detect_Blocking is active, while 0 is used for
-- while 0 is used for the pragma not being present. -- the pragma not being present.
Detect_Blocking : constant Boolean := GL_Detect_Blocking = 1; Detect_Blocking : constant Boolean := GL_Detect_Blocking = 1;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -154,7 +154,7 @@ package body System.Tasking.Rendezvous is ...@@ -154,7 +154,7 @@ package body System.Tasking.Rendezvous is
procedure Boost_Priority (Call : Entry_Call_Link; Acceptor : Task_Id); procedure Boost_Priority (Call : Entry_Call_Link; Acceptor : Task_Id);
pragma Inline (Boost_Priority); pragma Inline (Boost_Priority);
-- Call this only with abort deferred and holding lock of Acceptor. -- Call this only with abort deferred and holding lock of Acceptor
procedure Call_Synchronous procedure Call_Synchronous
(Acceptor : Task_Id; (Acceptor : Task_Id;
...@@ -255,7 +255,7 @@ package body System.Tasking.Rendezvous is ...@@ -255,7 +255,7 @@ package body System.Tasking.Rendezvous is
Uninterpreted_Data := Uninterpreted_Data :=
Caller.Entry_Calls (Caller.ATC_Nesting_Level).Uninterpreted_Data; Caller.Entry_Calls (Caller.ATC_Nesting_Level).Uninterpreted_Data;
else else
-- Case of an aborted task. -- Case of an aborted task
Uninterpreted_Data := System.Null_Address; Uninterpreted_Data := System.Null_Address;
end if; end if;
...@@ -701,7 +701,7 @@ package body System.Tasking.Rendezvous is ...@@ -701,7 +701,7 @@ package body System.Tasking.Rendezvous is
(Self_Id, Entry_Call.Acceptor_Prev_Priority); (Self_Id, Entry_Call.Acceptor_Prev_Priority);
else else
-- The call does not need to be requeued. -- The call does not need to be requeued
Self_Id.Common.Call := Entry_Call.Acceptor_Prev_Call; Self_Id.Common.Call := Entry_Call.Acceptor_Prev_Call;
Entry_Call.Exception_To_Raise := Ex; Entry_Call.Exception_To_Raise := Ex;
...@@ -712,7 +712,7 @@ package body System.Tasking.Rendezvous is ...@@ -712,7 +712,7 @@ package body System.Tasking.Rendezvous is
STPO.Write_Lock (Caller); STPO.Write_Lock (Caller);
-- Done with Caller locked to make sure that Wakeup is not lost. -- Done with Caller locked to make sure that Wakeup is not lost
if Ex /= Ada.Exceptions.Null_Id then if Ex /= Ada.Exceptions.Null_Id then
Transfer_Occurrence Transfer_Occurrence
...@@ -844,7 +844,7 @@ package body System.Tasking.Rendezvous is ...@@ -844,7 +844,7 @@ package body System.Tasking.Rendezvous is
Queuing.Select_Task_Entry_Call Queuing.Select_Task_Entry_Call
(Self_Id, Open_Accepts, Entry_Call, Selection, Open_Alternative); (Self_Id, Open_Accepts, Entry_Call, Selection, Open_Alternative);
-- Determine the kind and disposition of the select. -- Determine the kind and disposition of the select
Treatment := Default_Treatment (Select_Mode); Treatment := Default_Treatment (Select_Mode);
Self_Id.Chosen_Index := No_Rendezvous; Self_Id.Chosen_Index := No_Rendezvous;
...@@ -865,7 +865,7 @@ package body System.Tasking.Rendezvous is ...@@ -865,7 +865,7 @@ package body System.Tasking.Rendezvous is
end if; end if;
end if; end if;
-- Handle the select according to the disposition selected above. -- Handle the select according to the disposition selected above
case Treatment is case Treatment is
when Accept_Alternative_Selected => when Accept_Alternative_Selected =>
...@@ -882,7 +882,8 @@ package body System.Tasking.Rendezvous is ...@@ -882,7 +882,8 @@ package body System.Tasking.Rendezvous is
STPO.Unlock (Self_Id); STPO.Unlock (Self_Id);
when Accept_Alternative_Completed => when Accept_Alternative_Completed =>
-- Accept body is null, so rendezvous is over immediately.
-- Accept body is null, so rendezvous is over immediately
if Parameters.Runtime_Traces then if Parameters.Runtime_Traces then
Send_Trace_Info (M_RDV_Complete, Entry_Call.Self); Send_Trace_Info (M_RDV_Complete, Entry_Call.Self);
...@@ -896,7 +897,8 @@ package body System.Tasking.Rendezvous is ...@@ -896,7 +897,8 @@ package body System.Tasking.Rendezvous is
STPO.Unlock (Caller); STPO.Unlock (Caller);
when Accept_Alternative_Open => when Accept_Alternative_Open =>
-- Wait for caller.
-- Wait for caller
Self_Id.Open_Accepts := Open_Accepts; Self_Id.Open_Accepts := Open_Accepts;
pragma Debug pragma Debug
...@@ -913,9 +915,9 @@ package body System.Tasking.Rendezvous is ...@@ -913,9 +915,9 @@ package body System.Tasking.Rendezvous is
-- Self_Id.Common.Call should already be updated by the Caller if -- Self_Id.Common.Call should already be updated by the Caller if
-- not aborted. It might also be ready to do rendezvous even if -- not aborted. It might also be ready to do rendezvous even if
-- this wakes up due to an abortion. -- this wakes up due to an abort. Therefore, if the call is not
-- Therefore, if the call is not empty we need to do the -- empty we need to do the rendezvous if the accept body is not
-- rendezvous if the accept body is not Null_Body. -- Null_Body.
-- Aren't the first two conditions below redundant??? -- Aren't the first two conditions below redundant???
...@@ -949,7 +951,7 @@ package body System.Tasking.Rendezvous is ...@@ -949,7 +951,7 @@ package body System.Tasking.Rendezvous is
Self_Id.Open_Accepts := Open_Accepts; Self_Id.Open_Accepts := Open_Accepts;
Self_Id.Common.State := Acceptor_Sleep; Self_Id.Common.State := Acceptor_Sleep;
-- Notify ancestors that this task is on a terminate alternative. -- Notify ancestors that this task is on a terminate alternative
STPO.Unlock (Self_Id); STPO.Unlock (Self_Id);
Utilities.Make_Passive (Self_Id, Task_Completed => False); Utilities.Make_Passive (Self_Id, Task_Completed => False);
...@@ -1154,7 +1156,7 @@ package body System.Tasking.Rendezvous is ...@@ -1154,7 +1156,7 @@ package body System.Tasking.Rendezvous is
STPO.Write_Lock (Acceptor); STPO.Write_Lock (Acceptor);
-- If the acceptor is not callable, abort the call and return False. -- If the acceptor is not callable, abort the call and return False
if not Acceptor.Callable then if not Acceptor.Callable then
STPO.Unlock (Acceptor); STPO.Unlock (Acceptor);
...@@ -1176,35 +1178,35 @@ package body System.Tasking.Rendezvous is ...@@ -1176,35 +1178,35 @@ package body System.Tasking.Rendezvous is
return False; return False;
end if; end if;
-- Try to serve the call immediately. -- Try to serve the call immediately
if Acceptor.Open_Accepts /= null then if Acceptor.Open_Accepts /= null then
for J in Acceptor.Open_Accepts'Range loop for J in Acceptor.Open_Accepts'Range loop
if Entry_Call.E = Entry_Index (Acceptor.Open_Accepts (J).S) then if Entry_Call.E = Entry_Index (Acceptor.Open_Accepts (J).S) then
-- Commit acceptor to rendezvous with us. -- Commit acceptor to rendezvous with us
Acceptor.Chosen_Index := J; Acceptor.Chosen_Index := J;
Null_Body := Acceptor.Open_Accepts (J).Null_Body; Null_Body := Acceptor.Open_Accepts (J).Null_Body;
Acceptor.Open_Accepts := null; Acceptor.Open_Accepts := null;
-- Prevent abort while call is being served. -- Prevent abort while call is being served
if Entry_Call.State = Now_Abortable then if Entry_Call.State = Now_Abortable then
Entry_Call.State := Was_Abortable; Entry_Call.State := Was_Abortable;
end if; end if;
if Acceptor.Terminate_Alternative then if Acceptor.Terminate_Alternative then
-- Cancel terminate alternative.
-- See matching code in Selective_Wait and -- Cancel terminate alternative. See matching code in
-- Vulnerable_Complete_Master. -- Selective_Wait and Vulnerable_Complete_Master.
Acceptor.Terminate_Alternative := False; Acceptor.Terminate_Alternative := False;
Acceptor.Awake_Count := Acceptor.Awake_Count + 1; Acceptor.Awake_Count := Acceptor.Awake_Count + 1;
if Acceptor.Awake_Count = 1 then if Acceptor.Awake_Count = 1 then
-- Notify parent that acceptor is awake. -- Notify parent that acceptor is awake
pragma Assert (Parent.Awake_Count > 0); pragma Assert (Parent.Awake_Count > 0);
...@@ -1220,7 +1222,8 @@ package body System.Tasking.Rendezvous is ...@@ -1220,7 +1222,8 @@ package body System.Tasking.Rendezvous is
end if; end if;
if Null_Body then if Null_Body then
-- Rendezvous is over immediately.
-- Rendezvous is over immediately
STPO.Wakeup (Acceptor, Acceptor_Sleep); STPO.Wakeup (Acceptor, Acceptor_Sleep);
STPO.Unlock (Acceptor); STPO.Unlock (Acceptor);
...@@ -1237,8 +1240,8 @@ package body System.Tasking.Rendezvous is ...@@ -1237,8 +1240,8 @@ package body System.Tasking.Rendezvous is
else else
Setup_For_Rendezvous_With_Body (Entry_Call, Acceptor); Setup_For_Rendezvous_With_Body (Entry_Call, Acceptor);
-- For terminate_alternative, acceptor may not be -- For terminate_alternative, acceptor may not be asleep
-- asleep yet, so we skip the wakeup -- yet, so we skip the wakeup
if Acceptor.Common.State /= Runnable then if Acceptor.Common.State /= Runnable then
STPO.Wakeup (Acceptor, Acceptor_Sleep); STPO.Wakeup (Acceptor, Acceptor_Sleep);
...@@ -1255,7 +1258,7 @@ package body System.Tasking.Rendezvous is ...@@ -1255,7 +1258,7 @@ package body System.Tasking.Rendezvous is
end if; end if;
end loop; end loop;
-- The acceptor is accepting, but not this entry. -- The acceptor is accepting, but not this entry
end if; end if;
-- If the acceptor was ready to accept this call, -- If the acceptor was ready to accept this call,
...@@ -1360,11 +1363,11 @@ package body System.Tasking.Rendezvous is ...@@ -1360,11 +1363,11 @@ package body System.Tasking.Rendezvous is
else else
-- This is an asynchronous call -- This is an asynchronous call
-- Abortion must already be deferred by the compiler-generated -- Abort must already be deferred by the compiler-generated code.
-- code. Without this, an abortion that occurs between the time -- Without this, an abort that occurs between the time that this
-- that this call is made and the time that the abortable part's -- call is made and the time that the abortable part's cleanup
-- cleanup handler is set up might miss the cleanup handler and -- handler is set up might miss the cleanup handler and leave the
-- leave the call pending. -- call pending.
Self_Id.ATC_Nesting_Level := Self_Id.ATC_Nesting_Level + 1; Self_Id.ATC_Nesting_Level := Self_Id.ATC_Nesting_Level + 1;
pragma Debug pragma Debug
...@@ -1421,7 +1424,7 @@ package body System.Tasking.Rendezvous is ...@@ -1421,7 +1424,7 @@ package body System.Tasking.Rendezvous is
Unlock_RTS; Unlock_RTS;
end if; end if;
-- Note: following assignment needs to be atomic. -- Note: following assignment needs to be atomic
Rendezvous_Successful := Entry_Call.State = Done; Rendezvous_Successful := Entry_Call.State = Done;
end if; end if;
...@@ -1506,7 +1509,7 @@ package body System.Tasking.Rendezvous is ...@@ -1506,7 +1509,7 @@ package body System.Tasking.Rendezvous is
Queuing.Select_Task_Entry_Call Queuing.Select_Task_Entry_Call
(Self_Id, Open_Accepts, Entry_Call, Selection, Open_Alternative); (Self_Id, Open_Accepts, Entry_Call, Selection, Open_Alternative);
-- Determine the kind and disposition of the select. -- Determine the kind and disposition of the select
Treatment := Default_Treatment (Select_Mode); Treatment := Default_Treatment (Select_Mode);
Self_Id.Chosen_Index := No_Rendezvous; Self_Id.Chosen_Index := No_Rendezvous;
...@@ -1528,7 +1531,7 @@ package body System.Tasking.Rendezvous is ...@@ -1528,7 +1531,7 @@ package body System.Tasking.Rendezvous is
end if; end if;
end if; end if;
-- Handle the select according to the disposition selected above. -- Handle the select according to the disposition selected above
case Treatment is case Treatment is
when Accept_Alternative_Selected => when Accept_Alternative_Selected =>
...@@ -1555,7 +1558,8 @@ package body System.Tasking.Rendezvous is ...@@ -1555,7 +1558,8 @@ package body System.Tasking.Rendezvous is
STPO.Unlock (Caller); STPO.Unlock (Caller);
when Accept_Alternative_Open => when Accept_Alternative_Open =>
-- Wait for caller.
-- Wait for caller
Self_Id.Open_Accepts := Open_Accepts; Self_Id.Open_Accepts := Open_Accepts;
...@@ -1563,9 +1567,8 @@ package body System.Tasking.Rendezvous is ...@@ -1563,9 +1567,8 @@ package body System.Tasking.Rendezvous is
-- Wakeup_Time is reached. -- Wakeup_Time is reached.
-- Try to remove calls to Sleep in the loop below by letting the -- Try to remove calls to Sleep in the loop below by letting the
-- caller a chance of getting ready immediately, using Unlock & -- caller a chance of getting ready immediately, using Unlock
-- Yield. -- Yield. See similar action in Wait_For_Completion/Wait_For_Call.
-- See similar action in Wait_For_Completion & Wait_For_Call.
if Single_Lock then if Single_Lock then
Unlock_RTS; Unlock_RTS;
...@@ -1622,9 +1625,9 @@ package body System.Tasking.Rendezvous is ...@@ -1622,9 +1625,9 @@ package body System.Tasking.Rendezvous is
-- Self_Id.Common.Call should already be updated by the Caller if -- Self_Id.Common.Call should already be updated by the Caller if
-- not aborted. It might also be ready to do rendezvous even if -- not aborted. It might also be ready to do rendezvous even if
-- this wakes up due to an abortion. -- this wakes up due to an abort. Therefore, if the call is not
-- Therefore, if the call is not empty we need to do the -- empty we need to do the rendezvous if the accept body is not
-- rendezvous if the accept body is not Null_Body. -- Null_Body.
if Self_Id.Chosen_Index /= No_Rendezvous if Self_Id.Chosen_Index /= No_Rendezvous
and then Self_Id.Common.Call /= null and then Self_Id.Common.Call /= null
...@@ -1648,7 +1651,7 @@ package body System.Tasking.Rendezvous is ...@@ -1648,7 +1651,7 @@ package body System.Tasking.Rendezvous is
-- for several reasons: -- for several reasons:
-- 1) Delay is expired -- 1) Delay is expired
-- 2) Pending_Action needs to be checked -- 2) Pending_Action needs to be checked
-- (Abortion, Priority change) -- (Abort, Priority change)
-- 3) Spurious wakeup -- 3) Spurious wakeup
Self_Id.Open_Accepts := null; Self_Id.Open_Accepts := null;
...@@ -1753,7 +1756,7 @@ package body System.Tasking.Rendezvous is ...@@ -1753,7 +1756,7 @@ package body System.Tasking.Rendezvous is
Entry_Call.Called_PO := Null_Address; Entry_Call.Called_PO := Null_Address;
Entry_Call.Exception_To_Raise := Ada.Exceptions.Null_Id; Entry_Call.Exception_To_Raise := Ada.Exceptions.Null_Id;
-- Note: the caller will undefer abortion on return (see WARNING above) -- Note: the caller will undefer abort on return (see WARNING above)
if Single_Lock then if Single_Lock then
Lock_RTS; Lock_RTS;
...@@ -1820,7 +1823,7 @@ package body System.Tasking.Rendezvous is ...@@ -1820,7 +1823,7 @@ package body System.Tasking.Rendezvous is
Write_Lock (Self_Id); Write_Lock (Self_Id);
end if; end if;
-- Check if this task has been aborted while the lock was released. -- Check if this task has been aborted while the lock was released
if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then
Self_Id.Open_Accepts := null; Self_Id.Open_Accepts := null;
......
...@@ -36,24 +36,24 @@ pragma Polling (Off); ...@@ -36,24 +36,24 @@ pragma Polling (Off);
-- tasking operations. It causes infinite loops and other problems. -- tasking operations. It causes infinite loops and other problems.
with Ada.Exceptions; with Ada.Exceptions;
-- used for Raise_Exception -- Used for Raise_Exception
with System.Tasking.Debug; with System.Tasking.Debug;
-- used for enabling tasking facilities with gdb -- Used for enabling tasking facilities with gdb
with System.Address_Image; with System.Address_Image;
-- used for the function itself. -- Used for the function itself
with System.Parameters; with System.Parameters;
-- used for Size_Type -- Used for Size_Type
-- Single_Lock -- Single_Lock
-- Runtime_Traces -- Runtime_Traces
with System.Task_Info; with System.Task_Info;
-- used for Task_Info_Type -- Used for Task_Info_Type
with System.Task_Primitives.Operations; with System.Task_Primitives.Operations;
-- used for Finalize_Lock -- Used for Finalize_Lock
-- Enter_Task -- Enter_Task
-- Write_Lock -- Write_Lock
-- Unlock -- Unlock
...@@ -64,11 +64,11 @@ with System.Task_Primitives.Operations; ...@@ -64,11 +64,11 @@ with System.Task_Primitives.Operations;
-- New_ATCB -- New_ATCB
with System.Soft_Links; with System.Soft_Links;
-- These are procedure pointers to non-tasking routines that use -- These are procedure pointers to non-tasking routines that use task
-- task specific data. In the absence of tasking, these routines -- specific data. In the absence of tasking, these routines refer to global
-- refer to global data. In the presense of tasking, they must be -- data. In the presense of tasking, they must be replaced with pointers to
-- replaced with pointers to task-specific versions. -- task-specific versions. Also used for Create_TSD, Destroy_TSD,
-- Also used for Create_TSD, Destroy_TSD, Get_Current_Excep -- Get_Current_Excep
with System.Tasking.Initialization; with System.Tasking.Initialization;
-- Used for Remove_From_All_Tasks_List -- Used for Remove_From_All_Tasks_List
...@@ -79,7 +79,7 @@ with System.Tasking.Initialization; ...@@ -79,7 +79,7 @@ with System.Tasking.Initialization;
-- Initialize_Attributes_Link -- Initialize_Attributes_Link
pragma Elaborate_All (System.Tasking.Initialization); pragma Elaborate_All (System.Tasking.Initialization);
-- This insures that tasking is initialized if any tasks are created. -- This insures that tasking is initialized if any tasks are created
with System.Tasking.Utilities; with System.Tasking.Utilities;
-- Used for Make_Passive -- Used for Make_Passive
...@@ -98,22 +98,22 @@ with System.Finalization_Implementation; ...@@ -98,22 +98,22 @@ with System.Finalization_Implementation;
-- Used for System.Finalization_Implementation.Finalize_Global_List -- Used for System.Finalization_Implementation.Finalize_Global_List
with System.Secondary_Stack; with System.Secondary_Stack;
-- used for SS_Init -- Used for SS_Init
with System.Storage_Elements; with System.Storage_Elements;
-- used for Storage_Array -- Used for Storage_Array
with System.Restrictions; with System.Restrictions;
-- used for Abort_Allowed -- Used for Abort_Allowed
with System.Standard_Library; with System.Standard_Library;
-- used for Exception_Trace -- Used for Exception_Trace
with System.Traces.Tasking; with System.Traces.Tasking;
-- used for Send_Trace_Info -- Used for Send_Trace_Info
with Unchecked_Deallocation; with Unchecked_Deallocation;
-- To recover from failure of ATCB initialization. -- To recover from failure of ATCB initialization
package body System.Tasking.Stages is package body System.Tasking.Stages is
...@@ -787,11 +787,11 @@ package body System.Tasking.Stages is ...@@ -787,11 +787,11 @@ package body System.Tasking.Stages is
Self_ID.Callable := False; Self_ID.Callable := False;
-- Exit level 2 master, for normal tasks in library-level packages. -- Exit level 2 master, for normal tasks in library-level packages
Complete_Master; Complete_Master;
-- Force termination of "independent" library-level server tasks. -- Force termination of "independent" library-level server tasks
Lock_RTS; Lock_RTS;
...@@ -977,7 +977,7 @@ package body System.Tasking.Stages is ...@@ -977,7 +977,7 @@ package body System.Tasking.Stages is
-- clean ups associated with the exception handler that need to -- clean ups associated with the exception handler that need to
-- access task specific data. -- access task specific data.
-- Defer abortion so that this task can't be aborted while exiting -- Defer abort so that this task can't be aborted while exiting
when Standard'Abort_Signal => when Standard'Abort_Signal =>
Initialization.Defer_Abort_Nestable (Self_ID); Initialization.Defer_Abort_Nestable (Self_ID);
...@@ -1209,7 +1209,7 @@ package body System.Tasking.Stages is ...@@ -1209,7 +1209,7 @@ package body System.Tasking.Stages is
-- The activator raises a Tasking_Error if any task it is activating -- The activator raises a Tasking_Error if any task it is activating
-- is completed before the activation is done. However, if the reason -- is completed before the activation is done. However, if the reason
-- for the task completion is an abortion, we do not raise an exception. -- for the task completion is an abort, we do not raise an exception.
-- See RM 9.2(5). -- See RM 9.2(5).
if not Self_ID.Callable and then Self_ID.Pending_ATC_Level /= 0 then if not Self_ID.Callable and then Self_ID.Pending_ATC_Level /= 0 then
...@@ -1392,7 +1392,7 @@ package body System.Tasking.Stages is ...@@ -1392,7 +1392,7 @@ package body System.Tasking.Stages is
pragma Assert (Self_ID.Common.Wait_Count = 0); pragma Assert (Self_ID.Common.Wait_Count = 0);
-- Force any remaining dependents to terminate, by aborting them. -- Force any remaining dependents to terminate by aborting them
if not Single_Lock then if not Single_Lock then
Lock_RTS; Lock_RTS;
...@@ -1461,8 +1461,8 @@ package body System.Tasking.Stages is ...@@ -1461,8 +1461,8 @@ package body System.Tasking.Stages is
Unlock (Self_ID); Unlock (Self_ID);
end if; end if;
-- We don't wake up for abortion here. We are already terminating -- We don't wake up for abort here. We are already terminating just as
-- just as fast as we can, so there is no point. -- fast as we can, so there is no point.
-- Remove terminated tasks from the list of Self_ID's dependents, but -- Remove terminated tasks from the list of Self_ID's dependents, but
-- don't free their ATCBs yet, because of lock order restrictions, -- don't free their ATCBs yet, because of lock order restrictions,
...@@ -1687,7 +1687,7 @@ package body System.Tasking.Stages is ...@@ -1687,7 +1687,7 @@ package body System.Tasking.Stages is
-- Package elaboration code -- Package elaboration code
begin begin
-- Establish the Adafinal softlink. -- Establish the Adafinal softlink
-- This is not done inside the central RTS initialization routine -- This is not done inside the central RTS initialization routine
-- to avoid with-ing this package from System.Tasking.Initialization. -- to avoid with-ing this package from System.Tasking.Initialization.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -121,9 +121,9 @@ package System.Tasking.Stages is ...@@ -121,9 +121,9 @@ package System.Tasking.Stages is
-- activate_tasks (_chain'unchecked_access); -- activate_tasks (_chain'unchecked_access);
procedure Abort_Tasks (Tasks : Task_List); procedure Abort_Tasks (Tasks : Task_List);
-- Compiler interface only. Do not call from within the RTS. -- Compiler interface only. Do not call from within the RTS. Initiate
-- Initiate abortion, however, the actual abortion is done by abortee by -- abort, however, the actual abort is done by abortee by means of
-- means of Abort_Handler and Abort_Undefer -- Abort_Handler and Abort_Undefer
-- --
-- source code: -- source code:
-- Abort T1, T2; -- Abort T1, T2;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -72,9 +72,9 @@ package System.Tasking.Utilities is ...@@ -72,9 +72,9 @@ package System.Tasking.Utilities is
-- the environment task (because every independent task depends on it), -- the environment task (because every independent task depends on it),
-- this counter is protected by the environment task's lock. -- this counter is protected by the environment task's lock.
------------------------------------ ---------------------------------
-- Task Abortion related routines -- -- Task Abort Related Routines --
------------------------------------ ---------------------------------
procedure Cancel_Queued_Entry_Calls (T : Task_Id); procedure Cancel_Queued_Entry_Calls (T : Task_Id);
-- Cancel any entry calls queued on target task. -- Cancel any entry calls queued on target task.
...@@ -93,13 +93,13 @@ package System.Tasking.Utilities is ...@@ -93,13 +93,13 @@ package System.Tasking.Utilities is
-- (3) always aborts whole task -- (3) always aborts whole task
procedure Abort_Tasks (Tasks : Task_List); procedure Abort_Tasks (Tasks : Task_List);
-- Abort_Tasks is called to initiate abortion, however, the actual -- Abort_Tasks is called to initiate abort, however, the actual
-- abortion is done by abortee by means of Abort_Handler -- aborti is done by aborted task by means of Abort_Handler
procedure Make_Passive (Self_ID : Task_Id; Task_Completed : Boolean); procedure Make_Passive (Self_ID : Task_Id; Task_Completed : Boolean);
-- Update counts to indicate current task is either terminated -- Update counts to indicate current task is either terminated or
-- or accepting on a terminate alternative. -- accepting on a terminate alternative. Call holding no locks except
-- Call holding no locks except Global_Task_Lock when calling from -- Global_Task_Lock when calling from Terminate_Task, and RTS_Lock when
-- Terminate_Task, and RTS_Lock when Single_Lock is True. -- Single_Lock is True.
end System.Tasking.Utilities; end System.Tasking.Utilities;
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2004, Ada Core Technologies -- -- Copyright (C) 1995-2005, Ada Core Technologies --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This package provides support for the body of Ada.Task_Attributes. -- This package provides support for the body of Ada.Task_Attributes
with Ada.Finalization; with Ada.Finalization;
-- used for Limited_Controlled -- Used for Limited_Controlled
with System.Storage_Elements; with System.Storage_Elements;
-- used for Integer_Address -- Used for Integer_Address
package System.Tasking.Task_Attributes is package System.Tasking.Task_Attributes is
...@@ -52,8 +52,8 @@ package System.Tasking.Task_Attributes is ...@@ -52,8 +52,8 @@ package System.Tasking.Task_Attributes is
function To_Access_Node is new Unchecked_Conversion function To_Access_Node is new Unchecked_Conversion
(Access_Address, Access_Node); (Access_Address, Access_Node);
-- Used to fetch pointer to indirect attribute list. Declaration is -- Used to fetch pointer to indirect attribute list. Declaration is in
-- in spec to avoid any problems with aliasing assumptions. -- spec to avoid any problems with aliasing assumptions.
type Dummy_Wrapper; type Dummy_Wrapper;
type Access_Dummy_Wrapper is access all Dummy_Wrapper; type Access_Dummy_Wrapper is access all Dummy_Wrapper;
...@@ -67,7 +67,7 @@ package System.Tasking.Task_Attributes is ...@@ -67,7 +67,7 @@ package System.Tasking.Task_Attributes is
-- of type Wrapper, no Dummy_Wrapper objects are ever created. -- of type Wrapper, no Dummy_Wrapper objects are ever created.
type Deallocator is access procedure (P : in out Access_Node); type Deallocator is access procedure (P : in out Access_Node);
-- Called to deallocate an Wrapper. P is a pointer to a Node within. -- Called to deallocate an Wrapper. P is a pointer to a Node within
type Instance; type Instance;
...@@ -78,11 +78,11 @@ package System.Tasking.Task_Attributes is ...@@ -78,11 +78,11 @@ package System.Tasking.Task_Attributes is
Initial_Value : aliased System.Storage_Elements.Integer_Address; Initial_Value : aliased System.Storage_Elements.Integer_Address;
Index : Direct_Index; Index : Direct_Index;
-- The index of the TCB location used by this instantiation, -- The index of the TCB location used by this instantiation, if it is
-- if it is stored in the TCB, otherwise zero. -- stored in the TCB, otherwise zero.
Next : Access_Instance; Next : Access_Instance;
-- Next instance in All_Attributes list. -- Next instance in All_Attributes list
end record; end record;
procedure Finalize (X : in out Instance); procedure Finalize (X : in out Instance);
...@@ -93,12 +93,11 @@ package System.Tasking.Task_Attributes is ...@@ -93,12 +93,11 @@ package System.Tasking.Task_Attributes is
Next : Access_Node; Next : Access_Node;
end record; end record;
-- The following type is a stand-in for the actual -- The following type is a stand-in for the actual wrapper type, which is
-- wrapper type, which is different for each instantiation -- different for each instantiation of Ada.Task_Attributes.
-- of Ada.Task_Attributes.
type Dummy_Wrapper is record type Dummy_Wrapper is record
Noed : aliased Node; Dummy_Node : aliased Node;
Value : aliased Attribute; Value : aliased Attribute;
-- The generic formal type, may be controlled -- The generic formal type, may be controlled
...@@ -110,23 +109,23 @@ package System.Tasking.Task_Attributes is ...@@ -110,23 +109,23 @@ package System.Tasking.Task_Attributes is
-- Ensure that the designated object is always strictly enough aligned. -- Ensure that the designated object is always strictly enough aligned.
In_Use : Direct_Index_Vector := 0; In_Use : Direct_Index_Vector := 0;
-- is True for direct indices that are already used. -- Set True for direct indices that are already used (True??? type???)
All_Attributes : Access_Instance; All_Attributes : Access_Instance;
-- A linked list of all indirectly access attributes, -- A linked list of all indirectly access attributes, which includes all
-- which includes all those that require finalization. -- those that require finalization.
procedure Initialize_Attributes (T : Task_Id); procedure Initialize_Attributes (T : Task_Id);
-- Initialize all attributes created via Ada.Task_Attributes for T. -- Initialize all attributes created via Ada.Task_Attributes for T. This
-- This must be called by the creator of the task, inside Create_Task, -- must be called by the creator of the task, inside Create_Task, via
-- via soft-link Initialize_Attributes_Link. On entry, abortion must -- soft-link Initialize_Attributes_Link. On entry, abort must be deferred
-- be deferred and the caller must hold no locks -- and the caller must hold no locks
procedure Finalize_Attributes (T : Task_Id); procedure Finalize_Attributes (T : Task_Id);
-- Finalize all attributes created via Ada.Task_Attributes for T. -- Finalize all attributes created via Ada.Task_Attributes for T.
-- This is to be called by the task after it is marked as terminated -- This is to be called by the task after it is marked as terminated
-- (and before it actually dies), inside Vulnerable_Free_Task, via the -- (and before it actually dies), inside Vulnerable_Free_Task, via the
-- soft-link Finalize_Attributes_Link. On entry, abortion must be deferred -- soft-link Finalize_Attributes_Link. On entry, abort must be deferred
-- and T.L must be write-locked. -- and T.L must be write-locked.
end System.Tasking.Task_Attributes; end System.Tasking.Task_Attributes;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1998-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,39 +31,40 @@ ...@@ -31,39 +31,40 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This package contains all the simple primitives related to -- This package contains all the simple primitives related to protected
-- Protected_Objects with entries (i.e init, lock, unlock). -- objects with entries (i.e init, lock, unlock).
-- The handling of protected objects with no entries is done in -- The handling of protected objects with no entries is done in
-- System.Tasking.Protected_Objects, the complex routines for protected -- System.Tasking.Protected_Objects, the complex routines for protected
-- objects with entries in System.Tasking.Protected_Objects.Operations. -- objects with entries in System.Tasking.Protected_Objects.Operations.
-- The split between Entries and Operations is needed to break circular -- The split between Entries and Operations is needed to break circular
-- dependencies inside the run time. -- dependencies inside the run time.
-- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Note: the compiler generates direct calls to this interface, via Rtsfind
with Ada.Exceptions; with Ada.Exceptions;
-- used for Exception_Occurrence_Access -- Used for Exception_Occurrence_Access
-- Raise_Exception -- Raise_Exception
with System.Task_Primitives.Operations; with System.Task_Primitives.Operations;
-- used for Initialize_Lock -- Used for Initialize_Lock
-- Write_Lock -- Write_Lock
-- Unlock -- Unlock
-- Get_Priority -- Get_Priority
-- Wakeup -- Wakeup
with System.Tasking.Initialization; with System.Tasking.Initialization;
-- used for Defer_Abort, -- Used for Defer_Abort,
-- Undefer_Abort, -- Undefer_Abort,
-- Change_Base_Priority -- Change_Base_Priority
pragma Elaborate_All (System.Tasking.Initialization); pragma Elaborate_All (System.Tasking.Initialization);
-- this insures that tasking is initialized if any protected objects are -- This insures that tasking is initialized if any protected objects are
-- created. -- created.
with System.Parameters; with System.Parameters;
-- used for Single_Lock -- Used for Single_Lock
package body System.Tasking.Protected_Objects.Entries is package body System.Tasking.Protected_Objects.Entries is
...@@ -103,8 +104,9 @@ package body System.Tasking.Protected_Objects.Entries is ...@@ -103,8 +104,9 @@ package body System.Tasking.Protected_Objects.Entries is
end if; end if;
if Ceiling_Violation then if Ceiling_Violation then
-- Dip our own priority down to ceiling of lock.
-- See similar code in Tasking.Entry_Calls.Lock_Server. -- Dip our own priority down to ceiling of lock. See similar code in
-- Tasking.Entry_Calls.Lock_Server.
STPO.Write_Lock (Self_ID); STPO.Write_Lock (Self_ID);
Old_Base_Priority := Self_ID.Common.Base_Priority; Old_Base_Priority := Self_ID.Common.Base_Priority;
...@@ -130,7 +132,7 @@ package body System.Tasking.Protected_Objects.Entries is ...@@ -130,7 +132,7 @@ package body System.Tasking.Protected_Objects.Entries is
Object.Pending_Action := True; Object.Pending_Action := True;
end if; end if;
-- Send program_error to all tasks still queued on this object. -- Send program_error to all tasks still queued on this object
for E in Object.Entry_Queues'Range loop for E in Object.Entry_Queues'Range loop
Entry_Call := Object.Entry_Queues (E).Head; Entry_Call := Object.Entry_Queues (E).Head;
...@@ -229,10 +231,10 @@ package body System.Tasking.Protected_Objects.Entries is ...@@ -229,10 +231,10 @@ package body System.Tasking.Protected_Objects.Entries is
(Program_Error'Identity, "Protected Object is finalized"); (Program_Error'Identity, "Protected Object is finalized");
end if; end if;
-- If pragma Detect_Blocking is active then Program_Error must -- If pragma Detect_Blocking is active then Program_Error must be
-- be raised if this potentially blocking operation is called from -- raised if this potentially blocking operation is called from a
-- a protected action, and the protected object nesting level -- protected action, and the protected object nesting level must be
-- must be increased. -- increased.
if Detect_Blocking then if Detect_Blocking then
declare declare
...@@ -242,8 +244,8 @@ package body System.Tasking.Protected_Objects.Entries is ...@@ -242,8 +244,8 @@ package body System.Tasking.Protected_Objects.Entries is
Ada.Exceptions.Raise_Exception Ada.Exceptions.Raise_Exception
(Program_Error'Identity, "potentially blocking operation"); (Program_Error'Identity, "potentially blocking operation");
else else
-- We are entering in a protected action, so that we -- We are entering in a protected action, so that we increase
-- increase the protected object nesting level. -- the protected object nesting level.
Self_Id.Common.Protected_Action_Nesting := Self_Id.Common.Protected_Action_Nesting :=
Self_Id.Common.Protected_Action_Nesting + 1; Self_Id.Common.Protected_Action_Nesting + 1;
...@@ -251,15 +253,15 @@ package body System.Tasking.Protected_Objects.Entries is ...@@ -251,15 +253,15 @@ package body System.Tasking.Protected_Objects.Entries is
end; end;
end if; end if;
-- The lock is made without defering abortion. -- The lock is made without defering abort
-- Therefore the abortion has to be deferred before calling this -- Therefore the abort has to be deferred before calling this routine.
-- routine. This means that the compiler has to generate a Defer_Abort -- This means that the compiler has to generate a Defer_Abort call
-- call before the call to Lock. -- before the call to Lock.
-- The caller is responsible for undeferring abortion, and compiler -- The caller is responsible for undeferring abort, and compiler
-- generated calls must be protected with cleanup handlers to ensure -- generated calls must be protected with cleanup handlers to ensure
-- that abortion is undeferred in all cases. -- that abort is undeferred in all cases.
pragma Assert (STPO.Self.Deferral_Level > 0); pragma Assert (STPO.Self.Deferral_Level > 0);
Write_Lock (Object.L'Access, Ceiling_Violation); Write_Lock (Object.L'Access, Ceiling_Violation);
...@@ -302,8 +304,8 @@ package body System.Tasking.Protected_Objects.Entries is ...@@ -302,8 +304,8 @@ package body System.Tasking.Protected_Objects.Entries is
Ada.Exceptions.Raise_Exception Ada.Exceptions.Raise_Exception
(Program_Error'Identity, "potentially blocking operation"); (Program_Error'Identity, "potentially blocking operation");
else else
-- We are entering in a protected action, so that we -- We are entering in a protected action, so that we increase
-- increase the protected object nesting level. -- the protected object nesting level.
Self_Id.Common.Protected_Action_Nesting := Self_Id.Common.Protected_Action_Nesting :=
Self_Id.Common.Protected_Action_Nesting + 1; Self_Id.Common.Protected_Action_Nesting + 1;
......
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
-- -- -- --
-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- -- -- --
-- S Y S T E M . T A S K I N G . P R O T E C T E D _ O B J E C T S . -- -- SYSTEM.TASKING.PROTECTED_OBJECTS.OPERATIONS --
-- O P E R A T I O N S --
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -32,19 +31,20 @@ ...@@ -32,19 +31,20 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This package contains all the extended primitives related to -- This package contains all the extended primitives related to protected
-- Protected_Objects with entries. -- objects with entries.
-- The handling of protected objects with no entries is done in -- The handling of protected objects with no entries is done in
-- System.Tasking.Protected_Objects, the simple routines for protected -- System.Tasking.Protected_Objects, the simple routines for protected
-- objects with entries in System.Tasking.Protected_Objects.Entries. -- objects with entries in System.Tasking.Protected_Objects.Entries. The
-- The split between Entries and Operations is needed to break circular -- split between Entries and Operations is needed to break circular
-- dependencies inside the run time. -- dependencies inside the run time.
-- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes. -- Any changes to this interface may require corresponding compiler changes.
with Ada.Exceptions; with Ada.Exceptions;
-- used for Exception_Id -- Used for Exception_Id
with System.Tasking.Protected_Objects.Entries; with System.Tasking.Protected_Objects.Entries;
...@@ -108,7 +108,7 @@ package System.Tasking.Protected_Objects.Operations is ...@@ -108,7 +108,7 @@ package System.Tasking.Protected_Objects.Operations is
-- barriers, so this routine keeps checking barriers until all of -- barriers, so this routine keeps checking barriers until all of
-- them are closed. -- them are closed.
-- --
-- This must be called with abortion deferred and with the corresponding -- This must be called with abort deferred and with the corresponding
-- object locked. -- object locked.
-- --
-- If Unlock_Object is set True, then Object is unlocked on return, -- If Unlock_Object is set True, then Object is unlocked on return,
...@@ -173,7 +173,7 @@ package System.Tasking.Protected_Objects.Operations is ...@@ -173,7 +173,7 @@ package System.Tasking.Protected_Objects.Operations is
(Object : Entries.Protection_Entries'Class; (Object : Entries.Protection_Entries'Class;
E : Protected_Entry_Index) E : Protected_Entry_Index)
return Natural; return Natural;
-- Return the number of entry calls to E on Object. -- Return the number of entry calls to E on Object
function Protected_Entry_Caller function Protected_Entry_Caller
(Object : Entries.Protection_Entries'Class) return Task_Id; (Object : Entries.Protection_Entries'Class) return Task_Id;
...@@ -181,7 +181,7 @@ package System.Tasking.Protected_Objects.Operations is ...@@ -181,7 +181,7 @@ package System.Tasking.Protected_Objects.Operations is
-- being handled. This will only work if called from within an entry -- being handled. This will only work if called from within an entry
-- body, as required by the LRM (C.7.1(14)). -- body, as required by the LRM (C.7.1(14)).
-- For internal use only: -- For internal use only
procedure PO_Do_Or_Queue procedure PO_Do_Or_Queue
(Self_ID : Task_Id; (Self_ID : Task_Id;
...@@ -189,7 +189,7 @@ package System.Tasking.Protected_Objects.Operations is ...@@ -189,7 +189,7 @@ package System.Tasking.Protected_Objects.Operations is
Entry_Call : Entry_Call_Link; Entry_Call : Entry_Call_Link;
With_Abort : Boolean); With_Abort : Boolean);
-- This procedure either executes or queues an entry call, depending -- This procedure either executes or queues an entry call, depending
-- on the status of the corresponding barrier. It assumes that abortion -- on the status of the corresponding barrier. It assumes that abort
-- is deferred and that the specified object is locked. -- is deferred and that the specified object is locked.
private private
...@@ -201,10 +201,9 @@ private ...@@ -201,10 +201,9 @@ private
pragma Volatile (Communication_Block); pragma Volatile (Communication_Block);
-- ????? -- ?????
-- The Communication_Block seems to be a relic. -- The Communication_Block seems to be a relic. At the moment, the
-- At the moment, the compiler seems to be generating -- compiler seems to be generating unnecessary conditional code based on
-- unnecessary conditional code based on this block. -- this block. See the code generated for async. select with task entry
-- See the code generated for async. select with task entry
-- call for another way of solving this. -- call for another way of solving this.
end System.Tasking.Protected_Objects.Operations; end System.Tasking.Protected_Objects.Operations;
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- -- -- --
-- GNAT COMPILER COMPONENTS -- -- GNAT COMPILER COMPONENTS --
-- -- -- --
-- S N A M E S -- -- S N A M E S --
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- -- -- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General -- -- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write -- -- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. -- -- MA 02111-1307, USA. --
-- -- -- --
-- As a special exception, if other files instantiate generics from this -- -- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, -- -- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be -- -- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not -- -- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be -- -- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. -- -- covered by the GNU Public License. --
-- -- -- --
-- GNAT was originally developed by the GNAT team at New York University. -- -- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. -- -- Extensive contributions were provided by Ada Core Technologies Inc. --
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Namet; use Namet; with Namet; use Namet;
with Table; with Table;
package body Snames is package body Snames is
-- Table used to record convention identifiers -- Table used to record convention identifiers
type Convention_Id_Entry is record type Convention_Id_Entry is record
Name : Name_Id; Name : Name_Id;
Convention : Convention_Id; Convention : Convention_Id;
end record; end record;
package Convention_Identifiers is new Table.Table ( package Convention_Identifiers is new Table.Table (
Table_Component_Type => Convention_Id_Entry, Table_Component_Type => Convention_Id_Entry,
Table_Index_Type => Int, Table_Index_Type => Int,
Table_Low_Bound => 1, Table_Low_Bound => 1,
Table_Initial => 50, Table_Initial => 50,
Table_Increment => 200, Table_Increment => 200,
Table_Name => "Name_Convention_Identifiers"); Table_Name => "Name_Convention_Identifiers");
-- Table of names to be set by Initialize. Each name is terminated by a -- Table of names to be set by Initialize. Each name is terminated by a
-- single #, and the end of the list is marked by a null entry, i.e. by -- single #, and the end of the list is marked by a null entry, i.e. by
-- two # marks in succession. Note that the table does not include the -- two # marks in succession. Note that the table does not include the
-- entries for a-z, since these are initialized by Namet itself. -- entries for a-z, since these are initialized by Namet itself.
Preset_Names : constant String := Preset_Names : constant String :=
"_parent#" & "_parent#" &
"_tag#" & "_tag#" &
"off#" & "off#" &
"space#" & "space#" &
"time#" & "time#" &
"_abort_signal#" & "_abort_signal#" &
"_alignment#" & "_alignment#" &
"_assign#" & "_assign#" &
"_atcb#" & "_atcb#" &
"_chain#" & "_chain#" &
"_clean#" & "_clean#" &
"_controller#" & "_controller#" &
"_entry_bodies#" & "_entry_bodies#" &
"_expunge#" & "_expunge#" &
"_final_list#" & "_final_list#" &
"_idepth#" & "_idepth#" &
"_init#" & "_init#" &
"_local_final_list#" & "_local_final_list#" &
"_master#" & "_master#" &
"_object#" & "_object#" &
"_priority#" & "_priority#" &
"_process_atsd#" & "_process_atsd#" &
"_secondary_stack#" & "_secondary_stack#" &
"_service#" & "_service#" &
"_size#" & "_size#" &
"_stack#" & "_stack#" &
"_tags#" & "_tags#" &
"_task#" & "_task#" &
"_task_id#" & "_task_id#" &
"_task_info#" & "_task_info#" &
"_task_name#" & "_task_name#" &
"_trace_sp#" & "_trace_sp#" &
"initialize#" & "initialize#" &
"adjust#" & "adjust#" &
"finalize#" & "finalize#" &
"next#" & "next#" &
"prev#" & "prev#" &
"_typecode#" & "_typecode#" &
"_from_any#" & "_from_any#" &
"_to_any#" & "_to_any#" &
"allocate#" & "allocate#" &
"deallocate#" & "deallocate#" &
"dereference#" & "dereference#" &
"decimal_io#" & "decimal_io#" &
"enumeration_io#" & "enumeration_io#" &
"fixed_io#" & "fixed_io#" &
"float_io#" & "float_io#" &
"integer_io#" & "integer_io#" &
"modular_io#" & "modular_io#" &
"const#" & "const#" &
"<error>#" & "<error>#" &
"go#" & "go#" &
"put#" & "put#" &
"put_line#" & "put_line#" &
"to#" & "to#" &
"finalization#" & "finalization#" &
"finalization_root#" & "finalization_root#" &
"interfaces#" & "interfaces#" &
"standard#" & "standard#" &
"system#" & "system#" &
"text_io#" & "text_io#" &
"wide_text_io#" & "wide_text_io#" &
"wide_wide_text_io#" & "wide_wide_text_io#" &
"no_dsa#" & "no_dsa#" &
"garlic_dsa#" & "garlic_dsa#" &
"polyorb_dsa#" & "polyorb_dsa#" &
"addr#" & "addr#" &
"async#" & "async#" &
"get_active_partition_id#" & "get_active_partition_id#" &
"get_rci_package_receiver#" & "get_rci_package_receiver#" &
"get_rci_package_ref#" & "get_rci_package_ref#" &
"origin#" & "origin#" &
"params#" & "params#" &
"partition#" & "partition#" &
"partition_interface#" & "partition_interface#" &
"ras#" & "ras#" &
"call#" & "call#" &
"rci_name#" & "rci_name#" &
"receiver#" & "receiver#" &
"result#" & "result#" &
"rpc#" & "rpc#" &
"subp_id#" & "subp_id#" &
"operation#" & "operation#" &
"argument#" & "argument#" &
"arg_modes#" & "arg_modes#" &
"handler#" & "handler#" &
"target#" & "target#" &
"req#" & "req#" &
"obj_typecode#" & "obj_typecode#" &
"stub#" & "stub#" &
"Oabs#" & "Oabs#" &
"Oand#" & "Oand#" &
"Omod#" & "Omod#" &
"Onot#" & "Onot#" &
"Oor#" & "Oor#" &
"Orem#" & "Orem#" &
"Oxor#" & "Oxor#" &
"Oeq#" & "Oeq#" &
"One#" & "One#" &
"Olt#" & "Olt#" &
"Ole#" & "Ole#" &
"Ogt#" & "Ogt#" &
"Oge#" & "Oge#" &
"Oadd#" & "Oadd#" &
"Osubtract#" & "Osubtract#" &
"Oconcat#" & "Oconcat#" &
"Omultiply#" & "Omultiply#" &
"Odivide#" & "Odivide#" &
"Oexpon#" & "Oexpon#" &
"ada_83#" & "ada_83#" &
"ada_95#" & "ada_95#" &
"ada_05#" & "ada_05#" &
"c_pass_by_copy#" & "c_pass_by_copy#" &
"compile_time_warning#" & "compile_time_warning#" &
"component_alignment#" & "component_alignment#" &
"convention_identifier#" & "convention_identifier#" &
"detect_blocking#" & "detect_blocking#" &
"discard_names#" & "discard_names#" &
"elaboration_checks#" & "elaboration_checks#" &
"eliminate#" & "eliminate#" &
"explicit_overriding#" & "explicit_overriding#" &
"extend_system#" & "extend_system#" &
"extensions_allowed#" & "extensions_allowed#" &
"external_name_casing#" & "external_name_casing#" &
"float_representation#" & "float_representation#" &
"initialize_scalars#" & "initialize_scalars#" &
"interrupt_state#" & "interrupt_state#" &
"license#" & "license#" &
"locking_policy#" & "locking_policy#" &
"long_float#" & "long_float#" &
"no_run_time#" & "no_run_time#" &
"no_strict_aliasing#" & "no_strict_aliasing#" &
"normalize_scalars#" & "normalize_scalars#" &
"polling#" & "polling#" &
"persistent_data#" & "persistent_data#" &
"persistent_object#" & "persistent_object#" &
"profile#" & "profile#" &
"profile_warnings#" & "profile_warnings#" &
"propagate_exceptions#" & "propagate_exceptions#" &
"queuing_policy#" & "queuing_policy#" &
"ravenscar#" & "ravenscar#" &
"restricted_run_time#" & "restricted_run_time#" &
"restrictions#" & "restrictions#" &
"restriction_warnings#" & "restriction_warnings#" &
"reviewable#" & "reviewable#" &
"source_file_name#" & "source_file_name#" &
"source_file_name_project#" & "source_file_name_project#" &
"style_checks#" & "style_checks#" &
"suppress#" & "suppress#" &
"suppress_exception_locations#" & "suppress_exception_locations#" &
"task_dispatching_policy#" & "task_dispatching_policy#" &
"universal_data#" & "universal_data#" &
"unsuppress#" & "unsuppress#" &
"use_vads_size#" & "use_vads_size#" &
"validity_checks#" & "validity_checks#" &
"warnings#" & "warnings#" &
"abort_defer#" & "abort_defer#" &
"all_calls_remote#" & "all_calls_remote#" &
"annotate#" & "annotate#" &
"assert#" & "assert#" &
"asynchronous#" & "asynchronous#" &
"atomic#" & "atomic#" &
"atomic_components#" & "atomic_components#" &
"attach_handler#" & "attach_handler#" &
"comment#" & "comment#" &
"common_object#" & "common_object#" &
"complex_representation#" & "complex_representation#" &
"controlled#" & "controlled#" &
"convention#" & "convention#" &
"cpp_class#" & "cpp_class#" &
"cpp_constructor#" & "cpp_constructor#" &
"cpp_virtual#" & "cpp_virtual#" &
"cpp_vtable#" & "cpp_vtable#" &
"debug#" & "debug#" &
"elaborate#" & "elaborate#" &
"elaborate_all#" & "elaborate_all#" &
"elaborate_body#" & "elaborate_body#" &
"export#" & "export#" &
"export_exception#" & "export_exception#" &
"export_function#" & "export_function#" &
"export_object#" & "export_object#" &
"export_procedure#" & "export_procedure#" &
"export_value#" & "export_value#" &
"export_valued_procedure#" & "export_valued_procedure#" &
"external#" & "external#" &
"finalize_storage_only#" & "finalize_storage_only#" &
"ident#" & "ident#" &
"import#" & "import#" &
"import_exception#" & "import_exception#" &
"import_function#" & "import_function#" &
"import_object#" & "import_object#" &
"import_procedure#" & "import_procedure#" &
"import_valued_procedure#" & "import_valued_procedure#" &
"inline#" & "inline#" &
"inline_always#" & "inline_always#" &
"inline_generic#" & "inline_generic#" &
"inspection_point#" & "inspection_point#" &
"interface_name#" & "interface_name#" &
"interrupt_handler#" & "interrupt_handler#" &
"interrupt_priority#" & "interrupt_priority#" &
"java_constructor#" & "java_constructor#" &
"java_interface#" & "java_interface#" &
"keep_names#" & "keep_names#" &
"link_with#" & "link_with#" &
"linker_alias#" & "linker_alias#" &
"linker_options#" & "linker_options#" &
"linker_section#" & "linker_section#" &
"list#" & "list#" &
"machine_attribute#" & "machine_attribute#" &
"main#" & "main#" &
"main_storage#" & "main_storage#" &
"memory_size#" & "memory_size#" &
"no_return#" & "no_return#" &
"obsolescent#" & "obsolescent#" &
"optimize#" & "optimize#" &
"optional_overriding#" & "optional_overriding#" &
"pack#" & "pack#" &
"page#" & "page#" &
"passive#" & "passive#" &
"preelaborate#" & "preelaborate#" &
"priority#" & "priority#" &
"psect_object#" & "psect_object#" &
"pure#" & "pure#" &
"pure_function#" & "pure_function#" &
"remote_call_interface#" & "remote_call_interface#" &
"remote_types#" & "remote_types#" &
"share_generic#" & "share_generic#" &
"shared#" & "shared#" &
"shared_passive#" & "shared_passive#" &
"source_reference#" & "source_reference#" &
"stream_convert#" & "stream_convert#" &
"subtitle#" & "subtitle#" &
"suppress_all#" & "suppress_all#" &
"suppress_debug_info#" & "suppress_debug_info#" &
"suppress_initialization#" & "suppress_initialization#" &
"system_name#" & "system_name#" &
"task_info#" & "task_info#" &
"task_name#" & "task_name#" &
"task_storage#" & "task_storage#" &
"thread_body#" & "thread_body#" &
"time_slice#" & "time_slice#" &
"title#" & "title#" &
"unchecked_union#" & "unchecked_union#" &
"unimplemented_unit#" & "unimplemented_unit#" &
"unreferenced#" & "unreferenced#" &
"unreserve_all_interrupts#" & "unreserve_all_interrupts#" &
"volatile#" & "volatile#" &
"volatile_components#" & "volatile_components#" &
"weak_external#" & "weak_external#" &
"ada#" & "ada#" &
"assembler#" & "assembler#" &
"cobol#" & "cobol#" &
"cpp#" & "cpp#" &
"fortran#" & "fortran#" &
"intrinsic#" & "intrinsic#" &
"java#" & "java#" &
"stdcall#" & "stdcall#" &
"stubbed#" & "stubbed#" &
"asm#" & "asm#" &
"assembly#" & "assembly#" &
"default#" & "default#" &
"dll#" & "dll#" &
"win32#" & "win32#" &
"as_is#" & "as_is#" &
"body_file_name#" & "body_file_name#" &
"boolean_entry_barriers#" & "boolean_entry_barriers#" &
"casing#" & "casing#" &
"code#" & "code#" &
"component#" & "component#" &
"component_size_4#" & "component_size_4#" &
"copy#" & "copy#" &
"d_float#" & "d_float#" &
"descriptor#" & "descriptor#" &
"dot_replacement#" & "dot_replacement#" &
"dynamic#" & "dynamic#" &
"entity#" & "entity#" &
"external_name#" & "external_name#" &
"first_optional_parameter#" & "first_optional_parameter#" &
"form#" & "form#" &
"g_float#" & "g_float#" &
"gcc#" & "gcc#" &
"gnat#" & "gnat#" &
"gpl#" & "gpl#" &
"ieee_float#" & "ieee_float#" &
"internal#" & "internal#" &
"link_name#" & "link_name#" &
"lowercase#" & "lowercase#" &
"max_entry_queue_depth#" & "max_entry_queue_depth#" &
"max_entry_queue_length#" & "max_entry_queue_length#" &
"max_size#" & "max_size#" &
"mechanism#" & "mechanism#" &
"mixedcase#" & "mixedcase#" &
"modified_gpl#" & "modified_gpl#" &
"name#" & "name#" &
"nca#" & "nca#" &
"no#" & "no#" &
"no_dependence#" & "no_dependence#" &
"no_dynamic_attachment#" & "no_dynamic_attachment#" &
"no_dynamic_interrupts#" & "no_dynamic_interrupts#" &
"no_requeue#" & "no_requeue#" &
"no_requeue_statements#" & "no_requeue_statements#" &
"no_task_attributes#" & "no_task_attributes#" &
"no_task_attributes_package#" & "no_task_attributes_package#" &
"on#" & "on#" &
"parameter_types#" & "parameter_types#" &
"reference#" & "reference#" &
"restricted#" & "restricted#" &
"result_mechanism#" & "result_mechanism#" &
"result_type#" & "result_type#" &
"runtime#" & "runtime#" &
"sb#" & "sb#" &
"secondary_stack_size#" & "secondary_stack_size#" &
"section#" & "section#" &
"semaphore#" & "semaphore#" &
"simple_barriers#" & "simple_barriers#" &
"spec_file_name#" & "spec_file_name#" &
"static#" & "static#" &
"stack_size#" & "stack_size#" &
"subunit_file_name#" & "subunit_file_name#" &
"task_stack_size_default#" & "task_stack_size_default#" &
"task_type#" & "task_type#" &
"time_slicing_enabled#" & "time_slicing_enabled#" &
"top_guard#" & "top_guard#" &
"uba#" & "uba#" &
"ubs#" & "ubs#" &
"ubsb#" & "ubsb#" &
"unit_name#" & "unit_name#" &
"unknown#" & "unknown#" &
"unrestricted#" & "unrestricted#" &
"uppercase#" & "uppercase#" &
"user#" & "user#" &
"vax_float#" & "vax_float#" &
"vms#" & "vms#" &
"working_storage#" & "working_storage#" &
"abort_signal#" & "abort_signal#" &
"access#" & "access#" &
"address#" & "address#" &
"address_size#" & "address_size#" &
"aft#" & "aft#" &
"alignment#" & "alignment#" &
"asm_input#" & "asm_input#" &
"asm_output#" & "asm_output#" &
"ast_entry#" & "ast_entry#" &
"bit#" & "bit#" &
"bit_order#" & "bit_order#" &
"bit_position#" & "bit_position#" &
"body_version#" & "body_version#" &
"callable#" & "callable#" &
"caller#" & "caller#" &
"code_address#" & "code_address#" &
"component_size#" & "component_size#" &
"compose#" & "compose#" &
"constrained#" & "constrained#" &
"count#" & "count#" &
"default_bit_order#" & "default_bit_order#" &
"definite#" & "definite#" &
"delta#" & "delta#" &
"denorm#" & "denorm#" &
"digits#" & "digits#" &
"elaborated#" & "elaborated#" &
"emax#" & "emax#" &
"enum_rep#" & "enum_rep#" &
"epsilon#" & "epsilon#" &
"exponent#" & "exponent#" &
"external_tag#" & "external_tag#" &
"first#" & "first#" &
"first_bit#" & "first_bit#" &
"fixed_value#" & "fixed_value#" &
"fore#" & "fore#" &
"has_access_values#" & "has_access_values#" &
"has_discriminants#" & "has_discriminants#" &
"identity#" & "identity#" &
"img#" & "img#" &
"integer_value#" & "integer_value#" &
"large#" & "large#" &
"last#" & "last#" &
"last_bit#" & "last_bit#" &
"leading_part#" & "leading_part#" &
"length#" & "length#" &
"machine_emax#" & "machine_emax#" &
"machine_emin#" & "machine_emin#" &
"machine_mantissa#" & "machine_mantissa#" &
"machine_overflows#" & "machine_overflows#" &
"machine_radix#" & "machine_radix#" &
"machine_rounds#" & "machine_rounds#" &
"machine_size#" & "machine_size#" &
"mantissa#" & "mantissa#" &
"max_size_in_storage_elements#" & "max_size_in_storage_elements#" &
"maximum_alignment#" & "maximum_alignment#" &
"mechanism_code#" & "mechanism_code#" &
"mod#" & "mod#" &
"model_emin#" & "model_emin#" &
"model_epsilon#" & "model_epsilon#" &
"model_mantissa#" & "model_mantissa#" &
"model_small#" & "model_small#" &
"modulus#" & "modulus#" &
"null_parameter#" & "null_parameter#" &
"object_size#" & "object_size#" &
"partition_id#" & "partition_id#" &
"passed_by_reference#" & "passed_by_reference#" &
"pool_address#" & "pool_address#" &
"pos#" & "pos#" &
"position#" & "position#" &
"range#" & "range#" &
"range_length#" & "range_length#" &
"round#" & "round#" &
"safe_emax#" & "safe_emax#" &
"safe_first#" & "safe_first#" &
"safe_large#" & "safe_large#" &
"safe_last#" & "safe_last#" &
"safe_small#" & "safe_small#" &
"scale#" & "scale#" &
"scaling#" & "scaling#" &
"signed_zeros#" & "signed_zeros#" &
"size#" & "size#" &
"small#" & "small#" &
"storage_size#" & "storage_size#" &
"storage_unit#" & "storage_unit#" &
"stream_size#" & "stream_size#" &
"tag#" & "tag#" &
"target_name#" & "target_name#" &
"terminated#" & "terminated#" &
"to_address#" & "to_address#" &
"type_class#" & "type_class#" &
"uet_address#" & "uet_address#" &
"unbiased_rounding#" & "unbiased_rounding#" &
"unchecked_access#" & "unchecked_access#" &
"unconstrained_array#" & "unconstrained_array#" &
"universal_literal_string#" & "universal_literal_string#" &
"unrestricted_access#" & "unrestricted_access#" &
"vads_size#" & "vads_size#" &
"val#" & "val#" &
"valid#" & "valid#" &
"value_size#" & "value_size#" &
"version#" & "version#" &
"wchar_t_size#" & "wchar_t_size#" &
"wide_wide_width#" & "wide_wide_width#" &
"wide_width#" & "wide_width#" &
"width#" & "width#" &
"word_size#" & "word_size#" &
"adjacent#" & "adjacent#" &
"ceiling#" & "ceiling#" &
"copy_sign#" & "copy_sign#" &
"floor#" & "floor#" &
"fraction#" & "fraction#" &
"image#" & "image#" &
"input#" & "input#" &
"machine#" & "machine#" &
"max#" & "max#" &
"min#" & "min#" &
"model#" & "model#" &
"pred#" & "pred#" &
"remainder#" & "remainder#" &
"rounding#" & "rounding#" &
"succ#" & "succ#" &
"truncation#" & "truncation#" &
"value#" & "value#" &
"wide_image#" & "wide_image#" &
"wide_wide_image#" & "wide_wide_image#" &
"wide_value#" & "wide_value#" &
"wide_wide_value#" & "wide_wide_value#" &
"output#" & "output#" &
"read#" & "read#" &
"write#" & "write#" &
"elab_body#" & "elab_body#" &
"elab_spec#" & "elab_spec#" &
"storage_pool#" & "storage_pool#" &
"base#" & "base#" &
"class#" & "class#" &
"ceiling_locking#" & "ceiling_locking#" &
"inheritance_locking#" & "inheritance_locking#" &
"fifo_queuing#" & "fifo_queuing#" &
"priority_queuing#" & "priority_queuing#" &
"fifo_within_priorities#" & "fifo_within_priorities#" &
"access_check#" & "access_check#" &
"accessibility_check#" & "accessibility_check#" &
"discriminant_check#" & "discriminant_check#" &
"division_check#" & "division_check#" &
"elaboration_check#" & "elaboration_check#" &
"index_check#" & "index_check#" &
"length_check#" & "length_check#" &
"overflow_check#" & "overflow_check#" &
"range_check#" & "range_check#" &
"storage_check#" & "storage_check#" &
"tag_check#" & "tag_check#" &
"all_checks#" & "all_checks#" &
"abort#" & "abort#" &
"abs#" & "abs#" &
"accept#" & "accept#" &
"and#" & "and#" &
"all#" & "all#" &
"array#" & "array#" &
"at#" & "at#" &
"begin#" & "begin#" &
"body#" & "body#" &
"case#" & "case#" &
"constant#" & "constant#" &
"declare#" & "declare#" &
"delay#" & "delay#" &
"do#" & "do#" &
"else#" & "else#" &
"elsif#" & "elsif#" &
"end#" & "end#" &
"entry#" & "entry#" &
"exception#" & "exception#" &
"exit#" & "exit#" &
"for#" & "for#" &
"function#" & "function#" &
"generic#" & "generic#" &
"goto#" & "goto#" &
"if#" & "if#" &
"in#" & "in#" &
"is#" & "is#" &
"limited#" & "limited#" &
"loop#" & "loop#" &
"new#" & "new#" &
"not#" & "not#" &
"null#" & "null#" &
"of#" & "of#" &
"or#" & "or#" &
"others#" & "others#" &
"out#" & "out#" &
"package#" & "package#" &
"pragma#" & "pragma#" &
"private#" & "private#" &
"procedure#" & "procedure#" &
"raise#" & "raise#" &
"record#" & "record#" &
"rem#" & "rem#" &
"renames#" & "renames#" &
"return#" & "return#" &
"reverse#" & "reverse#" &
"select#" & "select#" &
"separate#" & "separate#" &
"subtype#" & "subtype#" &
"task#" & "task#" &
"terminate#" & "terminate#" &
"then#" & "then#" &
"type#" & "type#" &
"use#" & "use#" &
"when#" & "when#" &
"while#" & "while#" &
"with#" & "with#" &
"xor#" & "xor#" &
"divide#" & "divide#" &
"enclosing_entity#" & "enclosing_entity#" &
"exception_information#" & "exception_information#" &
"exception_message#" & "exception_message#" &
"exception_name#" & "exception_name#" &
"file#" & "file#" &
"import_address#" & "import_address#" &
"import_largest_value#" & "import_largest_value#" &
"import_value#" & "import_value#" &
"is_negative#" & "is_negative#" &
"line#" & "line#" &
"rotate_left#" & "rotate_left#" &
"rotate_right#" & "rotate_right#" &
"shift_left#" & "shift_left#" &
"shift_right#" & "shift_right#" &
"shift_right_arithmetic#" & "shift_right_arithmetic#" &
"source_location#" & "source_location#" &
"unchecked_conversion#" & "unchecked_conversion#" &
"unchecked_deallocation#" & "unchecked_deallocation#" &
"to_pointer#" & "to_pointer#" &
"abstract#" & "abstract#" &
"aliased#" & "aliased#" &
"protected#" & "protected#" &
"until#" & "until#" &
"requeue#" & "requeue#" &
"tagged#" & "tagged#" &
"raise_exception#" & "raise_exception#" &
"ada_roots#" & "ada_roots#" &
"binder#" & "binder#" &
"binder_driver#" & "binder_driver#" &
"body_suffix#" & "body_suffix#" &
"builder#" & "builder#" &
"compiler#" & "compiler#" &
"compiler_driver#" & "compiler_driver#" &
"compiler_kind#" & "compiler_kind#" &
"compute_dependency#" & "compute_dependency#" &
"cross_reference#" & "cross_reference#" &
"default_linker#" & "default_linker#" &
"default_switches#" & "default_switches#" &
"dependency_option#" & "dependency_option#" &
"exec_dir#" & "exec_dir#" &
"executable#" & "executable#" &
"executable_suffix#" & "executable_suffix#" &
"extends#" & "extends#" &
"externally_built#" & "externally_built#" &
"finder#" & "finder#" &
"global_configuration_pragmas#" & "global_configuration_pragmas#" &
"gnatls#" & "gnatls#" &
"gnatstub#" & "gnatstub#" &
"implementation#" & "implementation#" &
"implementation_exceptions#" & "implementation_exceptions#" &
"implementation_suffix#" & "implementation_suffix#" &
"include_option#" & "include_option#" &
"language_processing#" & "language_processing#" &
"languages#" & "languages#" &
"library_dir#" & "library_dir#" &
"library_auto_init#" & "library_auto_init#" &
"library_gcc#" & "library_gcc#" &
"library_interface#" & "library_interface#" &
"library_kind#" & "library_kind#" &
"library_name#" & "library_name#" &
"library_options#" & "library_options#" &
"library_reference_symbol_file#" & "library_reference_symbol_file#" &
"library_src_dir#" & "library_src_dir#" &
"library_symbol_file#" & "library_symbol_file#" &
"library_symbol_policy#" & "library_symbol_policy#" &
"library_version#" & "library_version#" &
"linker#" & "linker#" &
"local_configuration_pragmas#" & "local_configuration_pragmas#" &
"locally_removed_files#" & "locally_removed_files#" &
"metrics#" & "metrics#" &
"naming#" & "naming#" &
"object_dir#" & "object_dir#" &
"pretty_printer#" & "pretty_printer#" &
"project#" & "project#" &
"separate_suffix#" & "separate_suffix#" &
"source_dirs#" & "source_dirs#" &
"source_files#" & "source_files#" &
"source_list_file#" & "source_list_file#" &
"spec#" & "spec#" &
"spec_suffix#" & "spec_suffix#" &
"specification#" & "specification#" &
"specification_exceptions#" & "specification_exceptions#" &
"specification_suffix#" & "specification_suffix#" &
"switches#" & "switches#" &
"unaligned_valid#" & "unaligned_valid#" &
"interface#" & "interface#" &
"overriding#" & "overriding#" &
"synchronized#" & "synchronized#" &
"#"; "#";
--------------------- ---------------------
-- Generated Names -- -- Generated Names --
--------------------- ---------------------
-- This section lists the various cases of generated names which are -- This section lists the various cases of generated names which are
-- built from existing names by adding unique leading and/or trailing -- built from existing names by adding unique leading and/or trailing
-- upper case letters. In some cases these names are built recursively, -- upper case letters. In some cases these names are built recursively,
-- in particular names built from types may be built from types which -- in particular names built from types may be built from types which
-- themselves have generated names. In this list, xxx represents an -- themselves have generated names. In this list, xxx represents an
-- existing name to which identifying letters are prepended or appended, -- existing name to which identifying letters are prepended or appended,
-- and a trailing n represents a serial number in an external name that -- and a trailing n represents a serial number in an external name that
-- has some semantic significance (e.g. the n'th index type of an array). -- has some semantic significance (e.g. the n'th index type of an array).
-- xxxA access type for formal xxx in entry param record (Exp_Ch9) -- xxxA access type for formal xxx in entry param record (Exp_Ch9)
-- xxxB tag table for tagged type xxx (Exp_Ch3) -- xxxB tag table for tagged type xxx (Exp_Ch3)
-- xxxB task body procedure for task xxx (Exp_Ch9) -- xxxB task body procedure for task xxx (Exp_Ch9)
-- xxxD dispatch table for tagged type xxx (Exp_Ch3) -- xxxD dispatch table for tagged type xxx (Exp_Ch3)
-- xxxD discriminal for discriminant xxx (Sem_Ch3) -- xxxD discriminal for discriminant xxx (Sem_Ch3)
-- xxxDn n'th discr check function for rec type xxx (Exp_Ch3) -- xxxDn n'th discr check function for rec type xxx (Exp_Ch3)
-- xxxE elaboration boolean flag for task xxx (Exp_Ch9) -- xxxE elaboration boolean flag for task xxx (Exp_Ch9)
-- xxxE dispatch table pointer type for tagged type xxx (Exp_Ch3) -- xxxE dispatch table pointer type for tagged type xxx (Exp_Ch3)
-- xxxE parameters for accept body for entry xxx (Exp_Ch9) -- xxxE parameters for accept body for entry xxx (Exp_Ch9)
-- xxxFn n'th primitive of a tagged type (named xxx) (Exp_Ch3) -- xxxFn n'th primitive of a tagged type (named xxx) (Exp_Ch3)
-- xxxJ tag table type index for tagged type xxx (Exp_Ch3) -- xxxJ tag table type index for tagged type xxx (Exp_Ch3)
-- xxxM master Id value for access type xxx (Exp_Ch3) -- xxxM master Id value for access type xxx (Exp_Ch3)
-- xxxP tag table pointer type for tagged type xxx (Exp_Ch3) -- xxxP tag table pointer type for tagged type xxx (Exp_Ch3)
-- xxxP parameter record type for entry xxx (Exp_Ch9) -- xxxP parameter record type for entry xxx (Exp_Ch9)
-- xxxPA access to parameter record type for entry xxx (Exp_Ch9) -- xxxPA access to parameter record type for entry xxx (Exp_Ch9)
-- xxxPn pointer type for n'th primitive of tagged type xxx (Exp_Ch3) -- xxxPn pointer type for n'th primitive of tagged type xxx (Exp_Ch3)
-- xxxR dispatch table pointer for tagged type xxx (Exp_Ch3) -- xxxR dispatch table pointer for tagged type xxx (Exp_Ch3)
-- xxxT tag table type for tagged type xxx (Exp_Ch3) -- xxxT tag table type for tagged type xxx (Exp_Ch3)
-- xxxT literal table for enumeration type xxx (Sem_Ch3) -- xxxT literal table for enumeration type xxx (Sem_Ch3)
-- xxxV type for task value record for task xxx (Exp_Ch9) -- xxxV type for task value record for task xxx (Exp_Ch9)
-- xxxX entry index constant (Exp_Ch9) -- xxxX entry index constant (Exp_Ch9)
-- xxxY dispatch table type for tagged type xxx (Exp_Ch3) -- xxxY dispatch table type for tagged type xxx (Exp_Ch3)
-- xxxZ size variable for task xxx (Exp_Ch9) -- xxxZ size variable for task xxx (Exp_Ch9)
-- TSS names -- TSS names
-- xxxDA deep adjust routine for type xxx (Exp_TSS) -- xxxDA deep adjust routine for type xxx (Exp_TSS)
-- xxxDF deep finalize routine for type xxx (Exp_TSS) -- xxxDF deep finalize routine for type xxx (Exp_TSS)
-- xxxDI deep initialize routine for type xxx (Exp_TSS) -- xxxDI deep initialize routine for type xxx (Exp_TSS)
-- xxxEQ composite equality routine for record type xxx (Exp_TSS) -- xxxEQ composite equality routine for record type xxx (Exp_TSS)
-- xxxIP initialization procedure for type xxx (Exp_TSS) -- xxxIP initialization procedure for type xxx (Exp_TSS)
-- xxxRA RAs type access routine for type xxx (Exp_TSS) -- xxxRA RAs type access routine for type xxx (Exp_TSS)
-- xxxRD RAs type dereference routine for type xxx (Exp_TSS) -- xxxRD RAs type dereference routine for type xxx (Exp_TSS)
-- xxxRP Rep to Pos conversion for enumeration type xxx (Exp_TSS) -- xxxRP Rep to Pos conversion for enumeration type xxx (Exp_TSS)
-- xxxSA array/slice assignment for controlled comp. arrays (Exp_TSS) -- xxxSA array/slice assignment for controlled comp. arrays (Exp_TSS)
-- xxxSI stream input attribute subprogram for type xxx (Exp_TSS) -- xxxSI stream input attribute subprogram for type xxx (Exp_TSS)
-- xxxSO stream output attribute subprogram for type xxx (Exp_TSS) -- xxxSO stream output attribute subprogram for type xxx (Exp_TSS)
-- xxxSR stream read attribute subprogram for type xxx (Exp_TSS) -- xxxSR stream read attribute subprogram for type xxx (Exp_TSS)
-- xxxSW stream write attribute subprogram for type xxx (Exp_TSS) -- xxxSW stream write attribute subprogram for type xxx (Exp_TSS)
-- Implicit type names -- Implicit type names
-- TxxxT type of literal table for enumeration type xxx (Sem_Ch3) -- TxxxT type of literal table for enumeration type xxx (Sem_Ch3)
-- (Note: this list is not complete or accurate ???) -- (Note: this list is not complete or accurate ???)
---------------------- ----------------------
-- Get_Attribute_Id -- -- Get_Attribute_Id --
---------------------- ----------------------
function Get_Attribute_Id (N : Name_Id) return Attribute_Id is function Get_Attribute_Id (N : Name_Id) return Attribute_Id is
begin begin
return Attribute_Id'Val (N - First_Attribute_Name); return Attribute_Id'Val (N - First_Attribute_Name);
end Get_Attribute_Id; end Get_Attribute_Id;
------------------ ------------------
-- Get_Check_Id -- -- Get_Check_Id --
------------------ ------------------
function Get_Check_Id (N : Name_Id) return Check_Id is function Get_Check_Id (N : Name_Id) return Check_Id is
begin begin
return Check_Id'Val (N - First_Check_Name); return Check_Id'Val (N - First_Check_Name);
end Get_Check_Id; end Get_Check_Id;
----------------------- -----------------------
-- Get_Convention_Id -- -- Get_Convention_Id --
----------------------- -----------------------
function Get_Convention_Id (N : Name_Id) return Convention_Id is function Get_Convention_Id (N : Name_Id) return Convention_Id is
begin begin
case N is case N is
when Name_Ada => return Convention_Ada; when Name_Ada => return Convention_Ada;
when Name_Assembler => return Convention_Assembler; when Name_Assembler => return Convention_Assembler;
when Name_C => return Convention_C; when Name_C => return Convention_C;
when Name_COBOL => return Convention_COBOL; when Name_COBOL => return Convention_COBOL;
when Name_CPP => return Convention_CPP; when Name_CPP => return Convention_CPP;
when Name_Fortran => return Convention_Fortran; when Name_Fortran => return Convention_Fortran;
when Name_Intrinsic => return Convention_Intrinsic; when Name_Intrinsic => return Convention_Intrinsic;
when Name_Java => return Convention_Java; when Name_Java => return Convention_Java;
when Name_Stdcall => return Convention_Stdcall; when Name_Stdcall => return Convention_Stdcall;
when Name_Stubbed => return Convention_Stubbed; when Name_Stubbed => return Convention_Stubbed;
-- If no direct match, then we must have a convention -- If no direct match, then we must have a convention
-- identifier pragma that has specified this name. -- identifier pragma that has specified this name.
when others => when others =>
for J in 1 .. Convention_Identifiers.Last loop for J in 1 .. Convention_Identifiers.Last loop
if N = Convention_Identifiers.Table (J).Name then if N = Convention_Identifiers.Table (J).Name then
return Convention_Identifiers.Table (J).Convention; return Convention_Identifiers.Table (J).Convention;
end if; end if;
end loop; end loop;
raise Program_Error; raise Program_Error;
end case; end case;
end Get_Convention_Id; end Get_Convention_Id;
--------------------------- ---------------------------
-- Get_Locking_Policy_Id -- -- Get_Locking_Policy_Id --
--------------------------- ---------------------------
function Get_Locking_Policy_Id (N : Name_Id) return Locking_Policy_Id is function Get_Locking_Policy_Id (N : Name_Id) return Locking_Policy_Id is
begin begin
return Locking_Policy_Id'Val (N - First_Locking_Policy_Name); return Locking_Policy_Id'Val (N - First_Locking_Policy_Name);
end Get_Locking_Policy_Id; end Get_Locking_Policy_Id;
------------------- -------------------
-- Get_Pragma_Id -- -- Get_Pragma_Id --
------------------- -------------------
function Get_Pragma_Id (N : Name_Id) return Pragma_Id is function Get_Pragma_Id (N : Name_Id) return Pragma_Id is
begin begin
if N = Name_AST_Entry then if N = Name_AST_Entry then
return Pragma_AST_Entry; return Pragma_AST_Entry;
elsif N = Name_Interface then elsif N = Name_Interface then
return Pragma_Interface; return Pragma_Interface;
elsif N = Name_Storage_Size then elsif N = Name_Storage_Size then
return Pragma_Storage_Size; return Pragma_Storage_Size;
elsif N = Name_Storage_Unit then elsif N = Name_Storage_Unit then
return Pragma_Storage_Unit; return Pragma_Storage_Unit;
elsif N not in First_Pragma_Name .. Last_Pragma_Name then elsif N not in First_Pragma_Name .. Last_Pragma_Name then
return Unknown_Pragma; return Unknown_Pragma;
else else
return Pragma_Id'Val (N - First_Pragma_Name); return Pragma_Id'Val (N - First_Pragma_Name);
end if; end if;
end Get_Pragma_Id; end Get_Pragma_Id;
--------------------------- ---------------------------
-- Get_Queuing_Policy_Id -- -- Get_Queuing_Policy_Id --
--------------------------- ---------------------------
function Get_Queuing_Policy_Id (N : Name_Id) return Queuing_Policy_Id is function Get_Queuing_Policy_Id (N : Name_Id) return Queuing_Policy_Id is
begin begin
return Queuing_Policy_Id'Val (N - First_Queuing_Policy_Name); return Queuing_Policy_Id'Val (N - First_Queuing_Policy_Name);
end Get_Queuing_Policy_Id; end Get_Queuing_Policy_Id;
------------------------------------ ------------------------------------
-- Get_Task_Dispatching_Policy_Id -- -- Get_Task_Dispatching_Policy_Id --
------------------------------------ ------------------------------------
function Get_Task_Dispatching_Policy_Id (N : Name_Id) function Get_Task_Dispatching_Policy_Id (N : Name_Id)
return Task_Dispatching_Policy_Id is return Task_Dispatching_Policy_Id is
begin begin
return Task_Dispatching_Policy_Id'Val return Task_Dispatching_Policy_Id'Val
(N - First_Task_Dispatching_Policy_Name); (N - First_Task_Dispatching_Policy_Name);
end Get_Task_Dispatching_Policy_Id; end Get_Task_Dispatching_Policy_Id;
---------------- ----------------
-- Initialize -- -- Initialize --
---------------- ----------------
procedure Initialize is procedure Initialize is
P_Index : Natural; P_Index : Natural;
Discard_Name : Name_Id; Discard_Name : Name_Id;
begin begin
P_Index := Preset_Names'First; P_Index := Preset_Names'First;
loop loop
Name_Len := 0; Name_Len := 0;
while Preset_Names (P_Index) /= '#' loop while Preset_Names (P_Index) /= '#' loop
Name_Len := Name_Len + 1; Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := Preset_Names (P_Index); Name_Buffer (Name_Len) := Preset_Names (P_Index);
P_Index := P_Index + 1; P_Index := P_Index + 1;
end loop; end loop;
-- We do the Name_Find call to enter the name into the table, but -- We do the Name_Find call to enter the name into the table, but
-- we don't need to do anything with the result, since we already -- we don't need to do anything with the result, since we already
-- initialized all the preset names to have the right value (we -- initialized all the preset names to have the right value (we
-- are depending on the order of the names and Preset_Names). -- are depending on the order of the names and Preset_Names).
Discard_Name := Name_Find; Discard_Name := Name_Find;
P_Index := P_Index + 1; P_Index := P_Index + 1;
exit when Preset_Names (P_Index) = '#'; exit when Preset_Names (P_Index) = '#';
end loop; end loop;
-- Make sure that number of names in standard table is correct. If -- Make sure that number of names in standard table is correct. If
-- this check fails, run utility program XSNAMES to construct a new -- this check fails, run utility program XSNAMES to construct a new
-- properly matching version of the body. -- properly matching version of the body.
pragma Assert (Discard_Name = Last_Predefined_Name); pragma Assert (Discard_Name = Last_Predefined_Name);
-- Initialize the convention identifiers table with the standard -- Initialize the convention identifiers table with the standard
-- set of synonyms that we recognize for conventions. -- set of synonyms that we recognize for conventions.
Convention_Identifiers.Init; Convention_Identifiers.Init;
Convention_Identifiers.Append ((Name_Asm, Convention_Assembler)); Convention_Identifiers.Append ((Name_Asm, Convention_Assembler));
Convention_Identifiers.Append ((Name_Assembly, Convention_Assembler)); Convention_Identifiers.Append ((Name_Assembly, Convention_Assembler));
Convention_Identifiers.Append ((Name_Default, Convention_C)); Convention_Identifiers.Append ((Name_Default, Convention_C));
Convention_Identifiers.Append ((Name_External, Convention_C)); Convention_Identifiers.Append ((Name_External, Convention_C));
Convention_Identifiers.Append ((Name_DLL, Convention_Stdcall)); Convention_Identifiers.Append ((Name_DLL, Convention_Stdcall));
Convention_Identifiers.Append ((Name_Win32, Convention_Stdcall)); Convention_Identifiers.Append ((Name_Win32, Convention_Stdcall));
end Initialize; end Initialize;
----------------------- -----------------------
-- Is_Attribute_Name -- -- Is_Attribute_Name --
----------------------- -----------------------
function Is_Attribute_Name (N : Name_Id) return Boolean is function Is_Attribute_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Attribute_Name .. Last_Attribute_Name; return N in First_Attribute_Name .. Last_Attribute_Name;
end Is_Attribute_Name; end Is_Attribute_Name;
------------------- -------------------
-- Is_Check_Name -- -- Is_Check_Name --
------------------- -------------------
function Is_Check_Name (N : Name_Id) return Boolean is function Is_Check_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Check_Name .. Last_Check_Name; return N in First_Check_Name .. Last_Check_Name;
end Is_Check_Name; end Is_Check_Name;
------------------------ ------------------------
-- Is_Convention_Name -- -- Is_Convention_Name --
------------------------ ------------------------
function Is_Convention_Name (N : Name_Id) return Boolean is function Is_Convention_Name (N : Name_Id) return Boolean is
begin begin
-- Check if this is one of the standard conventions -- Check if this is one of the standard conventions
if N in First_Convention_Name .. Last_Convention_Name if N in First_Convention_Name .. Last_Convention_Name
or else N = Name_C or else N = Name_C
then then
return True; return True;
-- Otherwise check if it is in convention identifier table -- Otherwise check if it is in convention identifier table
else else
for J in 1 .. Convention_Identifiers.Last loop for J in 1 .. Convention_Identifiers.Last loop
if N = Convention_Identifiers.Table (J).Name then if N = Convention_Identifiers.Table (J).Name then
return True; return True;
end if; end if;
end loop; end loop;
return False; return False;
end if; end if;
end Is_Convention_Name; end Is_Convention_Name;
------------------------------ ------------------------------
-- Is_Entity_Attribute_Name -- -- Is_Entity_Attribute_Name --
------------------------------ ------------------------------
function Is_Entity_Attribute_Name (N : Name_Id) return Boolean is function Is_Entity_Attribute_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Entity_Attribute_Name .. Last_Entity_Attribute_Name; return N in First_Entity_Attribute_Name .. Last_Entity_Attribute_Name;
end Is_Entity_Attribute_Name; end Is_Entity_Attribute_Name;
-------------------------------- --------------------------------
-- Is_Function_Attribute_Name -- -- Is_Function_Attribute_Name --
-------------------------------- --------------------------------
function Is_Function_Attribute_Name (N : Name_Id) return Boolean is function Is_Function_Attribute_Name (N : Name_Id) return Boolean is
begin begin
return N in return N in
First_Renamable_Function_Attribute .. First_Renamable_Function_Attribute ..
Last_Renamable_Function_Attribute; Last_Renamable_Function_Attribute;
end Is_Function_Attribute_Name; end Is_Function_Attribute_Name;
---------------------------- ----------------------------
-- Is_Locking_Policy_Name -- -- Is_Locking_Policy_Name --
---------------------------- ----------------------------
function Is_Locking_Policy_Name (N : Name_Id) return Boolean is function Is_Locking_Policy_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Locking_Policy_Name .. Last_Locking_Policy_Name; return N in First_Locking_Policy_Name .. Last_Locking_Policy_Name;
end Is_Locking_Policy_Name; end Is_Locking_Policy_Name;
----------------------------- -----------------------------
-- Is_Operator_Symbol_Name -- -- Is_Operator_Symbol_Name --
----------------------------- -----------------------------
function Is_Operator_Symbol_Name (N : Name_Id) return Boolean is function Is_Operator_Symbol_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Operator_Name .. Last_Operator_Name; return N in First_Operator_Name .. Last_Operator_Name;
end Is_Operator_Symbol_Name; end Is_Operator_Symbol_Name;
-------------------- --------------------
-- Is_Pragma_Name -- -- Is_Pragma_Name --
-------------------- --------------------
function Is_Pragma_Name (N : Name_Id) return Boolean is function Is_Pragma_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Pragma_Name .. Last_Pragma_Name return N in First_Pragma_Name .. Last_Pragma_Name
or else N = Name_AST_Entry or else N = Name_AST_Entry
or else N = Name_Interface or else N = Name_Interface
or else N = Name_Storage_Size or else N = Name_Storage_Size
or else N = Name_Storage_Unit; or else N = Name_Storage_Unit;
end Is_Pragma_Name; end Is_Pragma_Name;
--------------------------------- ---------------------------------
-- Is_Procedure_Attribute_Name -- -- Is_Procedure_Attribute_Name --
--------------------------------- ---------------------------------
function Is_Procedure_Attribute_Name (N : Name_Id) return Boolean is function Is_Procedure_Attribute_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Procedure_Attribute .. Last_Procedure_Attribute; return N in First_Procedure_Attribute .. Last_Procedure_Attribute;
end Is_Procedure_Attribute_Name; end Is_Procedure_Attribute_Name;
---------------------------- ----------------------------
-- Is_Queuing_Policy_Name -- -- Is_Queuing_Policy_Name --
---------------------------- ----------------------------
function Is_Queuing_Policy_Name (N : Name_Id) return Boolean is function Is_Queuing_Policy_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Queuing_Policy_Name .. Last_Queuing_Policy_Name; return N in First_Queuing_Policy_Name .. Last_Queuing_Policy_Name;
end Is_Queuing_Policy_Name; end Is_Queuing_Policy_Name;
------------------------------------- -------------------------------------
-- Is_Task_Dispatching_Policy_Name -- -- Is_Task_Dispatching_Policy_Name --
------------------------------------- -------------------------------------
function Is_Task_Dispatching_Policy_Name (N : Name_Id) return Boolean is function Is_Task_Dispatching_Policy_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Task_Dispatching_Policy_Name .. return N in First_Task_Dispatching_Policy_Name ..
Last_Task_Dispatching_Policy_Name; Last_Task_Dispatching_Policy_Name;
end Is_Task_Dispatching_Policy_Name; end Is_Task_Dispatching_Policy_Name;
---------------------------- ----------------------------
-- Is_Type_Attribute_Name -- -- Is_Type_Attribute_Name --
---------------------------- ----------------------------
function Is_Type_Attribute_Name (N : Name_Id) return Boolean is function Is_Type_Attribute_Name (N : Name_Id) return Boolean is
begin begin
return N in First_Type_Attribute_Name .. Last_Type_Attribute_Name; return N in First_Type_Attribute_Name .. Last_Type_Attribute_Name;
end Is_Type_Attribute_Name; end Is_Type_Attribute_Name;
---------------------------------- ----------------------------------
-- Record_Convention_Identifier -- -- Record_Convention_Identifier --
---------------------------------- ----------------------------------
procedure Record_Convention_Identifier procedure Record_Convention_Identifier
(Id : Name_Id; (Id : Name_Id;
Convention : Convention_Id) Convention : Convention_Id)
is is
begin begin
Convention_Identifiers.Append ((Id, Convention)); Convention_Identifiers.Append ((Id, Convention));
end Record_Convention_Identifier; end Record_Convention_Identifier;
end Snames; end Snames;
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -72,16 +72,16 @@ package Tbuild is ...@@ -72,16 +72,16 @@ package Tbuild is
function Make_DT_Component function Make_DT_Component
(Loc : Source_Ptr; (Loc : Source_Ptr;
Typ : Entity_Id; Typ : Entity_Id;
I : Positive) return Node_Id; N : Positive) return Node_Id;
-- Gives a reference to the Ith component of the Dispatch Table of -- Gives a reference to the Nth component of the Dispatch Table of
-- a given Tagged Type. -- a given Tagged Type.
-- --
-- I = 1 --> Inheritance_Depth -- N = 1 --> Inheritance_Depth
-- I = 2 --> Tags (array of ancestors) -- N = 2 --> Tags (array of ancestors)
-- I = 3, 4 --> predefined primitive -- N = 3, 4 --> predefined primitive
-- function _Size (X : Typ) return Long_Long_Integer; -- function _Size (X : Typ) return Long_Long_Integer;
-- function _Equality (X : Typ; Y : Typ'Class) return Boolean; -- function _Equality (X : Typ; Y : Typ'Class) return Boolean;
-- I >= 5 --> User-Defined Primitive Operations -- N >= 5 --> User-Defined Primitive Operations
function Make_DT_Access function Make_DT_Access
(Loc : Source_Ptr; Rec : Node_Id; Typ : Entity_Id) return Node_Id; (Loc : Source_Ptr; Rec : Node_Id; Typ : Entity_Id) return Node_Id;
......
...@@ -679,9 +679,9 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -679,9 +679,9 @@ build_binary_op (enum tree_code op_code, tree result_type,
|| (TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0))) || (TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0)))
== ARRAY_TYPE)) == ARRAY_TYPE))
&& (0 == (best_type && (0 == (best_type
== find_common_type (right_type, = find_common_type (right_type,
TREE_TYPE (TREE_OPERAND TREE_TYPE (TREE_OPERAND
(right_operand, 0)))) (right_operand, 0))))
|| right_type != best_type)) || right_type != best_type))
{ {
right_operand = TREE_OPERAND (right_operand, 0); right_operand = TREE_OPERAND (right_operand, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment