aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2024-03-08 12:52:04 +0000
committerGaius Mulley <gaiusmod2@gmail.com>2024-03-08 12:52:04 +0000
commit3cdaa6491fe805ffc1dc545722b97660f31572fa (patch)
tree2f3df3be1f8df4b64084f99457bed48e50320de2 /gcc/m2
parent40209cb15a3f2af8233ee887dc960992f358ad86 (diff)
downloadgcc-3cdaa6491fe805ffc1dc545722b97660f31572fa.zip
gcc-3cdaa6491fe805ffc1dc545722b97660f31572fa.tar.gz
gcc-3cdaa6491fe805ffc1dc545722b97660f31572fa.tar.bz2
modula2: Rebuild bootstrap tools with faster dynamic arrays
This patch configures the larger dynamic arrays to use a larger growth factor and larger initial size. It also rebuilds mc and pge using the improved default array sizes in Indexing.mod. gcc/m2/ChangeLog: * gm2-compiler/M2Quads.mod (Init): Use InitIndexTuned with default size 65K. * gm2-compiler/SymbolConversion.mod (Init): Ditto. * gm2-compiler/SymbolTable.mod (BEGIN): Ditto. * mc-boot/GM2Dependent.cc: Rebuild. * mc-boot/GM2Dependent.h: Rebuild. * mc-boot/GM2RTS.cc: Rebuild. * pge-boot/GIndexing.cc: Rebuild. * pge-boot/GIndexing.h: Rebuild. * pge-boot/GM2Dependent.cc: Rebuild. * pge-boot/GM2Dependent.h: Rebuild. * pge-boot/GM2RTS.cc: Rebuild. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'gcc/m2')
-rw-r--r--gcc/m2/gm2-compiler/M2Quads.mod5
-rw-r--r--gcc/m2/gm2-compiler/SymbolConversion.mod6
-rw-r--r--gcc/m2/gm2-compiler/SymbolTable.mod7
-rw-r--r--gcc/m2/mc-boot/GM2Dependent.cc202
-rw-r--r--gcc/m2/mc-boot/GM2Dependent.h32
-rw-r--r--gcc/m2/mc-boot/GM2RTS.cc118
-rw-r--r--gcc/m2/pge-boot/GIndexing.cc59
-rw-r--r--gcc/m2/pge-boot/GIndexing.h15
-rw-r--r--gcc/m2/pge-boot/GM2Dependent.cc202
-rw-r--r--gcc/m2/pge-boot/GM2Dependent.h32
-rw-r--r--gcc/m2/pge-boot/GM2RTS.cc119
11 files changed, 540 insertions, 257 deletions
diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod
index ff0fda9..2be229d 100644
--- a/gcc/m2/gm2-compiler/M2Quads.mod
+++ b/gcc/m2/gm2-compiler/M2Quads.mod
@@ -230,7 +230,8 @@ FROM M2StackWord IMPORT StackOfWord, InitStackWord, KillStackWord,
PushWord, PopWord, PeepWord, RemoveTop,
IsEmptyWord, NoOfItemsInStackWord ;
-FROM Indexing IMPORT Index, InitIndex, GetIndice, PutIndice, InBounds, HighIndice, IncludeIndiceIntoIndex ;
+FROM Indexing IMPORT Index, InitIndex, GetIndice, PutIndice, InBounds, HighIndice,
+ IncludeIndiceIntoIndex, InitIndexTuned ;
FROM M2Range IMPORT InitAssignmentRangeCheck,
InitReturnRangeCheck,
@@ -15451,7 +15452,7 @@ BEGIN
LogicalXorTok := MakeKey('_LXOR') ;
LogicalDifferenceTok := MakeKey('_LDIFF') ;
ArithPlusTok := MakeKey ('_ARITH_+') ;
- QuadArray := InitIndex (1) ;
+ QuadArray := InitIndexTuned (1, 1024*1024 DIV 16, 16) ;
FreeList := 1 ;
NewQuad(NextQuad) ;
Assert(NextQuad=1) ;
diff --git a/gcc/m2/gm2-compiler/SymbolConversion.mod b/gcc/m2/gm2-compiler/SymbolConversion.mod
index c3c484d..b8f0f70 100644
--- a/gcc/m2/gm2-compiler/SymbolConversion.mod
+++ b/gcc/m2/gm2-compiler/SymbolConversion.mod
@@ -24,7 +24,7 @@ IMPLEMENTATION MODULE SymbolConversion ;
FROM NameKey IMPORT Name ;
FROM Indexing IMPORT Index, InitIndex, PutIndice, GetIndice, InBounds,
- DebugIndex ;
+ DebugIndex, InitIndexTuned ;
FROM SymbolTable IMPORT IsConst, PopValue, IsValueSolved, GetSymName,
GetType, SkipType ;
@@ -237,8 +237,8 @@ END Poison ;
PROCEDURE Init ;
BEGIN
- mod2gcc := InitIndex(1) ;
- ALLOCATE(PoisonedSymbol, 1)
+ mod2gcc := InitIndexTuned (1, 1024*1024 DIV 16, 16) ;
+ ALLOCATE (PoisonedSymbol, 1)
END Init ;
diff --git a/gcc/m2/gm2-compiler/SymbolTable.mod b/gcc/m2/gm2-compiler/SymbolTable.mod
index c57c033..b49cc88 100644
--- a/gcc/m2/gm2-compiler/SymbolTable.mod
+++ b/gcc/m2/gm2-compiler/SymbolTable.mod
@@ -28,7 +28,10 @@ FROM M2Debug IMPORT Assert ;
FROM libc IMPORT printf ;
IMPORT Indexing ;
-FROM Indexing IMPORT InitIndex, InBounds, LowIndice, HighIndice, PutIndice, GetIndice ;
+
+FROM Indexing IMPORT InitIndex, InBounds, LowIndice, HighIndice,
+ PutIndice, GetIndice, InitIndexTuned ;
+
FROM Sets IMPORT Set, InitSet, IncludeElementIntoSet, IsElementInSet ;
FROM m2linemap IMPORT location_t ;
@@ -1644,7 +1647,7 @@ BEGIN
InitTree (ConstLitPoolTree) ;
InitTree (DefModuleTree) ;
InitTree (ModuleTree) ;
- Symbols := InitIndex (1) ;
+ Symbols := InitIndexTuned (1, 1024*1024 DIV 16, 16) ;
ConstLitArray := InitIndex (1) ;
FreeSymbol := 1 ;
ScopePtr := 1 ;
diff --git a/gcc/m2/mc-boot/GM2Dependent.cc b/gcc/m2/mc-boot/GM2Dependent.cc
index cda07e8..bf0daab 100644
--- a/gcc/m2/mc-boot/GM2Dependent.cc
+++ b/gcc/m2/mc-boot/GM2Dependent.cc
@@ -55,7 +55,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# include "GSYSTEM.h"
# include "GStorage.h"
# include "GStrLib.h"
-# include "GM2RTS.h"
typedef struct M2Dependent_ArgCVEnvP_p M2Dependent_ArgCVEnvP;
@@ -63,11 +62,17 @@ typedef struct M2Dependent_DependencyList_r M2Dependent_DependencyList;
typedef char *M2Dependent_PtrToChar;
+typedef struct M2Dependent_ProcedureList_r M2Dependent_ProcedureList;
+
typedef struct M2Dependent__T2_r M2Dependent__T2;
typedef M2Dependent__T2 *M2Dependent_ModuleChain;
-typedef struct M2Dependent__T3_a M2Dependent__T3;
+typedef struct M2Dependent__T3_r M2Dependent__T3;
+
+typedef M2Dependent__T3 *M2Dependent_ProcedureChain;
+
+typedef struct M2Dependent__T4_a M2Dependent__T4;
typedef enum {M2Dependent_unregistered, M2Dependent_unordered, M2Dependent_started, M2Dependent_ordered, M2Dependent_user} M2Dependent_DependencyState;
@@ -82,7 +87,18 @@ struct M2Dependent_DependencyList_r {
M2Dependent_DependencyState state;
};
-struct M2Dependent__T3_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; };
+struct M2Dependent_ProcedureList_r {
+ M2Dependent_ProcedureChain head;
+ M2Dependent_ProcedureChain tail;
+ };
+
+struct M2Dependent__T3_r {
+ PROC p;
+ M2Dependent_ProcedureChain prev;
+ M2Dependent_ProcedureChain next;
+ };
+
+struct M2Dependent__T4_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; };
struct M2Dependent__T2_r {
void *name;
void *libname;
@@ -93,7 +109,7 @@ struct M2Dependent__T2_r {
M2Dependent_ModuleChain next;
};
-static M2Dependent__T3 Modules;
+static M2Dependent__T4 Modules;
static bool DynamicInitialization;
static bool Initialized;
static bool WarningTrace;
@@ -103,6 +119,8 @@ static bool DependencyTrace;
static bool PreTrace;
static bool PostTrace;
static bool ForceTrace;
+static M2Dependent_ProcedureList InitialProc;
+static M2Dependent_ProcedureList TerminateProc;
/*
ConstructModules - resolve dependencies and then call each
@@ -135,6 +153,38 @@ extern "C" void M2Dependent_RegisterModule (void * modulename, void * libname, M
extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
/*
+ InstallTerminationProcedure - installs a procedure, p, which will
+ be called when the procedure
+ ExecuteTerminationProcedures
+ is invoked. It returns TRUE if the
+ procedure is installed.
+*/
+
+extern "C" bool M2Dependent_InstallTerminationProcedure (PROC p);
+
+/*
+ ExecuteInitialProcedures - executes the initial procedures installed by
+ InstallInitialProcedure.
+*/
+
+extern "C" void M2Dependent_ExecuteInitialProcedures (void);
+
+/*
+ InstallInitialProcedure - installs a procedure to be executed just
+ before the BEGIN code section of the
+ main program module.
+*/
+
+extern "C" bool M2Dependent_InstallInitialProcedure (PROC p);
+
+/*
+ ExecuteTerminationProcedures - calls each installed termination procedure
+ in reverse order.
+*/
+
+extern "C" void M2Dependent_ExecuteTerminationProcedures (void);
+
+/*
InitDependencyList - initialize all fields of DependencyList.
*/
@@ -359,6 +409,27 @@ static void Init (void);
static void CheckInitialized (void);
+/*
+ ExecuteReverse - execute the procedure associated with procptr
+ and then proceed to try and execute all previous
+ procedures in the chain.
+*/
+
+static void ExecuteReverse (M2Dependent_ProcedureChain procptr);
+
+/*
+ AppendProc - append proc to the end of the procedure list
+ defined by proclist.
+*/
+
+static bool AppendProc (M2Dependent_ProcedureList *proclist, PROC proc);
+
+/*
+ InitProcList - initialize the head and tail pointers to NIL.
+*/
+
+static void InitProcList (M2Dependent_ProcedureList *p);
+
/*
InitDependencyList - initialize all fields of DependencyList.
@@ -965,10 +1036,10 @@ static void combine (M2Dependent_DependencyState src, M2Dependent_DependencyStat
static void tracemodule (bool flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen)
{
- typedef struct tracemodule__T4_a tracemodule__T4;
+ typedef struct tracemodule__T5_a tracemodule__T5;
- struct tracemodule__T4_a { char array[100+1]; };
- tracemodule__T4 buffer;
+ struct tracemodule__T5_a { char array[100+1]; };
+ tracemodule__T5 buffer;
unsigned int len;
if (flag)
@@ -1109,10 +1180,10 @@ static void CheckApplication (void)
static void warning3 (const char *format_, unsigned int _format_high, void * arg1, void * arg2)
{
- typedef struct warning3__T5_a warning3__T5;
+ typedef struct warning3__T6_a warning3__T6;
- struct warning3__T5_a { char array[4096+1]; };
- warning3__T5 buffer;
+ struct warning3__T6_a { char array[4096+1]; };
+ warning3__T6 buffer;
int len;
char format[_format_high+1];
@@ -1251,6 +1322,8 @@ static void Init (void)
{
M2Dependent_DependencyState state;
+ InitProcList (&InitialProc);
+ InitProcList (&TerminateProc);
SetupDebugFlags ();
for (state=M2Dependent_unregistered; state<=M2Dependent_user; state= static_cast<M2Dependent_DependencyState>(static_cast<int>(state+1)))
{
@@ -1278,6 +1351,57 @@ static void CheckInitialized (void)
/*
+ ExecuteReverse - execute the procedure associated with procptr
+ and then proceed to try and execute all previous
+ procedures in the chain.
+*/
+
+static void ExecuteReverse (M2Dependent_ProcedureChain procptr)
+{
+ while (procptr != NULL)
+ {
+ (*procptr->p.proc) (); /* Invoke the procedure. */
+ procptr = procptr->prev; /* Invoke the procedure. */
+ }
+}
+
+
+/*
+ AppendProc - append proc to the end of the procedure list
+ defined by proclist.
+*/
+
+static bool AppendProc (M2Dependent_ProcedureList *proclist, PROC proc)
+{
+ M2Dependent_ProcedureChain pdes;
+
+ Storage_ALLOCATE ((void **) &pdes, sizeof (M2Dependent__T3));
+ pdes->p = proc;
+ pdes->prev = (*proclist).tail;
+ pdes->next = NULL;
+ if ((*proclist).head == NULL)
+ {
+ (*proclist).head = pdes;
+ }
+ (*proclist).tail = pdes;
+ return true;
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ InitProcList - initialize the head and tail pointers to NIL.
+*/
+
+static void InitProcList (M2Dependent_ProcedureList *p)
+{
+ (*p).head = NULL;
+ (*p).tail = NULL;
+}
+
+
+/*
ConstructModules - resolve dependencies and then call each
module constructor in turn.
*/
@@ -1326,8 +1450,8 @@ extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * l
if (mptr->dependency.appl)
{
traceprintf3 (ModuleTrace, (const char *) "application module: %s [%s]\\n", 29, mptr->name, mptr->libname);
- traceprintf (ModuleTrace, (const char *) " calling M2RTS_ExecuteInitialProcedures\\n", 42);
- M2RTS_ExecuteInitialProcedures ();
+ traceprintf (ModuleTrace, (const char *) " calling ExecuteInitialProcedures\\n", 36);
+ M2Dependent_ExecuteInitialProcedures ();
traceprintf (ModuleTrace, (const char *) " calling application module\\n", 30);
}
(*mptr->init.proc) (argc, argv, envp);
@@ -1354,7 +1478,7 @@ extern "C" void M2Dependent_DeconstructModules (void * applicationmodule, void *
else
{
traceprintf (ModuleTrace, (const char *) "ExecuteTerminationProcedures\\n", 30);
- M2RTS_ExecuteTerminationProcedures ();
+ M2Dependent_ExecuteTerminationProcedures ();
traceprintf (ModuleTrace, (const char *) "terminating modules in sequence\\n", 33);
mptr = Modules.array[M2Dependent_ordered-M2Dependent_unregistered]->prev;
do {
@@ -1410,6 +1534,58 @@ extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname,
PerformRequestDependant (modulename, libname, dependantmodule, dependantlibname);
}
+
+/*
+ InstallTerminationProcedure - installs a procedure, p, which will
+ be called when the procedure
+ ExecuteTerminationProcedures
+ is invoked. It returns TRUE if the
+ procedure is installed.
+*/
+
+extern "C" bool M2Dependent_InstallTerminationProcedure (PROC p)
+{
+ return AppendProc (&TerminateProc, p);
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ ExecuteInitialProcedures - executes the initial procedures installed by
+ InstallInitialProcedure.
+*/
+
+extern "C" void M2Dependent_ExecuteInitialProcedures (void)
+{
+ ExecuteReverse (InitialProc.tail);
+}
+
+
+/*
+ InstallInitialProcedure - installs a procedure to be executed just
+ before the BEGIN code section of the
+ main program module.
+*/
+
+extern "C" bool M2Dependent_InstallInitialProcedure (PROC p)
+{
+ return AppendProc (&InitialProc, p);
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ ExecuteTerminationProcedures - calls each installed termination procedure
+ in reverse order.
+*/
+
+extern "C" void M2Dependent_ExecuteTerminationProcedures (void)
+{
+ ExecuteReverse (TerminateProc.tail);
+}
+
extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
CheckInitialized ();
diff --git a/gcc/m2/mc-boot/GM2Dependent.h b/gcc/m2/mc-boot/GM2Dependent.h
index 0a2a60a..0353236 100644
--- a/gcc/m2/mc-boot/GM2Dependent.h
+++ b/gcc/m2/mc-boot/GM2Dependent.h
@@ -72,6 +72,38 @@ EXTERN void M2Dependent_RegisterModule (void * modulename, void * libname, M2Dep
*/
EXTERN void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
+
+/*
+ InstallTerminationProcedure - installs a procedure, p, which will
+ be called when the procedure
+ ExecuteTerminationProcedures
+ is invoked. It returns TRUE is the
+ procedure is installed.
+*/
+
+EXTERN bool M2Dependent_InstallTerminationProcedure (PROC p);
+
+/*
+ ExecuteInitialProcedures - executes the initial procedures installed
+ by InstallInitialProcedure.
+*/
+
+EXTERN void M2Dependent_ExecuteInitialProcedures (void);
+
+/*
+ InstallInitialProcedure - installs a procedure to be executed just
+ before the BEGIN code section of the main
+ program module.
+*/
+
+EXTERN bool M2Dependent_InstallInitialProcedure (PROC p);
+
+/*
+ ExecuteTerminationProcedures - calls each installed termination procedure
+ in reverse order.
+*/
+
+EXTERN void M2Dependent_ExecuteTerminationProcedures (void);
# ifdef __cplusplus
}
# endif
diff --git a/gcc/m2/mc-boot/GM2RTS.cc b/gcc/m2/mc-boot/GM2RTS.cc
index a1fd5f5..d529a78 100644
--- a/gcc/m2/mc-boot/GM2RTS.cc
+++ b/gcc/m2/mc-boot/GM2RTS.cc
@@ -42,11 +42,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define FALSE (1==0)
# endif
-# include "GStorage.h"
-#if defined(__cplusplus)
-# undef NULL
-# define NULL 0
-#endif
#define _M2RTS_H
#define _M2RTS_C
@@ -63,30 +58,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP;
# define stderrFd 2
-typedef struct M2RTS_ProcedureList_r M2RTS_ProcedureList;
-
typedef char *M2RTS_PtrToChar;
-typedef struct M2RTS__T1_r M2RTS__T1;
-
-typedef M2RTS__T1 *M2RTS_ProcedureChain;
-
typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *);
struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; };
-struct M2RTS_ProcedureList_r {
- M2RTS_ProcedureChain head;
- M2RTS_ProcedureChain tail;
- };
-
-struct M2RTS__T1_r {
- PROC p;
- M2RTS_ProcedureChain prev;
- M2RTS_ProcedureChain next;
- };
-
-static M2RTS_ProcedureList InitialProc;
-static M2RTS_ProcedureList TerminateProc;
static int ExitValue;
static bool isHalting;
static bool CallExit;
@@ -236,21 +212,6 @@ extern "C" void M2RTS_ParameterException (void * filename, unsigned int line, un
extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
/*
- ExecuteReverse - execute the procedure associated with procptr
- and then proceed to try and execute all previous
- procedures in the chain.
-*/
-
-static void ExecuteReverse (M2RTS_ProcedureChain procptr);
-
-/*
- AppendProc - append proc to the end of the procedure list
- defined by proclist.
-*/
-
-static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc);
-
-/*
ErrorString - writes a string to stderr.
*/
@@ -269,12 +230,6 @@ static void ErrorStringC (void * str);
static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) __attribute__ ((noreturn));
/*
- InitProcList - initialize the head and tail pointers to NIL.
-*/
-
-static void InitProcList (M2RTS_ProcedureList *p);
-
-/*
Init - initialize the initial, terminate procedure lists and booleans.
*/
@@ -291,46 +246,6 @@ static void CheckInitialized (void);
/*
- ExecuteReverse - execute the procedure associated with procptr
- and then proceed to try and execute all previous
- procedures in the chain.
-*/
-
-static void ExecuteReverse (M2RTS_ProcedureChain procptr)
-{
- while (procptr != NULL)
- {
- (*procptr->p.proc) (); /* Invoke the procedure. */
- procptr = procptr->prev; /* Invoke the procedure. */
- }
-}
-
-
-/*
- AppendProc - append proc to the end of the procedure list
- defined by proclist.
-*/
-
-static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc)
-{
- M2RTS_ProcedureChain pdes;
-
- Storage_ALLOCATE ((void **) &pdes, sizeof (M2RTS__T1));
- pdes->p = proc;
- pdes->prev = (*proclist).tail;
- pdes->next = NULL;
- if ((*proclist).head == NULL)
- {
- (*proclist).head = pdes;
- }
- (*proclist).tail = pdes;
- return true;
- /* static analysis guarentees a RETURN statement will be used before here. */
- __builtin_unreachable ();
-}
-
-
-/*
ErrorString - writes a string to stderr.
*/
@@ -364,10 +279,10 @@ static void ErrorStringC (void * str)
static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function)
{
- typedef struct ErrorMessageC__T2_a ErrorMessageC__T2;
+ typedef struct ErrorMessageC__T1_a ErrorMessageC__T1;
- struct ErrorMessageC__T2_a { char array[10+1]; };
- ErrorMessageC__T2 buffer;
+ struct ErrorMessageC__T1_a { char array[10+1]; };
+ ErrorMessageC__T1 buffer;
ErrorStringC (filename);
ErrorString ((const char *) ":", 1);
@@ -389,24 +304,11 @@ static void ErrorMessageC (void * message, void * filename, unsigned int line, v
/*
- InitProcList - initialize the head and tail pointers to NIL.
-*/
-
-static void InitProcList (M2RTS_ProcedureList *p)
-{
- (*p).head = NULL;
- (*p).tail = NULL;
-}
-
-
-/*
Init - initialize the initial, terminate procedure lists and booleans.
*/
static void Init (void)
{
- InitProcList (&InitialProc);
- InitProcList (&TerminateProc);
ExitValue = 0;
isHalting = false;
CallExit = false; /* default by calling abort */
@@ -485,7 +387,7 @@ extern "C" void M2RTS_RequestDependant (void * modulename, void * libname, void
extern "C" bool M2RTS_InstallTerminationProcedure (PROC p)
{
- return AppendProc (&TerminateProc, p);
+ return M2Dependent_InstallTerminationProcedure (p);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@@ -498,7 +400,7 @@ extern "C" bool M2RTS_InstallTerminationProcedure (PROC p)
extern "C" void M2RTS_ExecuteInitialProcedures (void)
{
- ExecuteReverse (InitialProc.tail);
+ M2Dependent_ExecuteInitialProcedures ();
}
@@ -510,7 +412,7 @@ extern "C" void M2RTS_ExecuteInitialProcedures (void)
extern "C" bool M2RTS_InstallInitialProcedure (PROC p)
{
- return AppendProc (&InitialProc, p);
+ return M2Dependent_InstallInitialProcedure (p);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@@ -523,7 +425,7 @@ extern "C" bool M2RTS_InstallInitialProcedure (PROC p)
extern "C" void M2RTS_ExecuteTerminationProcedures (void)
{
- ExecuteReverse (TerminateProc.tail);
+ M2Dependent_ExecuteTerminationProcedures ();
}
@@ -629,10 +531,10 @@ extern "C" void M2RTS_ExitOnHalt (int e)
extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high)
{
- typedef struct ErrorMessage__T3_a ErrorMessage__T3;
+ typedef struct ErrorMessage__T2_a ErrorMessage__T2;
- struct ErrorMessage__T3_a { char array[10+1]; };
- ErrorMessage__T3 buffer;
+ struct ErrorMessage__T2_a { char array[10+1]; };
+ ErrorMessage__T2 buffer;
char message[_message_high+1];
char filename[_filename_high+1];
char function[_function_high+1];
diff --git a/gcc/m2/pge-boot/GIndexing.cc b/gcc/m2/pge-boot/GIndexing.cc
index c898a24..21e3a43 100644
--- a/gcc/m2/pge-boot/GIndexing.cc
+++ b/gcc/m2/pge-boot/GIndexing.cc
@@ -59,14 +59,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct Indexing_IndexProcedure_p Indexing_IndexProcedure;
# define MinSize 128
+# define DefaultGrowFactor 2
typedef struct Indexing__T2_r Indexing__T2;
typedef void * *Indexing_PtrToAddress;
-typedef Indexing__T2 *Indexing_Index;
-
typedef unsigned char *Indexing_PtrToByte;
+typedef Indexing__T2 *Indexing_Index;
+
typedef void (*Indexing_IndexProcedure_t) (void *);
struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; };
@@ -78,10 +79,20 @@ struct Indexing__T2_r {
unsigned int High;
bool Debug;
unsigned int Map;
+ unsigned int GrowFactor;
};
/*
+ InitIndexTuned - creates a dynamic array with low indice.
+ The minsize is the initial number of elements the
+ array is allocated and growfactor determines how
+ it will be resized once it becomes full.
+*/
+
+extern "C" Indexing_Index Indexing_InitIndexTuned (unsigned int low, unsigned int minsize, unsigned int growfactor);
+
+/*
InitIndex - creates and returns an Index.
*/
@@ -161,24 +172,34 @@ extern "C" void Indexing_IncludeIndiceIntoIndex (Indexing_Index i, void * a);
extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_IndexProcedure p);
+/*
+ IsEmpty - return TRUE if the array has no entries it.
+*/
+
+extern "C" bool Indexing_IsEmpty (Indexing_Index i);
+
/*
- InitIndex - creates and returns an Index.
+ InitIndexTuned - creates a dynamic array with low indice.
+ The minsize is the initial number of elements the
+ array is allocated and growfactor determines how
+ it will be resized once it becomes full.
*/
-extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
+extern "C" Indexing_Index Indexing_InitIndexTuned (unsigned int low, unsigned int minsize, unsigned int growfactor)
{
Indexing_Index i;
Storage_ALLOCATE ((void **) &i, sizeof (Indexing__T2));
i->Low = low;
i->High = 0;
- i->ArraySize = MinSize;
- Storage_ALLOCATE (&i->ArrayStart, MinSize);
+ i->ArraySize = minsize*sizeof (void *);
+ Storage_ALLOCATE (&i->ArrayStart, i->ArraySize);
i->ArrayStart = libc_memset (i->ArrayStart, 0, static_cast<size_t> (i->ArraySize));
i->Debug = false;
i->Used = 0;
i->Map = (unsigned int) 0;
+ i->GrowFactor = growfactor;
return i;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
@@ -186,6 +207,18 @@ extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
/*
+ InitIndex - creates and returns an Index.
+*/
+
+extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
+{
+ return Indexing_InitIndexTuned (low, MinSize, DefaultGrowFactor);
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
KillIndex - returns Index to free storage.
*/
@@ -298,7 +331,7 @@ extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a)
oldSize = i->ArraySize;
while (((n-i->Low)*sizeof (void *)) >= i->ArraySize)
{
- i->ArraySize = i->ArraySize*2;
+ i->ArraySize = i->ArraySize*i->GrowFactor;
}
if (oldSize != i->ArraySize)
{
@@ -484,6 +517,18 @@ extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_Inde
}
}
+
+/*
+ IsEmpty - return TRUE if the array has no entries it.
+*/
+
+extern "C" bool Indexing_IsEmpty (Indexing_Index i)
+{
+ return i->Used == 0;
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
}
diff --git a/gcc/m2/pge-boot/GIndexing.h b/gcc/m2/pge-boot/GIndexing.h
index 63bef37..d65e8bd 100644
--- a/gcc/m2/pge-boot/GIndexing.h
+++ b/gcc/m2/pge-boot/GIndexing.h
@@ -61,6 +61,15 @@ struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; };
/*
+ InitIndexTuned - creates a dynamic array with low indice.
+ minsize is the initial number of elements the
+ array is allocated and growfactor determines how
+ it will be resized once it becomes full.
+*/
+
+EXTERN Indexing_Index Indexing_InitIndexTuned (unsigned int low, unsigned int minsize, unsigned int growfactor);
+
+/*
InitIndex - creates and returns an Index.
*/
@@ -139,6 +148,12 @@ EXTERN void Indexing_IncludeIndiceIntoIndex (Indexing_Index i, void * a);
*/
EXTERN void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_IndexProcedure p);
+
+/*
+ IsEmpty - return TRUE if the array has no entries it.
+*/
+
+EXTERN bool Indexing_IsEmpty (Indexing_Index i);
# ifdef __cplusplus
}
# endif
diff --git a/gcc/m2/pge-boot/GM2Dependent.cc b/gcc/m2/pge-boot/GM2Dependent.cc
index 4a4492a..89c8083 100644
--- a/gcc/m2/pge-boot/GM2Dependent.cc
+++ b/gcc/m2/pge-boot/GM2Dependent.cc
@@ -58,7 +58,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# include "GSYSTEM.h"
# include "GStorage.h"
# include "GStrLib.h"
-# include "GM2RTS.h"
typedef struct M2Dependent_ArgCVEnvP_p M2Dependent_ArgCVEnvP;
@@ -66,11 +65,17 @@ typedef struct M2Dependent_DependencyList_r M2Dependent_DependencyList;
typedef char *M2Dependent_PtrToChar;
+typedef struct M2Dependent_ProcedureList_r M2Dependent_ProcedureList;
+
typedef struct M2Dependent__T2_r M2Dependent__T2;
typedef M2Dependent__T2 *M2Dependent_ModuleChain;
-typedef struct M2Dependent__T3_a M2Dependent__T3;
+typedef struct M2Dependent__T3_r M2Dependent__T3;
+
+typedef M2Dependent__T3 *M2Dependent_ProcedureChain;
+
+typedef struct M2Dependent__T4_a M2Dependent__T4;
typedef enum {M2Dependent_unregistered, M2Dependent_unordered, M2Dependent_started, M2Dependent_ordered, M2Dependent_user} M2Dependent_DependencyState;
@@ -85,7 +90,18 @@ struct M2Dependent_DependencyList_r {
M2Dependent_DependencyState state;
};
-struct M2Dependent__T3_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; };
+struct M2Dependent_ProcedureList_r {
+ M2Dependent_ProcedureChain head;
+ M2Dependent_ProcedureChain tail;
+ };
+
+struct M2Dependent__T3_r {
+ PROC p;
+ M2Dependent_ProcedureChain prev;
+ M2Dependent_ProcedureChain next;
+ };
+
+struct M2Dependent__T4_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; };
struct M2Dependent__T2_r {
void *name;
void *libname;
@@ -96,7 +112,7 @@ struct M2Dependent__T2_r {
M2Dependent_ModuleChain next;
};
-static M2Dependent__T3 Modules;
+static M2Dependent__T4 Modules;
static bool DynamicInitialization;
static bool Initialized;
static bool WarningTrace;
@@ -106,6 +122,8 @@ static bool DependencyTrace;
static bool PreTrace;
static bool PostTrace;
static bool ForceTrace;
+static M2Dependent_ProcedureList InitialProc;
+static M2Dependent_ProcedureList TerminateProc;
/*
ConstructModules - resolve dependencies and then call each
@@ -138,6 +156,38 @@ extern "C" void M2Dependent_RegisterModule (void * modulename, void * libname, M
extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
/*
+ InstallTerminationProcedure - installs a procedure, p, which will
+ be called when the procedure
+ ExecuteTerminationProcedures
+ is invoked. It returns TRUE if the
+ procedure is installed.
+*/
+
+extern "C" bool M2Dependent_InstallTerminationProcedure (PROC p);
+
+/*
+ ExecuteInitialProcedures - executes the initial procedures installed by
+ InstallInitialProcedure.
+*/
+
+extern "C" void M2Dependent_ExecuteInitialProcedures (void);
+
+/*
+ InstallInitialProcedure - installs a procedure to be executed just
+ before the BEGIN code section of the
+ main program module.
+*/
+
+extern "C" bool M2Dependent_InstallInitialProcedure (PROC p);
+
+/*
+ ExecuteTerminationProcedures - calls each installed termination procedure
+ in reverse order.
+*/
+
+extern "C" void M2Dependent_ExecuteTerminationProcedures (void);
+
+/*
InitDependencyList - initialize all fields of DependencyList.
*/
@@ -362,6 +412,27 @@ static void Init (void);
static void CheckInitialized (void);
+/*
+ ExecuteReverse - execute the procedure associated with procptr
+ and then proceed to try and execute all previous
+ procedures in the chain.
+*/
+
+static void ExecuteReverse (M2Dependent_ProcedureChain procptr);
+
+/*
+ AppendProc - append proc to the end of the procedure list
+ defined by proclist.
+*/
+
+static bool AppendProc (M2Dependent_ProcedureList *proclist, PROC proc);
+
+/*
+ InitProcList - initialize the head and tail pointers to NIL.
+*/
+
+static void InitProcList (M2Dependent_ProcedureList *p);
+
/*
InitDependencyList - initialize all fields of DependencyList.
@@ -968,10 +1039,10 @@ static void combine (M2Dependent_DependencyState src, M2Dependent_DependencyStat
static void tracemodule (bool flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen)
{
- typedef struct tracemodule__T4_a tracemodule__T4;
+ typedef struct tracemodule__T5_a tracemodule__T5;
- struct tracemodule__T4_a { char array[100+1]; };
- tracemodule__T4 buffer;
+ struct tracemodule__T5_a { char array[100+1]; };
+ tracemodule__T5 buffer;
unsigned int len;
if (flag)
@@ -1112,10 +1183,10 @@ static void CheckApplication (void)
static void warning3 (const char *format_, unsigned int _format_high, void * arg1, void * arg2)
{
- typedef struct warning3__T5_a warning3__T5;
+ typedef struct warning3__T6_a warning3__T6;
- struct warning3__T5_a { char array[4096+1]; };
- warning3__T5 buffer;
+ struct warning3__T6_a { char array[4096+1]; };
+ warning3__T6 buffer;
int len;
char format[_format_high+1];
@@ -1254,6 +1325,8 @@ static void Init (void)
{
M2Dependent_DependencyState state;
+ InitProcList (&InitialProc);
+ InitProcList (&TerminateProc);
SetupDebugFlags ();
for (state=M2Dependent_unregistered; state<=M2Dependent_user; state= static_cast<M2Dependent_DependencyState>(static_cast<int>(state+1)))
{
@@ -1281,6 +1354,57 @@ static void CheckInitialized (void)
/*
+ ExecuteReverse - execute the procedure associated with procptr
+ and then proceed to try and execute all previous
+ procedures in the chain.
+*/
+
+static void ExecuteReverse (M2Dependent_ProcedureChain procptr)
+{
+ while (procptr != NULL)
+ {
+ (*procptr->p.proc) (); /* Invoke the procedure. */
+ procptr = procptr->prev; /* Invoke the procedure. */
+ }
+}
+
+
+/*
+ AppendProc - append proc to the end of the procedure list
+ defined by proclist.
+*/
+
+static bool AppendProc (M2Dependent_ProcedureList *proclist, PROC proc)
+{
+ M2Dependent_ProcedureChain pdes;
+
+ Storage_ALLOCATE ((void **) &pdes, sizeof (M2Dependent__T3));
+ pdes->p = proc;
+ pdes->prev = (*proclist).tail;
+ pdes->next = NULL;
+ if ((*proclist).head == NULL)
+ {
+ (*proclist).head = pdes;
+ }
+ (*proclist).tail = pdes;
+ return true;
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ InitProcList - initialize the head and tail pointers to NIL.
+*/
+
+static void InitProcList (M2Dependent_ProcedureList *p)
+{
+ (*p).head = NULL;
+ (*p).tail = NULL;
+}
+
+
+/*
ConstructModules - resolve dependencies and then call each
module constructor in turn.
*/
@@ -1329,8 +1453,8 @@ extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * l
if (mptr->dependency.appl)
{
traceprintf3 (ModuleTrace, (const char *) "application module: %s [%s]\\n", 29, mptr->name, mptr->libname);
- traceprintf (ModuleTrace, (const char *) " calling M2RTS_ExecuteInitialProcedures\\n", 42);
- M2RTS_ExecuteInitialProcedures ();
+ traceprintf (ModuleTrace, (const char *) " calling ExecuteInitialProcedures\\n", 36);
+ M2Dependent_ExecuteInitialProcedures ();
traceprintf (ModuleTrace, (const char *) " calling application module\\n", 30);
}
(*mptr->init.proc) (argc, argv, envp);
@@ -1357,7 +1481,7 @@ extern "C" void M2Dependent_DeconstructModules (void * applicationmodule, void *
else
{
traceprintf (ModuleTrace, (const char *) "ExecuteTerminationProcedures\\n", 30);
- M2RTS_ExecuteTerminationProcedures ();
+ M2Dependent_ExecuteTerminationProcedures ();
traceprintf (ModuleTrace, (const char *) "terminating modules in sequence\\n", 33);
mptr = Modules.array[M2Dependent_ordered-M2Dependent_unregistered]->prev;
do {
@@ -1413,6 +1537,58 @@ extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname,
PerformRequestDependant (modulename, libname, dependantmodule, dependantlibname);
}
+
+/*
+ InstallTerminationProcedure - installs a procedure, p, which will
+ be called when the procedure
+ ExecuteTerminationProcedures
+ is invoked. It returns TRUE if the
+ procedure is installed.
+*/
+
+extern "C" bool M2Dependent_InstallTerminationProcedure (PROC p)
+{
+ return AppendProc (&TerminateProc, p);
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ ExecuteInitialProcedures - executes the initial procedures installed by
+ InstallInitialProcedure.
+*/
+
+extern "C" void M2Dependent_ExecuteInitialProcedures (void)
+{
+ ExecuteReverse (InitialProc.tail);
+}
+
+
+/*
+ InstallInitialProcedure - installs a procedure to be executed just
+ before the BEGIN code section of the
+ main program module.
+*/
+
+extern "C" bool M2Dependent_InstallInitialProcedure (PROC p)
+{
+ return AppendProc (&InitialProc, p);
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ ExecuteTerminationProcedures - calls each installed termination procedure
+ in reverse order.
+*/
+
+extern "C" void M2Dependent_ExecuteTerminationProcedures (void)
+{
+ ExecuteReverse (TerminateProc.tail);
+}
+
extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
{
CheckInitialized ();
diff --git a/gcc/m2/pge-boot/GM2Dependent.h b/gcc/m2/pge-boot/GM2Dependent.h
index 0a2a60a..0353236 100644
--- a/gcc/m2/pge-boot/GM2Dependent.h
+++ b/gcc/m2/pge-boot/GM2Dependent.h
@@ -72,6 +72,38 @@ EXTERN void M2Dependent_RegisterModule (void * modulename, void * libname, M2Dep
*/
EXTERN void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
+
+/*
+ InstallTerminationProcedure - installs a procedure, p, which will
+ be called when the procedure
+ ExecuteTerminationProcedures
+ is invoked. It returns TRUE is the
+ procedure is installed.
+*/
+
+EXTERN bool M2Dependent_InstallTerminationProcedure (PROC p);
+
+/*
+ ExecuteInitialProcedures - executes the initial procedures installed
+ by InstallInitialProcedure.
+*/
+
+EXTERN void M2Dependent_ExecuteInitialProcedures (void);
+
+/*
+ InstallInitialProcedure - installs a procedure to be executed just
+ before the BEGIN code section of the main
+ program module.
+*/
+
+EXTERN bool M2Dependent_InstallInitialProcedure (PROC p);
+
+/*
+ ExecuteTerminationProcedures - calls each installed termination procedure
+ in reverse order.
+*/
+
+EXTERN void M2Dependent_ExecuteTerminationProcedures (void);
# ifdef __cplusplus
}
# endif
diff --git a/gcc/m2/pge-boot/GM2RTS.cc b/gcc/m2/pge-boot/GM2RTS.cc
index 827eeab..5214c42 100644
--- a/gcc/m2/pge-boot/GM2RTS.cc
+++ b/gcc/m2/pge-boot/GM2RTS.cc
@@ -40,16 +40,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define FALSE (1==0)
# endif
-#include <stddef.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
-# include "GStorage.h"
#include <unistd.h>
-#if defined(__cplusplus)
-# undef NULL
-# define NULL 0
-#endif
#define _M2RTS_H
#define _M2RTS_C
@@ -66,30 +60,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP;
# define stderrFd 2
-typedef struct M2RTS_ProcedureList_r M2RTS_ProcedureList;
-
typedef char *M2RTS_PtrToChar;
-typedef struct M2RTS__T1_r M2RTS__T1;
-
-typedef M2RTS__T1 *M2RTS_ProcedureChain;
-
typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *);
struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; };
-struct M2RTS_ProcedureList_r {
- M2RTS_ProcedureChain head;
- M2RTS_ProcedureChain tail;
- };
-
-struct M2RTS__T1_r {
- PROC p;
- M2RTS_ProcedureChain prev;
- M2RTS_ProcedureChain next;
- };
-
-static M2RTS_ProcedureList InitialProc;
-static M2RTS_ProcedureList TerminateProc;
static int ExitValue;
static bool isHalting;
static bool CallExit;
@@ -239,21 +214,6 @@ extern "C" void M2RTS_ParameterException (void * filename, unsigned int line, un
extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message);
/*
- ExecuteReverse - execute the procedure associated with procptr
- and then proceed to try and execute all previous
- procedures in the chain.
-*/
-
-static void ExecuteReverse (M2RTS_ProcedureChain procptr);
-
-/*
- AppendProc - append proc to the end of the procedure list
- defined by proclist.
-*/
-
-static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc);
-
-/*
ErrorString - writes a string to stderr.
*/
@@ -272,12 +232,6 @@ static void ErrorStringC (void * str);
static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function);
/*
- InitProcList - initialize the head and tail pointers to NIL.
-*/
-
-static void InitProcList (M2RTS_ProcedureList *p);
-
-/*
Init - initialize the initial, terminate procedure lists and booleans.
*/
@@ -294,46 +248,6 @@ static void CheckInitialized (void);
/*
- ExecuteReverse - execute the procedure associated with procptr
- and then proceed to try and execute all previous
- procedures in the chain.
-*/
-
-static void ExecuteReverse (M2RTS_ProcedureChain procptr)
-{
- while (procptr != NULL)
- {
- (*procptr->p.proc) (); /* Invoke the procedure. */
- procptr = procptr->prev; /* Invoke the procedure. */
- }
-}
-
-
-/*
- AppendProc - append proc to the end of the procedure list
- defined by proclist.
-*/
-
-static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc)
-{
- M2RTS_ProcedureChain pdes;
-
- Storage_ALLOCATE ((void **) &pdes, sizeof (M2RTS__T1));
- pdes->p = proc;
- pdes->prev = (*proclist).tail;
- pdes->next = NULL;
- if ((*proclist).head == NULL)
- {
- (*proclist).head = pdes;
- }
- (*proclist).tail = pdes;
- return true;
- /* static analysis guarentees a RETURN statement will be used before here. */
- __builtin_unreachable ();
-}
-
-
-/*
ErrorString - writes a string to stderr.
*/
@@ -367,10 +281,10 @@ static void ErrorStringC (void * str)
static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function)
{
- typedef struct ErrorMessageC__T2_a ErrorMessageC__T2;
+ typedef struct ErrorMessageC__T1_a ErrorMessageC__T1;
- struct ErrorMessageC__T2_a { char array[10+1]; };
- ErrorMessageC__T2 buffer;
+ struct ErrorMessageC__T1_a { char array[10+1]; };
+ ErrorMessageC__T1 buffer;
ErrorStringC (filename);
ErrorString ((const char *) ":", 1);
@@ -392,24 +306,11 @@ static void ErrorMessageC (void * message, void * filename, unsigned int line, v
/*
- InitProcList - initialize the head and tail pointers to NIL.
-*/
-
-static void InitProcList (M2RTS_ProcedureList *p)
-{
- (*p).head = NULL;
- (*p).tail = NULL;
-}
-
-
-/*
Init - initialize the initial, terminate procedure lists and booleans.
*/
static void Init (void)
{
- InitProcList (&InitialProc);
- InitProcList (&TerminateProc);
ExitValue = 0;
isHalting = false;
CallExit = false; /* default by calling abort */
@@ -488,7 +389,7 @@ extern "C" void M2RTS_RequestDependant (void * modulename, void * libname, void
extern "C" bool M2RTS_InstallTerminationProcedure (PROC p)
{
- return AppendProc (&TerminateProc, p);
+ return M2Dependent_InstallTerminationProcedure (p);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@@ -501,7 +402,7 @@ extern "C" bool M2RTS_InstallTerminationProcedure (PROC p)
extern "C" void M2RTS_ExecuteInitialProcedures (void)
{
- ExecuteReverse (InitialProc.tail);
+ M2Dependent_ExecuteInitialProcedures ();
}
@@ -513,7 +414,7 @@ extern "C" void M2RTS_ExecuteInitialProcedures (void)
extern "C" bool M2RTS_InstallInitialProcedure (PROC p)
{
- return AppendProc (&InitialProc, p);
+ return M2Dependent_InstallInitialProcedure (p);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@@ -526,7 +427,7 @@ extern "C" bool M2RTS_InstallInitialProcedure (PROC p)
extern "C" void M2RTS_ExecuteTerminationProcedures (void)
{
- ExecuteReverse (TerminateProc.tail);
+ M2Dependent_ExecuteTerminationProcedures ();
}
@@ -632,10 +533,10 @@ extern "C" void M2RTS_ExitOnHalt (int e)
extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high)
{
- typedef struct ErrorMessage__T3_a ErrorMessage__T3;
+ typedef struct ErrorMessage__T2_a ErrorMessage__T2;
- struct ErrorMessage__T3_a { char array[10+1]; };
- ErrorMessage__T3 buffer;
+ struct ErrorMessage__T2_a { char array[10+1]; };
+ ErrorMessage__T2 buffer;
char message[_message_high+1];
char filename[_filename_high+1];
char function[_function_high+1];