fix init order to have terms when setting up Prolog flags
This commit is contained in:
parent
abe9f20a85
commit
0e89a9c2ff
@ -3050,42 +3050,11 @@ YAP_Init(YAP_init_args *yap_init)
|
|||||||
yap_init->SchedulerLoop,
|
yap_init->SchedulerLoop,
|
||||||
yap_init->DelayedReleaseLoad
|
yap_init->DelayedReleaseLoad
|
||||||
);
|
);
|
||||||
#if THREADS
|
|
||||||
/* make sure we use the correct value of regcache */
|
|
||||||
regcache = ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key));
|
|
||||||
#endif
|
|
||||||
#if USE_SYSTEM_MALLOC
|
|
||||||
if (Trail < MinTrailSpace)
|
|
||||||
Trail = MinTrailSpace;
|
|
||||||
if (Stack < MinStackSpace)
|
|
||||||
Stack = MinStackSpace;
|
|
||||||
if (!(LOCAL_GlobalBase = (ADDR)malloc((Trail+Stack)*1024))) {
|
|
||||||
yap_init->ErrorNo = RESOURCE_ERROR_MEMORY;
|
|
||||||
yap_init->ErrorCause = "could not allocate stack space for main thread";
|
|
||||||
return YAP_BOOT_ERROR;
|
|
||||||
}
|
|
||||||
#if THREADS
|
|
||||||
/* don't forget this is a thread */
|
|
||||||
LOCAL_ThreadHandle.stack_address = LOCAL_GlobalBase;
|
|
||||||
LOCAL_ThreadHandle.ssize = Trail+Stack;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
GLOBAL_AllowGlobalExpansion = TRUE;
|
|
||||||
GLOBAL_AllowLocalExpansion = TRUE;
|
|
||||||
GLOBAL_AllowTrailExpansion = TRUE;
|
|
||||||
Yap_InitExStacks (0, Trail, Stack);
|
|
||||||
if (yap_init->QuietMode) {
|
if (yap_init->QuietMode) {
|
||||||
yap_flags[QUIET_MODE_FLAG] = TRUE;
|
yap_flags[QUIET_MODE_FLAG] = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ BACKUP_MACHINE_REGS();
|
{ if (yap_init->YapPrologRCFile != NULL) {
|
||||||
Yap_InitYaamRegs( 0 );
|
|
||||||
|
|
||||||
#if HAVE_MPE
|
|
||||||
Yap_InitMPE ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (yap_init->YapPrologRCFile != NULL) {
|
|
||||||
/*
|
/*
|
||||||
This must be done before restore, otherwise
|
This must be done before restore, otherwise
|
||||||
restore will print out messages ....
|
restore will print out messages ....
|
||||||
|
30
C/init.c
30
C/init.c
@ -884,6 +884,13 @@ InitStdPreds(void)
|
|||||||
{
|
{
|
||||||
Yap_InitCPreds();
|
Yap_InitCPreds();
|
||||||
Yap_InitBackCPreds();
|
Yap_InitBackCPreds();
|
||||||
|
BACKUP_MACHINE_REGS();
|
||||||
|
Yap_InitYaamRegs( 0 );
|
||||||
|
|
||||||
|
#if HAVE_MPE
|
||||||
|
Yap_InitMPE ();
|
||||||
|
#endif
|
||||||
|
initIO();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1334,6 +1341,29 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
|
|||||||
InitDebug();
|
InitDebug();
|
||||||
InitVersion();
|
InitVersion();
|
||||||
Yap_InitSysPath();
|
Yap_InitSysPath();
|
||||||
|
#if THREADS
|
||||||
|
/* make sure we use the correct value of regcache */
|
||||||
|
regcache = ((REGSTORE *)pthread_getspecific(Yap_yaamregs_key));
|
||||||
|
#endif
|
||||||
|
#if USE_SYSTEM_MALLOC
|
||||||
|
if (Trail < MinTrailSpace)
|
||||||
|
Trail = MinTrailSpace;
|
||||||
|
if (Stack < MinStackSpace)
|
||||||
|
Stack = MinStackSpace;
|
||||||
|
if (!(LOCAL_GlobalBase = (ADDR)malloc((Trail+Stack)*1024))) {
|
||||||
|
Yap_Error(RESOURCE_ERROR_MEMORY, 0, "could not allocate stack space for main thread");
|
||||||
|
Yap_exit(1);
|
||||||
|
}
|
||||||
|
#if THREADS
|
||||||
|
/* don't forget this is a thread */
|
||||||
|
LOCAL_ThreadHandle.stack_address = LOCAL_GlobalBase;
|
||||||
|
LOCAL_ThreadHandle.ssize = Trail+Stack;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
GLOBAL_AllowGlobalExpansion = TRUE;
|
||||||
|
GLOBAL_AllowLocalExpansion = TRUE;
|
||||||
|
GLOBAL_AllowTrailExpansion = TRUE;
|
||||||
|
Yap_InitExStacks (0, Trail, Stack);
|
||||||
InitStdPreds();
|
InitStdPreds();
|
||||||
/* make sure tmp area is available */
|
/* make sure tmp area is available */
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user