diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-07-23 08:01:22 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-07-23 08:01:22 +0000 |
commit | 549ddc37019b416667c09bc068bcbb3fef76a54b (patch) | |
tree | a4e496a40c5256cbc12b038092f4ddbc87150a01 /gcc/ada/s-atopri.adb | |
parent | d6a9dc1e5c913e8d5b3ce5166354c565638a20f3 (diff) | |
download | gcc-549ddc37019b416667c09bc068bcbb3fef76a54b.tar.gz |
2012-07-23 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch12.adb (Insert_Freeze_Node_For_Instance): Inst is now
a local variable. Retrieve the related instance when processing
a subprogram instantiation. Such instances appear as wrapper
packages.
2012-07-23 Vincent Pucci <pucci@adacore.com>
* system-aix64.ads, system-aix.ads, system-darwin-ppc.ads,
system-hpux.ads, system-linux-alpha.ads,
system-linux-hppa.ads, system-linux-ppc.ads,
system-linux-s390.ads, system-linux-s390x.ads,
system-linux-sh4.ads, system-linux-sparc.ads,
system-lynxos-ppc.ads, system-mingw.ads,
system-solaris-sparc.ads, system-solaris-sparcv9.ads,
system-vms_64.ads, * system-vxworks-arm.ads, system-vxworks-m68k.ads,
system-vxworks-mips.ads, system-vxworks-ppc.ads,
system-vxworks-sparcv9.ads: Support_Atomic_Primitives set to False.
* system-darwin-x86.ads, system-darwin-x86_64.ads,
system-freebsd-x86.ads, system-freebsd-x86_64.ads,
system-hpux-ia64.ads, system-linux-ia64.ads, system-linux-x86.ads,
system-linux-x86_64.ads, system-lynxos-x86.ads,
system-mingw-x86_64.ads, system-solaris-x86.ads,
system-solaris-x86_64.ads, system-vms-ia64.ads,
system-vxworks-x86.ads: Support_Atomic_Primitives set to True.
* s-atopri.adb (Lock_Free_Read_X): New body.
(Lock_Free_Try_Write_X): Support_Atomic_Primitives check added.
(Lock_Free_Try_Write_64): New body.
* s-atopri.ads: New type uint.
(Sync_Compare_And_Swap_64): __sync_val_compare_and_swap_8 intrinsic
import.
(Lock_Free_Read_X): Body moved to s-atopri.adb.
(Lock_Free_Try_Write_64): Similar to other Lock_Free_Try_Write_X
routines.
* targparm.adb: New enumeration literal SAP
(Support_Atomic_Primitives) for type Targparm_Tags. New constant
SAP_Str. New component SAP_Str'Access for array Targparm_Str.
(Get_Target_Parameters): Parse Support_Atomic_Primitives_On_Target
flag.
* targparm.ads: New back-end code generation flag
Support_Atomic_Primitives_On_Target
2012-07-23 Vincent Pucci <pucci@adacore.com>
* gnat_ugn.texi: Dimensionality checking documentation updated.
2012-07-23 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Make_Inline): If the pragma applies to a
subprogram renaming, set inline flags on both the renamed entity
and on the renaming, so that some ASIS queries can be handled
consistently in the absence of expansion.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189772 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-atopri.adb')
-rw-r--r-- | gcc/ada/s-atopri.adb | 102 |
1 files changed, 99 insertions, 3 deletions
diff --git a/gcc/ada/s-atopri.adb b/gcc/ada/s-atopri.adb index 1977ba43598..d856c8c3cc8 100644 --- a/gcc/ada/s-atopri.adb +++ b/gcc/ada/s-atopri.adb @@ -31,6 +31,58 @@ package body System.Atomic_Primitives is + ---------------------- + -- Lock_Free_Read_8 -- + ---------------------- + + function Lock_Free_Read_8 (Ptr : Address) return uint8 is + begin + if Support_Atomic_Primitives then + return Atomic_Load_8 (Ptr, Acquire); + else + raise Program_Error; + end if; + end Lock_Free_Read_8; + + ---------------------- + -- Lock_Free_Read_16 -- + ---------------------- + + function Lock_Free_Read_16 (Ptr : Address) return uint16 is + begin + if Support_Atomic_Primitives then + return Atomic_Load_16 (Ptr, Acquire); + else + raise Program_Error; + end if; + end Lock_Free_Read_16; + + ---------------------- + -- Lock_Free_Read_32 -- + ---------------------- + + function Lock_Free_Read_32 (Ptr : Address) return uint32 is + begin + if Support_Atomic_Primitives then + return Atomic_Load_32 (Ptr, Acquire); + else + raise Program_Error; + end if; + end Lock_Free_Read_32; + + ---------------------- + -- Lock_Free_Read_64 -- + ---------------------- + + function Lock_Free_Read_64 (Ptr : Address) return uint64 is + begin + if Support_Atomic_Primitives then + return Atomic_Load_64 (Ptr, Acquire); + else + raise Program_Error; + end if; + end Lock_Free_Read_64; + --------------------------- -- Lock_Free_Try_Write_8 -- --------------------------- @@ -44,7 +96,12 @@ package body System.Atomic_Primitives is begin if Expected /= Desired then - Actual := Sync_Compare_And_Swap_8 (Ptr, Expected, Desired); + + if Support_Atomic_Primitives then + Actual := Sync_Compare_And_Swap_8 (Ptr, Expected, Desired); + else + raise Program_Error; + end if; if Actual /= Expected then Expected := Actual; @@ -68,7 +125,12 @@ package body System.Atomic_Primitives is begin if Expected /= Desired then - Actual := Sync_Compare_And_Swap_16 (Ptr, Expected, Desired); + + if Support_Atomic_Primitives then + Actual := Sync_Compare_And_Swap_16 (Ptr, Expected, Desired); + else + raise Program_Error; + end if; if Actual /= Expected then Expected := Actual; @@ -92,7 +154,12 @@ package body System.Atomic_Primitives is begin if Expected /= Desired then - Actual := Sync_Compare_And_Swap_32 (Ptr, Expected, Desired); + + if Support_Atomic_Primitives then + Actual := Sync_Compare_And_Swap_32 (Ptr, Expected, Desired); + else + raise Program_Error; + end if; if Actual /= Expected then Expected := Actual; @@ -102,4 +169,33 @@ package body System.Atomic_Primitives is return True; end Lock_Free_Try_Write_32; + + ---------------------------- + -- Lock_Free_Try_Write_64 -- + ---------------------------- + + function Lock_Free_Try_Write_64 + (Ptr : Address; + Expected : in out uint64; + Desired : uint64) return Boolean + is + Actual : uint64; + + begin + if Expected /= Desired then + + if Support_Atomic_Primitives then + Actual := Sync_Compare_And_Swap_64 (Ptr, Expected, Desired); + else + raise Program_Error; + end if; + + if Actual /= Expected then + Expected := Actual; + return False; + end if; + end if; + + return True; + end Lock_Free_Try_Write_64; end System.Atomic_Primitives; |