diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-24 09:19:15 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-24 09:19:15 +0000 |
commit | 84c0d8e8d58c14a8d5d95335a591bc4b3c03ef97 (patch) | |
tree | d89cf897a9a425f8c25bed513a2012ba82a689ae /gcc/ada/s-stposu.adb | |
parent | 5ea0545e19c96fbc5f98630f9f9eea934201206d (diff) | |
download | gcc-84c0d8e8d58c14a8d5d95335a591bc4b3c03ef97.tar.gz |
2011-10-24 Sergey Rybin <rybin@adacore.com frybin>
* gnat_ugn.texi: For gnatelim, move the note about using the GNAT
driver for getting the project support into gnatelim section.
2011-10-24 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Minor correction to documentation on address
clause.
2011-10-24 Hristian Kirtchev <kirtchev@adacore.com>
* s-finmas.adb (Attach): Synchronize and call the unprotected version.
(Attach_Unprotected): New routine.
(Delete_Finalize_Address): Removed.
(Delete_Finalize_Address_Unprotected): New routine.
(Detach): Synchronize and call the unprotected version.
(Detach_Unprotected): Remove locking.
(Finalize): Add various comment on synchronization. Lock the critical
region and call the unprotected versions of routines.
(Finalize_Address): Removed.
(Finalize_Address_Unprotected): New routine.
(Set_Finalize_Address): Synchronize and call
the unprotected version.
(Set_Finalize_Address_Unprotected): New routine.
(Set_Heterogeneous_Finalize_Address): Removed.
(Set_Heterogeneous_Finalize_Address_Unprotected): New routine.
(Set_Is_Heterogeneous): Add comment on synchronization and
locking.
* s-finmas.ads: Flag Finalization_Started is no longer atomic
because synchronization uses task locking / unlocking.
(Attach): Add comment on usage.
(Attach_Unprotected): New routine.
(Delete_Finalize_Address): Renamed to
Delete_Finalize_Address_Unprotected.
(Detach): Add comment on usage.
(Detach_Unprotected): New routine.
(Finalize_Address): Renamed to Finalize_Address_Unprotected.
(Set_Finalize_Address): Add comment on usage.
(Set_Finalize_Address_Unprotected): New routine.
(Set_Heterogeneous_Finalize_Address): Renamed to
Set_Heterogeneous_Finalize_Address_Unprotected.
* s-stposu.adb (Allocate_Any_Controlled): Add local variable
Allocation_Locked. Add various comments on synchronization. Lock
the critical region and call the unprotected version of
routines.
(Deallocate_Any_Controlled): Add various comments on
synchronization. Lock the critical region and call the unprotected
version of routines.
2011-10-24 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Set_Fixed_Range): The bounds of a fixed point type
are universal and must carry the corresponding type.
* sem_eval.adb (Check_Non_Static_Context): If the type of the
expression is universal real, as may be the case for a fixed point
expression with constant operands in the context of a conversion,
there is nothing to check.
* s-finmas.adb: Minor reformatting
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180368 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-stposu.adb')
-rw-r--r-- | gcc/ada/s-stposu.adb | 65 |
1 files changed, 53 insertions, 12 deletions
diff --git a/gcc/ada/s-stposu.adb b/gcc/ada/s-stposu.adb index b8ad53d613b..4bbff767d96 100644 --- a/gcc/ada/s-stposu.adb +++ b/gcc/ada/s-stposu.adb @@ -109,6 +109,9 @@ package body System.Storage_Pools.Subpools is N_Size : Storage_Count; Subpool : Subpool_Handle := null; + Allocation_Locked : Boolean; + -- This flag stores the state of the associated collection + Header_And_Padding : Storage_Offset; -- This offset includes the size of a FM_Node plus any additional -- padding due to a larger alignment. @@ -156,22 +159,22 @@ package body System.Storage_Pools.Subpools is -- failed to create one. This is a serious error. if Context_Master = null then - raise Program_Error with "missing master in pool allocation"; - end if; + raise Program_Error + with "missing master in pool allocation"; -- If a subpool is present, then this is the result of erroneous -- allocator expansion. This is not a serious error, but it should -- still be detected. - if Context_Subpool /= null then - raise Program_Error with "subpool not required in pool allocation"; - end if; + elsif Context_Subpool /= null then + raise Program_Error + with "subpool not required in pool allocation"; -- If the allocation is intended to be on a subpool, but the access -- type's pool does not support subpools, then this is the result of -- erroneous end-user code. - if On_Subpool then + elsif On_Subpool then raise Program_Error with "pool of access type does not support subpools"; end if; @@ -187,10 +190,18 @@ package body System.Storage_Pools.Subpools is if Is_Controlled then + -- Synchronization: + -- Read - allocation, finalization + -- Write - finalization + + Lock_Task.all; + Allocation_Locked := Finalization_Started (Master.all); + Unlock_Task.all; + -- Do not allow the allocation of controlled objects while the -- associated master is being finalized. - if Finalization_Started (Master.all) then + if Allocation_Locked then raise Program_Error with "allocation after finalization started"; end if; @@ -240,6 +251,7 @@ package body System.Storage_Pools.Subpools is -- Step 4: Attachment if Is_Controlled then + Lock_Task.all; -- Map the allocated memory into a FM_Node record. This converts the -- top of the allocated bits into a list header. If there is padding @@ -262,7 +274,10 @@ package body System.Storage_Pools.Subpools is -- Prepend the allocated object to the finalization master - Attach (N_Ptr, Objects (Master.all)); + -- Synchronization: + -- Write - allocation, deallocation, finalization + + Attach_Unprotected (N_Ptr, Objects (Master.all)); -- Move the address from the hidden list header to the start of the -- object. This operation effectively hides the list header. @@ -275,8 +290,17 @@ package body System.Storage_Pools.Subpools is -- 2) Named access types -- 3) Most cases of anonymous access types usage + -- Synchronization: + -- Read - allocation, finalization + -- Write - outside + if Master.Is_Homogeneous then - Set_Finalize_Address (Master.all, Fin_Address); + + -- Synchronization: + -- Read - finalization + -- Write - allocation, outside + + Set_Finalize_Address_Unprotected (Master.all, Fin_Address); -- Heterogeneous masters service the following: @@ -284,10 +308,16 @@ package body System.Storage_Pools.Subpools is -- 2) Certain cases of anonymous access types usage else - Set_Heterogeneous_Finalize_Address (Addr, Fin_Address); + -- Synchronization: + -- Read - finalization + -- Write - allocation, deallocation + + Set_Heterogeneous_Finalize_Address_Unprotected (Addr, Fin_Address); Finalize_Address_Table_In_Use := True; end if; + Unlock_Task.all; + -- Non-controlled allocation else @@ -341,12 +371,18 @@ package body System.Storage_Pools.Subpools is -- Step 1: Detachment if Is_Controlled then + Lock_Task.all; -- Destroy the relation pair object - Finalize_Address since it is no -- longer needed. if Finalize_Address_Table_In_Use then - Delete_Finalize_Address (Addr); + + -- Synchronization: + -- Read - finalization + -- Write - allocation, deallocation + + Delete_Finalize_Address_Unprotected (Addr); end if; -- Account for possible padding space before the header due to a @@ -376,7 +412,10 @@ package body System.Storage_Pools.Subpools is -- action does not need to know the prior context used during -- allocation. - Detach (N_Ptr); + -- Synchronization: + -- Write - allocation, deallocation, finalization + + Detach_Unprotected (N_Ptr); -- Move the address from the object to the beginning of the list -- header. @@ -388,6 +427,8 @@ package body System.Storage_Pools.Subpools is N_Size := Storage_Size + Header_And_Padding; + Unlock_Task.all; + else N_Addr := Addr; N_Size := Storage_Size; |