diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-04 15:31:56 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-04 15:31:56 +0000 |
commit | 9eb919116e4eba4b38519ee961ebfa9bc3ac32cc (patch) | |
tree | 221b324fc246557794e1977bd63dc7c19d564aa1 /gcc/ada/a-stwiun-shared.adb | |
parent | fe9fc6757e47fecf2bb25f018c0e0297370638d8 (diff) | |
download | gcc-9eb919116e4eba4b38519ee961ebfa9bc3ac32cc.tar.gz |
2011-08-04 Thomas Quinot <quinot@adacore.com>
* gnatls.adb: Use Prj.Env.Initialize_Default_Project_Path to retrieve
the project path.
2011-08-04 Robert Dewar <dewar@adacore.com>
* a-coinho.adb: Minor reformatting.
2011-08-04 Robert Dewar <dewar@adacore.com>
* a-coinho.ads: Minor reformatting.
2011-08-04 Vadim Godunko <godunko@adacore.com>
* s-atocou.ads, s-atocou.adb: New files.
* a-strunb-shared.ads, a-strunb-shared.adb, a-stwiun-shared.ads,
a-stwiun-shared.adb, a-stzunb-shared.ads, a-stzunb-shared.adb: Remove
direct use of GCC's atomic builtins and replace them by use of new
atomic counter package.
2011-08-04 Ed Schonberg <schonberg@adacore.com>
* exp_strm.adb: better error message for No_Default_Stream_Attributes.
2011-08-04 Hristian Kirtchev <kirtchev@adacore.com>
* a-tags.adb (Unregister_Tag): Replace the complex address arithmetic
with a call to Get_External_Tag.
* exp_ch7.adb (Build_Cleanup_Statements): Update the comment on
subprogram usage. Remove the guard against package declarations and
bodies since Build_Cleanup_Statements is no longer invoked in that
context.
(Build_Components): Initialize Tagged_Type_Stmts when the context
contains at least one library-level tagged type.
(Build_Finalizer): New local variables Has_Tagged_Types and
Tagged_Type_Stmts along with associated comments on usage. Update the
logic to include tagged type processing.
(Create_Finalizer): Insert all library-level tagged type unregistration
code before the jump block circuitry.
(Expand_N_Package_Body): Remove the call to Build_Cleanup_Statements.
(Expand_N_Package_Declaration): Remove the call to
Build_Cleanup_Statements.
(Process_Tagged_Type_Declaration): New routine. Generate a call to
unregister the external tag of a tagged type.
(Processing_Actions): Reimplemented to handle tagged types.
(Process_Declarations): Detect the declaration of a library-level
tagged type and carry out the appropriate actions.
(Unregister_Tagged_Types): Removed. The machinery has been directly
merged with Build_Finalizer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177401 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-stwiun-shared.adb')
-rw-r--r-- | gcc/ada/a-stwiun-shared.adb | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/gcc/ada/a-stwiun-shared.adb b/gcc/ada/a-stwiun-shared.adb index 95b17eff5f8..5ee93e85ff3 100644 --- a/gcc/ada/a-stwiun-shared.adb +++ b/gcc/ada/a-stwiun-shared.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- -- -- -- 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- -- @@ -50,16 +50,6 @@ package body Ada.Strings.Wide_Unbounded is -- align the returned memory on the maximum alignment as malloc does not -- know the target alignment. - procedure Sync_Add_And_Fetch - (Ptr : access Interfaces.Unsigned_32; - Value : Interfaces.Unsigned_32); - pragma Import (Intrinsic, Sync_Add_And_Fetch, "__sync_add_and_fetch_4"); - - function Sync_Sub_And_Fetch - (Ptr : access Interfaces.Unsigned_32; - Value : Interfaces.Unsigned_32) return Interfaces.Unsigned_32; - pragma Import (Intrinsic, Sync_Sub_And_Fetch, "__sync_sub_and_fetch_4"); - function Aligned_Max_Length (Max_Length : Natural) return Natural; -- Returns recommended length of the shared string which is greater or -- equal to specified length. Calculation take in sense alignment of @@ -636,12 +626,10 @@ package body Ada.Strings.Wide_Unbounded is function Can_Be_Reused (Item : Shared_Wide_String_Access; - Length : Natural) return Boolean - is - use Interfaces; + Length : Natural) return Boolean is begin return - Item.Counter = 1 + System.Atomic_Counters.Is_One (Item.Counter) and then Item.Max_Length >= Length and then Item.Max_Length <= Aligned_Max_Length (Length + Length / Growth_Factor); @@ -1294,7 +1282,7 @@ package body Ada.Strings.Wide_Unbounded is procedure Reference (Item : not null Shared_Wide_String_Access) is begin - Sync_Add_And_Fetch (Item.Counter'Access, 1); + System.Atomic_Counters.Increment (Item.Counter); end Reference; --------------------- @@ -2100,7 +2088,6 @@ package body Ada.Strings.Wide_Unbounded is ----------------- procedure Unreference (Item : not null Shared_Wide_String_Access) is - use Interfaces; procedure Free is new Ada.Unchecked_Deallocation @@ -2109,7 +2096,7 @@ package body Ada.Strings.Wide_Unbounded is Aux : Shared_Wide_String_Access := Item; begin - if Sync_Sub_And_Fetch (Aux.Counter'Access, 1) = 0 then + if System.Atomic_Counters.Decrement (Aux.Counter) then -- Reference counter of Empty_Shared_Wide_String must never reach -- zero. |