aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnarl/s-taprop__dummy.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-03-05 23:30:51 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-17 10:21:06 +0200
commitc8e5d90c4a0b736c2c4c5be3e8a3e9744e602d9d (patch)
tree072b3b669dafe922d6b59e14990fed7195bf8fcb /gcc/ada/libgnarl/s-taprop__dummy.adb
parentd7dbf6c7ae69ff4d8e26b8dc7ee14104f5a9843e (diff)
downloadgcc-c8e5d90c4a0b736c2c4c5be3e8a3e9744e602d9d.zip
gcc-c8e5d90c4a0b736c2c4c5be3e8a3e9744e602d9d.tar.gz
gcc-c8e5d90c4a0b736c2c4c5be3e8a3e9744e602d9d.tar.bz2
ada: Replace spinlocks with fully-fledged locks in finalization collections
This replaces spinlocks with fully-fledged locks in finalization collections because the former are deemed problematic with tasks that can be preempted. Because of the requirement to avoid dragging the tasking runtime when it is not necessary, the implementation goes through the usual soft links, with an additional hurdle that space must be reserved for the lock in any case since it is part of the ABI. This entails the introduction of the System.OS_Locks unit in the non-tasking runtime and the modification of the tasking runtime to also use this unit. This in turn requires a small adjustment: because of the presence of pre- and post-conditions in Interfaces.C and of the limitations of the RTSfind mechanism, the System.Finalization_Primitives unit must be preloaded, as what is done for the Ada.Strings.Text_Buffers unit. This effectively reverts the implementation to using the global task lock on bare board platforms. gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-oslock$(objext). (LIBGNAT_TARGET_PAIRS): Use s-oslock__dummy.ads by default. Set specific s-oslock.ads source file for all the platforms. * exp_ch7.ads (Preload_Finalization_Collection): New procedure. * exp_ch7.adb (Allows_Finalization_Collection): Return False if System.Finalization_Primitives has not been preloaded. (Preload_Finalization_Collection): New procedure. * opt.ads (Interface_Seen): New boolean variable. * s-oscons-tmplt.c: Use "N" string for pragma Style_Checks. * scng.adb (Scan): Set Interface_Seen upon seeing "interface". * sem_ch10.adb: Add clause for Exp_Ch7. (Analyze_Compilation_Unit): Call Preload_Finalization_Collection after the context of the unit is analyzed. * libgnarl/a-rttiev.adb: Add with clause for System.OS_Locks and alphabetize others. (Event_Queue_Lock): Adjust qualified name of subtype. * libgnarl/s-osinte__aix.ads: Add with clause for System.OS_Locks and change pthread_mutex_t into a local subtype. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__darwin.ads: Likewise. * libgnarl/s-osinte__dragonfly.ads: Likewise. * libgnarl/s-osinte__freebsd.ads: Likewise. * libgnarl/s-osinte__gnu.ads: Likewise. * libgnarl/s-osinte__hpux-dce.ads: Likewise. * libgnarl/s-osinte__hpux.ads: Add Likewise. * libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise. * libgnarl/s-osinte__linux.ads: Likewise. * libgnarl/s-osinte__lynxos178e.ads: Likewise. * libgnarl/s-osinte__qnx.ads: Likewise. * libgnarl/s-osinte__rtems.ads: Likewise. * libgnarl/s-osinte__mingw.ads: Add with clause for System.OS_Locks and change CRITICAL_SECTION into a local subtype. Add declarations for imported procedures dealing with CRITICAL_SECTION. * libgnarl/s-osinte__solaris.ads: Add with clause for System.OS_Locks and change mutex_t into a local subtype. * libgnarl/s-osinte__vxworks.ads: Add missing blank line. * libgnarl/s-taprop.ads: Alphabetize clauses and package renamings. Use qualified name for RTS_Lock throughout. * libgnarl/s-taprop__dummy.adb: Add use clause for System.OS_Locks and alphabetize others. * libgnarl/s-taprop__hpux-dce.adb: Likewise. * libgnarl/s-taprop__linux.adb: Likewise. * libgnarl/s-taprop__posix.adb: Likewise. * libgnarl/s-taprop__qnx.adb: Likewise. * libgnarl/s-taprop__rtems.adb: Likewise. * libgnarl/s-taprop__solaris.adb: Likewise. * libgnarl/s-taprop__vxworks.adb: Likewise. * libgnarl/s-taprop__mingw.adb: Likewise. Remove declarations for imported procedures dealing with CRITICAL_SECTION. * libgnarl/s-tarest.adb: Add with clause for System.OS_Locks and alphabetize others. (Global_Task_Lock): Adjust qualified name of subtype. * libgnarl/s-tasini.adb: Add clause for System.OS_Locks. (Initialize_RTS_Lock): New procedure. (Finalize_RTS_Lock): Likewise. (Acquire_RTS_Lock): Likewise. (Release_RTS_Lock): Likewise. (Init_RTS): Add compile-time assertions for RTS_Lock types. Set the soft links for the RTS lock manipulation routines. * libgnarl/s-taspri__dummy.ads: Add with clause for System.OS_Locks. (RTS_Lock): Delete and adjust throughout accordingly. * libgnarl/s-taspri__hpux-dce.ads: Likewise. * libgnarl/s-taspri__lynxos.ads: Likewise. * libgnarl/s-taspri__mingw.ads: Likewise. * libgnarl/s-taspri__posix-noaltstack.ads: Likewise. * libgnarl/s-taspri__posix.ads: Likewise. * libgnarl/s-taspri__solaris.ads: Likewise. * libgnarl/s-taspri__vxworks.ads: Likewise. * libgnat/s-finpri.ads: Add clause for System.OS_Locks. (Finalization_Collection): Change type of Lock. * libgnat/s-finpri.adb (Initialize): Call Initialize_RTS_Lock. (Lock_Collection): Call Acquire_RTS_Lock. (Unlock_Collection): Call Release_RTS_Lock. * libgnat/s-oslock__dummy.ads: New file. * libgnat/s-oslock__hpux-dce.ads: Likewise. * libgnat/s-oslock__mingw.ads: Likewise. * libgnat/s-oslock__posix.ads: Likewise. * libgnat/s-oslock__solaris.ads: Likewise. * libgnat/s-oslock__vxworks.ads: Likewise. * libgnat/s-soflin.ads (Null_Set_Address): New null procedure. (Initialize_RTS_Lock): New soft link. (Finalize_RTS_Lock): Likewise. (Acquire_RTS_Lock): Likewise. (Release_RTS_Lock): Likewise. * exp_ch4.adb (Expand_N_Allocator): In the subtype indication case, call Apply_Predicate_Check on the resulting access value if need be.
Diffstat (limited to 'gcc/ada/libgnarl/s-taprop__dummy.adb')
-rw-r--r--gcc/ada/libgnarl/s-taprop__dummy.adb3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ada/libgnarl/s-taprop__dummy.adb b/gcc/ada/libgnarl/s-taprop__dummy.adb
index 829d595..68ec8b4 100644
--- a/gcc/ada/libgnarl/s-taprop__dummy.adb
+++ b/gcc/ada/libgnarl/s-taprop__dummy.adb
@@ -36,8 +36,9 @@
package body System.Task_Primitives.Operations is
- use System.Tasking;
+ use System.OS_Locks;
use System.Parameters;
+ use System.Tasking;
pragma Warnings (Off);
-- Turn off warnings since so many unreferenced parameters