diff options
author | Gaius Mulley <gaiusmod2@gmail.com> | 2023-03-16 20:34:32 +0000 |
---|---|---|
committer | Gaius Mulley <gaiusmod2@gmail.com> | 2023-03-16 20:34:32 +0000 |
commit | 77924dff144cf934e7a73417d237a99f0d9d66ed (patch) | |
tree | 370f9c28221b8b47a07d2e744129e705373c6d9a /libgm2/libm2iso | |
parent | acff89c7d7b3af3553a4fb878b2fd767dd27d830 (diff) | |
download | gcc-77924dff144cf934e7a73417d237a99f0d9d66ed.zip gcc-77924dff144cf934e7a73417d237a99f0d9d66ed.tar.gz gcc-77924dff144cf934e7a73417d237a99f0d9d66ed.tar.bz2 |
PR 107630 runtime libs should be self-contained
This is a patch to improve the layering of libgm2.
It removes the m2cor Debug.{def,mod} (the codebase will use
m2pim Debug instead). It also layers SysStorage under
both m2pim Storage and m2iso Storage. SysStorage is now
a dependant of m2pim Storage.mod. Halt parameters for
Debug.mod and M2RTS.mod now have the same order.
gcc/m2/ChangeLog:
* gm2-compiler/SymbolKey.mod (PutSymKey): Halt parameters
reordered.
(DelSymKey): Ditto.
* gm2-compiler/ppg.mod (GetEpsilon): Ditto.
(GetReachEnd): Ditto.
(GetFollow): Ditto.
(CodeCondition): Ditto.
(CodeThenDo): Ditto.
(CodeEnd): Ditto.
(RecoverCondition): Ditto.
(ConditionIndent): Ditto.
* gm2-libs-ch/m2rts.h (M2RTS_Halt): Ditto.
* gm2-libs-coroutines/Executive.mod (Assert): Ditto.
(Resume): Remove redundant comments.
(Wait): Remove redundant comments.
* gm2-libs-coroutines/SYSTEM.mod (TRANSFER): Halt parameters
reordered.
(IOTransferHandler): Ditto.
(Finished): Ditto.
(localInit): Ditto.
* gm2-libs-coroutines/TimerHandler.mod (WaitOn): Halt parameters
reordered.
(Cancel): Ditto.
(ReArmEvent): Ditto.
(OnActiveQueue): Ditto.
* gm2-libs-iso/COROUTINES.mod (NEWCOROUTINE): Ditto.
(Transfer): Ditto.
(IOTRANSFER): Ditto.
* gm2-libs-iso/EXCEPTIONS.mod (RAISE): Correct Halt parameters.
* gm2-libs-iso/M2RTS.def (Halt): Halt parameters reordered.
(HaltC): Ditto.
* gm2-libs-iso/M2RTS.mod: Ditto.
* gm2-libs-iso/RTentity.mod (PutKey): Ditto.
(DelKey): Ditto.
(findChildAndParent): Ditto.
(assert): Ditto.
* gm2-libs-iso/Storage.mod (ALLOCATE): Add DebugTrace.
Add UseMallocFree test.
(DEALLOCATE): Add DebugTrace. Add UseMallocFree test.
(assert): Halt parameters reordered.
* gm2-libs-log/Termbase.mod (Read): Ditto.
(KeyPressed): Ditto.
(Write): Ditto.
(Init): Ditto.
* gm2-libs/Debug.def (Halt): Halt parameters reordered.
* gm2-libs/Debug.mod (Halt): Ditto.
* gm2-libs/DynamicStrings.def (PopAllocation): Improve comment.
* gm2-libs/DynamicStrings.mod (PopAllocation): Improve comment.
Halt parameters reordered.
* gm2-libs/M2RTS.def (Halt): Ditto.
(HaltC): Ditto.
* gm2-libs/M2RTS.mod (Halt): Ditto.
(HaltC): Ditto.
* gm2-libs/PushBackInput.mod (PutStr): Ditto.
(PutString): Ditto.
(PutCh): Ditto.
* gm2-libs/RTExceptions.mod (GetBaseExceptionBlock): Ditto.
* gm2-libs/RTint.mod (ReArmTimeVector): Ditto.
(GetTimeVector): Ditto.
(AttachVector): Ditto.
(IncludeVector): Ditto.
(Listen): Ditto.
* gm2-libs/SysStorage.mod (ALLOCATE): Ditto.
(DEALLOCATE): Ditto.
(REALLOCATE): Ditto.
* gm2-libs-coroutines/Debug.def: Removed.
* gm2-libs-coroutines/Debug.mod: Removed.
libgm2/ChangeLog:
* libm2cor/Makefile.am: Remove
* libm2cor/Makefile.in: Rebuild.
* libm2iso/RTco.cc (newSem): Halt parameters reordered.
(currentThread): Ditto.
(never): Ditto.
(defined): Ditto.
(initThread): Ditto.
* libm2iso/m2rts.h (m2iso_M2RTS_HaltC): Ditto.
gcc/testsuite/ChangeLog:
* gm2/complex/pass/arith3.mod: Halt parameters reordered.
* gm2/complex/run/pass/arith3.mod: Ditto.
* gm2/complex/run/pass/arith4.mod: Ditto.
* gm2/complex/run/pass/arith5.mod: Ditto.
* gm2/isolib/run/pass/real2.mod: Ditto.
* gm2/isolib/run/pass/real3.mod: Ditto.
* gm2/isolib/run/pass/realconv.mod: Ditto.
* gm2/isolib/run/pass/realconv2.mod: Ditto.
* gm2/pim/pass/testshort.mod: Ditto.
* gm2/projects/pim/run/pass/tower/AdvSystem.mod: Ditto.
* gm2/projects/pim/run/pass/tower/DrawL.mod: Ditto.
* gm2/warnings/returntype/pass/Termbase.mod: Ditto.
* gm2/warnings/returntype/pass/keypressedsimple.mod: Ditto.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'libgm2/libm2iso')
-rw-r--r-- | libgm2/libm2iso/RTco.cc | 43 | ||||
-rw-r--r-- | libgm2/libm2iso/m2rts.h | 5 |
2 files changed, 24 insertions, 24 deletions
diff --git a/libgm2/libm2iso/RTco.cc b/libgm2/libm2iso/RTco.cc index 33da586..71d4f4b 100644 --- a/libgm2/libm2iso/RTco.cc +++ b/libgm2/libm2iso/RTco.cc @@ -182,8 +182,8 @@ newSem (void) = (threadSem *)malloc (sizeof (threadSem)); nSemaphores += 1; if (nSemaphores == SEM_POOL) - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "too many semaphores created"); + m2iso_M2RTS_HaltC ("too many semaphores created", + __FILE__, __FUNCTION__, __LINE__); #else threadSem *sem = (threadSem *)malloc (sizeof (threadSem)); @@ -239,8 +239,8 @@ currentThread (void) for (tid = 0; tid < nThreads; tid++) if (pthread_self () == threadArray[tid].p) return tid; - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "failed to find currentThread"); + m2iso_M2RTS_HaltC ("failed to find currentThread", + __FILE__, __FUNCTION__, __LINE__); } extern "C" int @@ -290,8 +290,8 @@ EXPORT(turnInterrupts) (unsigned int newLevel) static void never (void) { - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "the main thread should never call here"); + m2iso_M2RTS_HaltC ("the main thread should never call here", + __FILE__, __FUNCTION__, __LINE__); } static void * @@ -327,8 +327,8 @@ execThread (void *t) #if 0 m2iso_M2RTS_CoroutineException ( __FILE__, __LINE__, __COLUMN__, __FUNCTION__, "coroutine finishing"); #endif - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "execThread should never finish"); + m2iso_M2RTS_HaltC ("execThread should never finish", + __FILE__, __FUNCTION__, __LINE__); return NULL; } @@ -338,8 +338,8 @@ newThread (void) #if defined(POOL) nThreads += 1; if (nThreads == THREAD_POOL) - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "too many threads created"); + m2iso_M2RTS_HaltC ("too many threads created", + __FILE__, __FUNCTION__, __LINE__); return nThreads - 1; #else if (nThreads == 0) @@ -376,15 +376,15 @@ initThread (void (*proc) (void), unsigned int stackSize, /* Set thread creation attributes. */ result = pthread_attr_init (&attr); if (result != 0) - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "failed to create thread attribute"); + m2iso_M2RTS_HaltC ("failed to create thread attribute", + __FILE__, __FUNCTION__, __LINE__); if (stackSize > 0) { result = pthread_attr_setstacksize (&attr, stackSize); if (result != 0) - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "failed to set stack size attribute"); + m2iso_M2RTS_HaltC ("failed to set stack size attribute", + __FILE__, __FUNCTION__, __LINE__); } tprintf ("initThread [%d] function = 0x%p (arg = 0x%p)\n", tid, proc, @@ -392,7 +392,8 @@ initThread (void (*proc) (void), unsigned int stackSize, result = pthread_create (&threadArray[tid].p, &attr, execThread, (void *)&threadArray[tid]); if (result != 0) - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, "thread_create failed"); + m2iso_M2RTS_HaltC ("thread_create failed", + __FILE__, __FUNCTION__, __LINE__); tprintf (" created thread [%d] function = 0x%p 0x%p\n", tid, proc, (void *)&threadArray[tid]); return tid; @@ -422,13 +423,13 @@ EXPORT(transfer) (int *p1, int p2) { int current = currentThread (); if (!initialized) - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "cannot transfer to a process before the process has been created"); + m2iso_M2RTS_HaltC ("cannot transfer to a process before the process has been created", + __FILE__, __FUNCTION__, __LINE__); if (current == p2) { /* Error. */ - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "attempting to transfer to ourself"); + m2iso_M2RTS_HaltC ("attempting to transfer to ourself", + __FILE__, __FUNCTION__, __LINE__); } else { @@ -473,8 +474,8 @@ EXPORT(transfer) (int *p1, int p2) } tprintf ("end, context back to %d\n", current); if (current != old) - m2iso_M2RTS_HaltC (__FILE__, __LINE__, __FUNCTION__, - "wrong process id"); + m2iso_M2RTS_HaltC ("wrong process id", + __FILE__, __FUNCTION__, __LINE__); } } __gthread_mutex_unlock (&lock); diff --git a/libgm2/libm2iso/m2rts.h b/libgm2/libm2iso/m2rts.h index 97612c1..481df9b 100644 --- a/libgm2/libm2iso/m2rts.h +++ b/libgm2/libm2iso/m2rts.h @@ -44,6 +44,5 @@ extern "C" void m2iso_M2RTS_ConstructModules (const char *modulename, const char extern "C" void m2iso_M2RTS_Terminate (void); extern "C" void m2iso_M2RTS_DeconstructModules (void); -extern "C" void m2iso_M2RTS_HaltC (const char *filename, int line, - const char *functionname, const char *desc) - __attribute__ ((noreturn)); +extern "C" void m2iso_M2RTS_HaltC (const char *desc, const char *filename, + const char *functionname, int line) __attribute__ ((noreturn)); |