Merge branch 'master' of ssh://yap.git.sf.net/gitroot/yap/yap-6.3
This commit is contained in:
commit
925b8fec01
@ -53,7 +53,7 @@ Cell *C, OldC;
|
||||
Cell move_structures(Cell c)
|
||||
{
|
||||
Cell *NewC, *NewH;
|
||||
Cell OldC,OldH;
|
||||
Cell OldC,LOCAL_OldH;
|
||||
|
||||
OldC=deref((Cell) c);
|
||||
/*
|
||||
@ -67,7 +67,7 @@ Cell OldC,OldH;
|
||||
return(OldC);
|
||||
}
|
||||
|
||||
OldH=(Cell) beam_H;
|
||||
LOCAL_OldH=(Cell) beam_H;
|
||||
NewH=beam_H;
|
||||
if (isappl(OldC)) {
|
||||
int i,arity;
|
||||
@ -81,7 +81,7 @@ Cell OldC,OldH;
|
||||
NewH++;
|
||||
NewC++;
|
||||
}
|
||||
return(absappl(OldH));
|
||||
return(absappl(LOCAL_OldH));
|
||||
}
|
||||
/* else if (ispair(c)) { */
|
||||
NewC=(Cell *) reppair(OldC);
|
||||
@ -90,7 +90,7 @@ Cell OldC,OldH;
|
||||
NewC++;
|
||||
NewH++;
|
||||
*NewH=move_structures((Cell) NewC);
|
||||
return(abspair(OldH));
|
||||
return(abspair(LOCAL_OldH));
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,7 +440,7 @@ if (a==NULL) return;
|
||||
Cell copy_structures(Cell c)
|
||||
{
|
||||
Cell *NewC, *NewH;
|
||||
Cell OldC,OldH;
|
||||
Cell OldC,LOCAL_OldH;
|
||||
|
||||
OldC=deref((Cell) c);
|
||||
|
||||
@ -451,7 +451,7 @@ Cell OldC,OldH;
|
||||
return(OldC);
|
||||
}
|
||||
|
||||
OldH=(Cell) beam_H;
|
||||
LOCAL_OldH=(Cell) beam_H;
|
||||
NewH=beam_H;
|
||||
if (isappl(OldC)) {
|
||||
int i,arity;
|
||||
@ -465,7 +465,7 @@ Cell OldC,OldH;
|
||||
NewH++;
|
||||
NewC++;
|
||||
}
|
||||
return(absappl(OldH));
|
||||
return(absappl(LOCAL_OldH));
|
||||
}
|
||||
/* else if (ispair(c)) { */
|
||||
NewC=(Cell *) reppair(OldC);
|
||||
@ -474,5 +474,5 @@ Cell OldC,OldH;
|
||||
NewC++;
|
||||
NewH++;
|
||||
*NewH=copy_structures((Cell) NewC);
|
||||
return(abspair(OldH));
|
||||
return(abspair(LOCAL_OldH));
|
||||
}
|
||||
|
@ -748,13 +748,13 @@ void ShowCode_new2(int op, int new1,CELL new4)
|
||||
Yap_plwrite(MkIntTerm(new4), Yap_DebugPutc, 0, 1200);
|
||||
break;
|
||||
default:
|
||||
Yap_DebugPutc (Yap_c_error_stream,'%');
|
||||
Yap_DebugPutc (Yap_c_error_stream,ch);
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,'%');
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,ch);
|
||||
}
|
||||
else
|
||||
Yap_DebugPutc (Yap_c_error_stream,ch);
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,ch);
|
||||
}
|
||||
Yap_DebugPutc (Yap_c_error_stream,'\n');
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,'\n');
|
||||
}
|
||||
|
||||
|
||||
|
272
C/absmi.c
272
C/absmi.c
@ -1186,15 +1186,15 @@ Yap_absmi(int inp)
|
||||
LOCK(PREG->u.p.p->StatisticsForPred.lock);
|
||||
PREG->u.p.p->StatisticsForPred.NOfEntries++;
|
||||
UNLOCK(PREG->u.p.p->StatisticsForPred.lock);
|
||||
ReductionsCounter--;
|
||||
if (ReductionsCounter == 0 && ReductionsCounterOn) {
|
||||
LOCAL_ReductionsCounter--;
|
||||
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
|
||||
saveregs();
|
||||
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
PredEntriesCounter--;
|
||||
if (PredEntriesCounter == 0 && PredEntriesCounterOn) {
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
|
||||
saveregs();
|
||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
@ -1209,8 +1209,8 @@ Yap_absmi(int inp)
|
||||
LOCK(PREG->u.p.p->StatisticsForPred.lock);
|
||||
PREG->u.p.p->StatisticsForPred.NOfRetries++;
|
||||
UNLOCK(PREG->u.p.p->StatisticsForPred.lock);
|
||||
RetriesCounter--;
|
||||
if (RetriesCounter == 0 && RetriesCounterOn) {
|
||||
LOCAL_RetriesCounter--;
|
||||
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
|
||||
/* act as if we had backtracked */
|
||||
ENV = B->cp_env;
|
||||
saveregs();
|
||||
@ -1218,8 +1218,8 @@ Yap_absmi(int inp)
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
PredEntriesCounter--;
|
||||
if (PredEntriesCounter == 0 && PredEntriesCounterOn) {
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
|
||||
ENV = B->cp_env;
|
||||
saveregs();
|
||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
@ -1248,15 +1248,15 @@ Yap_absmi(int inp)
|
||||
LOCK(((PredEntry *)(PREG->u.Otapl.p))->StatisticsForPred.lock);
|
||||
((PredEntry *)(PREG->u.Otapl.p))->StatisticsForPred.NOfRetries++;
|
||||
UNLOCK(((PredEntry *)(PREG->u.Otapl.p))->StatisticsForPred.lock);
|
||||
RetriesCounter--;
|
||||
if (RetriesCounter == 0 && RetriesCounterOn) {
|
||||
LOCAL_RetriesCounter--;
|
||||
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
|
||||
saveregs();
|
||||
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
PredEntriesCounter--;
|
||||
if (PredEntriesCounter == 0 && PredEntriesCounterOn) {
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
|
||||
saveregs();
|
||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
@ -1292,15 +1292,15 @@ Yap_absmi(int inp)
|
||||
}
|
||||
SET_BB(B_YREG);
|
||||
ENDCACHE_Y();
|
||||
RetriesCounter--;
|
||||
if (RetriesCounter == 0) {
|
||||
LOCAL_RetriesCounter--;
|
||||
if (LOCAL_RetriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
PredEntriesCounter--;
|
||||
if (PredEntriesCounter == 0) {
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
@ -1327,15 +1327,15 @@ Yap_absmi(int inp)
|
||||
}
|
||||
restore_yaam_regs(PREG->u.OtaLl.n);
|
||||
restore_args(PREG->u.OtaLl.s);
|
||||
RetriesCounter--;
|
||||
if (RetriesCounter == 0) {
|
||||
LOCAL_RetriesCounter--;
|
||||
if (LOCAL_RetriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
PredEntriesCounter--;
|
||||
if (PredEntriesCounter == 0) {
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
@ -1372,15 +1372,15 @@ Yap_absmi(int inp)
|
||||
/* jump to next alternative */
|
||||
PREG = FAILCODE;
|
||||
} else {
|
||||
RetriesCounter--;
|
||||
if (RetriesCounter == 0) {
|
||||
LOCAL_RetriesCounter--;
|
||||
if (LOCAL_RetriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
PredEntriesCounter--;
|
||||
if (PredEntriesCounter == 0) {
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
@ -1778,15 +1778,15 @@ Yap_absmi(int inp)
|
||||
ENDBOp();
|
||||
|
||||
BOp(count_retry_and_mark, Otapl);
|
||||
RetriesCounter--;
|
||||
if (RetriesCounter == 0) {
|
||||
LOCAL_RetriesCounter--;
|
||||
if (LOCAL_RetriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
PredEntriesCounter--;
|
||||
if (PredEntriesCounter == 0) {
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
@ -2444,12 +2444,12 @@ Yap_absmi(int inp)
|
||||
NoStackExecute:
|
||||
SREG = (CELL *) PREG->u.pp.p;
|
||||
PP = PREG->u.pp.p0;
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
SET_ASP(YREG, E_CB*sizeof(CELL));
|
||||
SREG = YENV;
|
||||
goto noheapleft;
|
||||
}
|
||||
if (ActiveSignals)
|
||||
if (LOCAL_ActiveSignals)
|
||||
goto creep;
|
||||
else
|
||||
goto NoStackExec;
|
||||
@ -2586,24 +2586,24 @@ Yap_absmi(int inp)
|
||||
NoStackCall:
|
||||
PP = PREG->u.Osbpp.p0;
|
||||
/* on X86 machines S will not actually be holding the pointer to pred */
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
goto fail;
|
||||
}
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
PredEntry *ap = PREG->u.Osbpp.p;
|
||||
SREG = (CELL *) ap;
|
||||
goto creepc;
|
||||
}
|
||||
SREG = (CELL *) PREG->u.Osbpp.p;
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
SET_ASP(YREG, PREG->u.Osbpp.s);
|
||||
SREG = YENV;
|
||||
goto noheapleft;
|
||||
}
|
||||
if (ActiveSignals) {
|
||||
if (LOCAL_ActiveSignals) {
|
||||
goto creepc;
|
||||
}
|
||||
SET_ASP(YREG, PREG->u.Osbpp.s);
|
||||
@ -2624,18 +2624,18 @@ Yap_absmi(int inp)
|
||||
{
|
||||
CELL cut_b = LCL0-(CELL *)(SREG[E_CB]);
|
||||
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
goto fail;
|
||||
}
|
||||
/*
|
||||
don't do a creep here; also, if our instruction is followed by
|
||||
a execute_c, just wait a bit more */
|
||||
if ( (ActiveSignals & YAP_CREEP_SIGNAL &&
|
||||
if ( (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL &&
|
||||
/* keep on going if there is something else */
|
||||
!(ActiveSignals & ~YAP_CREEP_SIGNAL)) ||
|
||||
!(LOCAL_ActiveSignals & ~YAP_CREEP_SIGNAL)) ||
|
||||
(PREG->opc != Yap_opcode(_procceed) &&
|
||||
PREG->opc != Yap_opcode(_cut_e))) {
|
||||
GONext();
|
||||
@ -2648,10 +2648,10 @@ Yap_absmi(int inp)
|
||||
}
|
||||
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
goto noheapleft;
|
||||
}
|
||||
if (ActiveSignals) {
|
||||
if (LOCAL_ActiveSignals) {
|
||||
if (Yap_op_from_opcode(PREG->opc) == _cut_e) {
|
||||
/* followed by a cut */
|
||||
ARG1 = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]);
|
||||
@ -2676,16 +2676,16 @@ Yap_absmi(int inp)
|
||||
/* This is easier: I know there is an environment so I cannot do allocate */
|
||||
NoStackCut:
|
||||
/* find something to fool S */
|
||||
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
goto do_cut;
|
||||
}
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
FAIL();
|
||||
}
|
||||
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
SREG = (CELL *)PredRestoreRegs;
|
||||
XREGS[0] = MkIntegerTerm(LCL0-(CELL *)YREG[E_CB]);
|
||||
PREG = NEXTOP(PREG,e);
|
||||
@ -2696,16 +2696,16 @@ Yap_absmi(int inp)
|
||||
|
||||
NoStackCutT:
|
||||
/* find something to fool S */
|
||||
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
goto do_cut_t;
|
||||
}
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
FAIL();
|
||||
}
|
||||
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
SREG = (CELL *)PredRestoreRegs;
|
||||
XREGS[0] = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]);
|
||||
PREG = NEXTOP(PREG,e);
|
||||
@ -2715,16 +2715,16 @@ Yap_absmi(int inp)
|
||||
goto do_cut_t;
|
||||
|
||||
NoStackCutE:
|
||||
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
goto do_cut_t;
|
||||
}
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
FAIL();
|
||||
}
|
||||
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
SREG = (CELL *)PredRestoreRegs;
|
||||
XREGS[0] = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]);
|
||||
PREG = NEXTOP(PREG,e);
|
||||
@ -2737,16 +2737,16 @@ Yap_absmi(int inp)
|
||||
NoStackCommitY:
|
||||
PP = PREG->u.yps.p0;
|
||||
/* find something to fool S */
|
||||
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
goto do_commit_b_y;
|
||||
}
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
FAIL();
|
||||
}
|
||||
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
SREG = (CELL *)PredRestoreRegs;
|
||||
XREGS[0] = YREG[PREG->u.yps.y];
|
||||
PREG = NEXTOP(PREG,yps);
|
||||
@ -2759,16 +2759,16 @@ Yap_absmi(int inp)
|
||||
NoStackCommitX:
|
||||
PP = PREG->u.xps.p0;
|
||||
/* find something to fool S */
|
||||
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
goto do_commit_b_x;
|
||||
}
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
FAIL();
|
||||
}
|
||||
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
SREG = (CELL *)PredRestoreRegs;
|
||||
#if USE_THREADED_CODE
|
||||
if (PREG->opc == (OPCODE)OpAddress[_fcall])
|
||||
@ -2794,18 +2794,18 @@ Yap_absmi(int inp)
|
||||
|
||||
/* Problem: have I got an environment or not? */
|
||||
NoStackFail:
|
||||
if (ActiveSignals && ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals && LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
/* we're happy */
|
||||
goto fail;
|
||||
}
|
||||
/* find something to fool S */
|
||||
if (!ActiveSignals || ActiveSignals & (YAP_CDOVF_SIGNAL)) {
|
||||
if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL)) {
|
||||
goto fail;
|
||||
}
|
||||
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
|
||||
SREG = (CELL *)RepPredProp(Yap_GetPredPropByAtom(AtomFail,0));
|
||||
/* make sure we have the correct environment for continuation */
|
||||
ENV = B->cp_env;
|
||||
@ -2817,24 +2817,24 @@ Yap_absmi(int inp)
|
||||
|
||||
/* don't forget I cannot creep at ; */
|
||||
NoStackEither:
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
goto fail;
|
||||
}
|
||||
PP = PREG->u.Osblp.p0;
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
goto either_notest;
|
||||
}
|
||||
/* find something to fool S */
|
||||
SREG = (CELL *)RepPredProp(Yap_GetPredPropByFunc(FunctorRestoreRegs1,0));
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
SET_ASP(YREG, PREG->u.Osbpp.s);
|
||||
SREG = YENV;
|
||||
goto noheapleft;
|
||||
}
|
||||
if (ActiveSignals) {
|
||||
if (LOCAL_ActiveSignals) {
|
||||
goto creep_either;
|
||||
}
|
||||
ASP = (CELL *) (((char *) YREG) + PREG->u.Osbpp.s);
|
||||
@ -2899,14 +2899,14 @@ Yap_absmi(int inp)
|
||||
goto creep;
|
||||
|
||||
NoStackDExecute:
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
goto fail;
|
||||
}
|
||||
PP = PREG->u.pp.p0;
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
PredEntry *ap = PREG->u.pp.p;
|
||||
|
||||
if (ap->PredFlags & HiddenPredFlag) {
|
||||
@ -2951,14 +2951,14 @@ Yap_absmi(int inp)
|
||||
}
|
||||
/* set SREG for next instructions */
|
||||
SREG = (CELL *) PREG->u.p.p;
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
ASP = YREG+E_CB;
|
||||
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||
SREG = YENV;
|
||||
goto noheapleft;
|
||||
}
|
||||
if (ActiveSignals)
|
||||
if (LOCAL_ActiveSignals)
|
||||
goto creepde;
|
||||
/* try performing garbage collection */
|
||||
|
||||
@ -2978,9 +2978,9 @@ Yap_absmi(int inp)
|
||||
|
||||
/* try performing garbage collection */
|
||||
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
goto fail;
|
||||
}
|
||||
@ -3027,19 +3027,19 @@ Yap_absmi(int inp)
|
||||
/* and now CREEP */
|
||||
|
||||
creep:
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
goto fail;
|
||||
}
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
/* I need this for Windows and other systems where SIGINT
|
||||
is not proceesed by same thread as absmi */
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (Yap_PrologMode & (AbortMode|InterruptMode)) {
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
/* same instruction */
|
||||
if (Yap_PrologMode & InterruptMode) {
|
||||
Yap_PrologMode &= ~InterruptMode;
|
||||
@ -3050,7 +3050,7 @@ Yap_absmi(int inp)
|
||||
}
|
||||
JMPNext();
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
#endif
|
||||
#ifdef SHADOW_S
|
||||
S = SREG;
|
||||
@ -3105,22 +3105,22 @@ Yap_absmi(int inp)
|
||||
ARG1 = (Term) AbsPair(H);
|
||||
|
||||
H += 2;
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
#ifdef COROUTINING
|
||||
if (ActiveSignals & YAP_WAKEUP_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_WAKEUP_SIGNAL) {
|
||||
CreepFlag = CalculateStackGap();
|
||||
ActiveSignals &= ~YAP_WAKEUP_SIGNAL;
|
||||
UNLOCK(SignalLock);
|
||||
LOCAL_ActiveSignals &= ~YAP_WAKEUP_SIGNAL;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
ARG2 = Yap_ListOfWokenGoals();
|
||||
SREG = (CELL *) (WakeUpCode);
|
||||
/* no more goals to wake up */
|
||||
Yap_UpdateTimedVar(WokenGoals, TermNil);
|
||||
Yap_UpdateTimedVar(LOCAL_WokenGoals, TermNil);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
CreepFlag = CalculateStackGap();
|
||||
SREG = (CELL *) CreepCode;
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
}
|
||||
PREG = ((PredEntry *)SREG)->CodeOfPred;
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
@ -7625,16 +7625,16 @@ Yap_absmi(int inp)
|
||||
LOCK(pe->StatisticsForPred.lock);
|
||||
pe->StatisticsForPred.NOfEntries++;
|
||||
UNLOCK(pe->StatisticsForPred.lock);
|
||||
ReductionsCounter--;
|
||||
if (ReductionsCounter == 0 && ReductionsCounterOn) {
|
||||
LOCAL_ReductionsCounter--;
|
||||
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
|
||||
UNLOCKPE(20,pe);
|
||||
saveregs();
|
||||
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
PredEntriesCounter--;
|
||||
if (PredEntriesCounter == 0 && PredEntriesCounterOn) {
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
|
||||
UNLOCKPE(21,pe);
|
||||
saveregs();
|
||||
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
|
||||
@ -7659,7 +7659,7 @@ Yap_absmi(int inp)
|
||||
JMPNext();
|
||||
}
|
||||
}
|
||||
if (!DebugOn) {
|
||||
if (!LOCAL_DebugOn) {
|
||||
PREG = pe->cs.p_code.TrueCodeOfPred;
|
||||
UNLOCKPE(24,pe);
|
||||
JMPNext();
|
||||
@ -11285,9 +11285,9 @@ Yap_absmi(int inp)
|
||||
* We may wake up goals during our attempt to unify the
|
||||
* two terms. If we are adding to the tail of a list of
|
||||
* woken goals that should be ok, but otherwise we need
|
||||
* to restore WokenGoals to its previous value.
|
||||
* to restore LOCAL_WokenGoals to its previous value.
|
||||
*/
|
||||
CELL OldWokenGoals = Yap_ReadTimedVar(WokenGoals);
|
||||
CELL OldWokenGoals = Yap_ReadTimedVar(LOCAL_WokenGoals);
|
||||
|
||||
#endif
|
||||
/* We will have to look inside compound terms */
|
||||
@ -11307,7 +11307,7 @@ Yap_absmi(int inp)
|
||||
opresult = Yap_IUnify(d0, d1);
|
||||
#ifdef COROUTINING
|
||||
/* now restore Woken Goals to its old value */
|
||||
Yap_UpdateTimedVar(WokenGoals, OldWokenGoals);
|
||||
Yap_UpdateTimedVar(LOCAL_WokenGoals, OldWokenGoals);
|
||||
if (OldWokenGoals == TermNil) {
|
||||
Yap_undo_signal(YAP_WAKEUP_SIGNAL);
|
||||
}
|
||||
@ -13234,9 +13234,9 @@ Yap_absmi(int inp)
|
||||
|
||||
ENDD(d0);
|
||||
NoStackPExecute2:
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
goto fail;
|
||||
}
|
||||
@ -13248,7 +13248,7 @@ Yap_absmi(int inp)
|
||||
/* setup GB */
|
||||
WRITEBACK_Y_AS_ENV();
|
||||
YREG[E_CB] = (CELL) B;
|
||||
if (ActiveSignals) {
|
||||
if (LOCAL_ActiveSignals) {
|
||||
goto creep_pe;
|
||||
}
|
||||
saveregs_and_ycache();
|
||||
@ -13439,9 +13439,9 @@ Yap_absmi(int inp)
|
||||
|
||||
ENDD(d0);
|
||||
NoStackPExecute:
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
goto fail;
|
||||
}
|
||||
@ -13453,7 +13453,7 @@ Yap_absmi(int inp)
|
||||
/* setup GB */
|
||||
WRITEBACK_Y_AS_ENV();
|
||||
YREG[E_CB] = (CELL) B;
|
||||
if (ActiveSignals) {
|
||||
if (LOCAL_ActiveSignals) {
|
||||
goto creep_pe;
|
||||
}
|
||||
saveregs_and_ycache();
|
||||
@ -13671,9 +13671,9 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDP(pt0);
|
||||
NoStackPTExecute:
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
goto fail;
|
||||
}
|
||||
@ -13683,9 +13683,9 @@ Yap_absmi(int inp)
|
||||
ASP = ENV_YREG;
|
||||
if (ASP > (CELL *)PROTECT_FROZEN_B(B))
|
||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||
LOCK(SignalLock);
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
UNLOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
saveregs_and_ycache();
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
|
||||
@ -13693,16 +13693,16 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
setregs_and_ycache();
|
||||
LOCK(SignalLock);
|
||||
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
LOCK(LOCAL_SignalLock);
|
||||
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
CreepFlag = CalculateStackGap();
|
||||
if (!ActiveSignals) {
|
||||
UNLOCK(SignalLock);
|
||||
if (!LOCAL_ActiveSignals) {
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
goto execute_after_comma;
|
||||
}
|
||||
}
|
||||
if (ActiveSignals & YAP_TROVF_SIGNAL) {
|
||||
UNLOCK(SignalLock);
|
||||
if (LOCAL_ActiveSignals & YAP_TROVF_SIGNAL) {
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
#ifdef SHADOW_S
|
||||
S = SREG;
|
||||
#endif
|
||||
@ -13713,23 +13713,23 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
setregs_and_ycache();
|
||||
ActiveSignals &= ~YAP_TROVF_SIGNAL;
|
||||
LOCAL_ActiveSignals &= ~YAP_TROVF_SIGNAL;
|
||||
CreepFlag = CalculateStackGap();
|
||||
if (!ActiveSignals) {
|
||||
UNLOCK(SignalLock);
|
||||
if (!LOCAL_ActiveSignals) {
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
goto execute_after_comma;
|
||||
}
|
||||
}
|
||||
if (ActiveSignals) {
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
UNLOCK(SignalLock);
|
||||
if (LOCAL_ActiveSignals) {
|
||||
if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
SREG = YENV;
|
||||
goto noheapleft;
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
goto creep;
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
saveregs_and_ycache();
|
||||
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, Osbpp))) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
|
||||
|
20
C/agc.c
20
C/agc.c
@ -225,16 +225,16 @@ RestoreHashPreds( USES_REGS1 )
|
||||
|
||||
static void init_reg_copies(USES_REGS1)
|
||||
{
|
||||
OldASP = ASP;
|
||||
OldLCL0 = LCL0;
|
||||
OldTR = TR;
|
||||
OldGlobalBase = (CELL *)Yap_GlobalBase;
|
||||
OldH = H;
|
||||
OldH0 = H0;
|
||||
OldTrailBase = Yap_TrailBase;
|
||||
OldTrailTop = Yap_TrailTop;
|
||||
OldHeapBase = Yap_HeapBase;
|
||||
OldHeapTop = HeapTop;
|
||||
LOCAL_OldASP = ASP;
|
||||
LOCAL_OldLCL0 = LCL0;
|
||||
LOCAL_OldTR = TR;
|
||||
LOCAL_OldGlobalBase = (CELL *)Yap_GlobalBase;
|
||||
LOCAL_OldH = H;
|
||||
LOCAL_OldH0 = H0;
|
||||
LOCAL_OldTrailBase = Yap_TrailBase;
|
||||
LOCAL_OldTrailTop = Yap_TrailTop;
|
||||
LOCAL_OldHeapBase = Yap_HeapBase;
|
||||
LOCAL_OldHeapTop = HeapTop;
|
||||
}
|
||||
|
||||
|
||||
|
32
C/alloc.c
32
C/alloc.c
@ -245,8 +245,8 @@ Yap_InitPreAllocCodeSpace(void)
|
||||
{
|
||||
CACHE_REGS
|
||||
char *ptr;
|
||||
UInt sz = ScratchPad.msz;
|
||||
if (ScratchPad.ptr == NULL) {
|
||||
UInt sz = LOCAL_ScratchPad.msz;
|
||||
if (LOCAL_ScratchPad.ptr == NULL) {
|
||||
#if USE_DL_MALLOC
|
||||
LOCK(DLMallocLock);
|
||||
#endif
|
||||
@ -279,12 +279,12 @@ Yap_InitPreAllocCodeSpace(void)
|
||||
#if USE_DL_MALLOC
|
||||
UNLOCK(DLMallocLock);
|
||||
#endif
|
||||
ScratchPad.ptr = ptr;
|
||||
LOCAL_ScratchPad.ptr = ptr;
|
||||
} else {
|
||||
ptr = ScratchPad.ptr;
|
||||
ptr = LOCAL_ScratchPad.ptr;
|
||||
}
|
||||
AuxBase = (ADDR)(ptr);
|
||||
AuxSp = (CELL *)(AuxTop = AuxBase+ScratchPad.sz);
|
||||
AuxSp = (CELL *)(AuxTop = AuxBase+LOCAL_ScratchPad.sz);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -293,11 +293,11 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0, void *cip, int safe)
|
||||
{
|
||||
CACHE_REGS
|
||||
char *ptr;
|
||||
UInt sz = ScratchPad.msz;
|
||||
UInt sz = LOCAL_ScratchPad.msz;
|
||||
if (sz0 < SCRATCH_INC_SIZE)
|
||||
sz0 = SCRATCH_INC_SIZE;
|
||||
if (sz0 < ScratchPad.sz)
|
||||
sz = ScratchPad.sz+sz0;
|
||||
if (sz0 < LOCAL_ScratchPad.sz)
|
||||
sz = LOCAL_ScratchPad.sz+sz0;
|
||||
else
|
||||
sz = sz0;
|
||||
sz = AdjustLargePageSize(sz+sz/4);
|
||||
@ -308,10 +308,10 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0, void *cip, int safe)
|
||||
Yap_PrologMode |= MallocMode;
|
||||
#if INSTRUMENT_MALLOC
|
||||
reallocs++;
|
||||
tmalloc -= ScratchPad.sz;
|
||||
tmalloc -= LOCAL_ScratchPad.sz;
|
||||
tmalloc += sz;
|
||||
#endif
|
||||
if (!(ptr = my_realloc(ScratchPad.ptr, sz, ScratchPad.sz, safe))) {
|
||||
if (!(ptr = my_realloc(LOCAL_ScratchPad.ptr, sz, LOCAL_ScratchPad.sz, safe))) {
|
||||
Yap_PrologMode &= ~MallocMode;
|
||||
#if USE_DL_MALLOC
|
||||
UNLOCK(DLMallocLock);
|
||||
@ -322,8 +322,8 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0, void *cip, int safe)
|
||||
#if USE_DL_MALLOC
|
||||
UNLOCK(DLMallocLock);
|
||||
#endif
|
||||
ScratchPad.sz = ScratchPad.msz = sz;
|
||||
ScratchPad.ptr = ptr;
|
||||
LOCAL_ScratchPad.sz = LOCAL_ScratchPad.msz = sz;
|
||||
LOCAL_ScratchPad.ptr = ptr;
|
||||
AuxBase = ptr;
|
||||
AuxSp = (CELL *)(AuxTop = ptr+sz);
|
||||
return ptr;
|
||||
@ -374,8 +374,8 @@ InitExStacks(int Trail, int Stack)
|
||||
Yap_LocalBase = Yap_GlobalBase + sa;
|
||||
Yap_TrailBase = Yap_LocalBase + sizeof(CELL);
|
||||
|
||||
ScratchPad.ptr = NULL;
|
||||
ScratchPad.sz = ScratchPad.msz = SCRATCH_START_SIZE;
|
||||
LOCAL_ScratchPad.ptr = NULL;
|
||||
LOCAL_ScratchPad.sz = LOCAL_ScratchPad.msz = SCRATCH_START_SIZE;
|
||||
AuxSp = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -1554,8 +1554,8 @@ void
|
||||
Yap_InitExStacks(int Trail, int Stack)
|
||||
{
|
||||
#if USE_DL_MALLOC
|
||||
ScratchPad.ptr = NULL;
|
||||
ScratchPad.sz = ScratchPad.msz = SCRATCH_START_SIZE;
|
||||
LOCAL_ScratchPad.ptr = NULL;
|
||||
LOCAL_ScratchPad.sz = LOCAL_ScratchPad.msz = SCRATCH_START_SIZE;
|
||||
AuxSp = NULL;
|
||||
#endif
|
||||
}
|
||||
|
40
C/amasm.c
40
C/amasm.c
@ -2196,9 +2196,9 @@ static yamop *
|
||||
a_gl(op_numbers opcode, yamop *code_p, int pass_no, struct PSEUDO *cpc, struct intermediates *cip USES_REGS)
|
||||
{
|
||||
#ifdef YAPOR
|
||||
return a_try(opcode, cpc->rnd1, IPredArity, cpc->rnd2 >> 1, cpc->rnd2 & 1, code_p, pass_no, cip);
|
||||
return a_try(opcode, cpc->rnd1, LOCAL_IPredArity, cpc->rnd2 >> 1, cpc->rnd2 & 1, code_p, pass_no, cip);
|
||||
#else
|
||||
return a_try(opcode, cpc->rnd1, IPredArity, code_p, pass_no, cip);
|
||||
return a_try(opcode, cpc->rnd1, LOCAL_IPredArity, code_p, pass_no, cip);
|
||||
#endif /* YAPOR */
|
||||
}
|
||||
|
||||
@ -2981,11 +2981,11 @@ a_special_label(yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
|
||||
|
||||
#ifdef YAPOR
|
||||
#define TRYCODE(G,P) a_try((G), Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1], IPredArity, cip->cpc->rnd2 >> 1, cip->cpc->rnd2 & 1, code_p, pass_no, cip)
|
||||
#define TABLE_TRYCODE(G) a_try((G), (CELL)emit_ilabel(cip->cpc->rnd1, cip), IPredArity, cip->cpc->rnd2 >> 1, cip->cpc->rnd2 & 1, code_p, pass_no, cip)
|
||||
#define TRYCODE(G,P) a_try((G), Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1], LOCAL_IPredArity, cip->cpc->rnd2 >> 1, cip->cpc->rnd2 & 1, code_p, pass_no, cip)
|
||||
#define TABLE_TRYCODE(G) a_try((G), (CELL)emit_ilabel(cip->cpc->rnd1, cip), LOCAL_IPredArity, cip->cpc->rnd2 >> 1, cip->cpc->rnd2 & 1, code_p, pass_no, cip)
|
||||
#else
|
||||
#define TRYCODE(G,P) a_try((G), Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1], IPredArity, code_p, pass_no, cip)
|
||||
#define TABLE_TRYCODE(G) a_try((G), (CELL)emit_ilabel(cip->cpc->rnd1, cip), IPredArity, code_p, pass_no, cip)
|
||||
#define TRYCODE(G,P) a_try((G), Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1], LOCAL_IPredArity, code_p, pass_no, cip)
|
||||
#define TABLE_TRYCODE(G) a_try((G), (CELL)emit_ilabel(cip->cpc->rnd1, cip), LOCAL_IPredArity, code_p, pass_no, cip)
|
||||
#endif /* YAPOR */
|
||||
|
||||
static yamop *
|
||||
@ -3093,22 +3093,22 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
}
|
||||
code_p = cl_u->sc.ClCode;
|
||||
}
|
||||
IPredArity = cip->CurrentPred->ArityOfPE; /* number of args */
|
||||
LOCAL_IPredArity = cip->CurrentPred->ArityOfPE; /* number of args */
|
||||
*entry_codep = code_p;
|
||||
if (tabled) {
|
||||
#if TABLING
|
||||
#ifdef YAPOR
|
||||
code_p = a_try(_table_try_single, (CELL)NEXTOP(code_p,Otapl), IPredArity, 1, 0, code_p, pass_no, cip);
|
||||
code_p = a_try(_table_try_single, (CELL)NEXTOP(code_p,Otapl), LOCAL_IPredArity, 1, 0, code_p, pass_no, cip);
|
||||
#else
|
||||
code_p = a_try(_table_try_single, (CELL)NEXTOP(code_p,Otapl), IPredArity, code_p, pass_no, cip);
|
||||
code_p = a_try(_table_try_single, (CELL)NEXTOP(code_p,Otapl), LOCAL_IPredArity, code_p, pass_no, cip);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
if (dynamic) {
|
||||
#ifdef YAPOR
|
||||
code_p = a_try(_try_me, 0, IPredArity, 1, 0, code_p, pass_no, cip);
|
||||
code_p = a_try(_try_me, 0, LOCAL_IPredArity, 1, 0, code_p, pass_no, cip);
|
||||
#else
|
||||
code_p = a_try(_try_me, 0, IPredArity, code_p, pass_no, cip);
|
||||
code_p = a_try(_try_me, 0, LOCAL_IPredArity, code_p, pass_no, cip);
|
||||
#endif /* YAPOR */
|
||||
}
|
||||
} else {
|
||||
@ -3864,16 +3864,16 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
||||
|
||||
#if USE_SYSTEM_MALLOC
|
||||
if (!cip->label_offset) {
|
||||
if (!Yap_LabelFirstArray && max_label <= DEFAULT_NLABELS) {
|
||||
Yap_LabelFirstArray = (Int *)Yap_AllocCodeSpace(sizeof(Int)*DEFAULT_NLABELS);
|
||||
Yap_LabelFirstArraySz = DEFAULT_NLABELS;
|
||||
if (!Yap_LabelFirstArray) {
|
||||
if (!LOCAL_LabelFirstArray && max_label <= DEFAULT_NLABELS) {
|
||||
LOCAL_LabelFirstArray = (Int *)Yap_AllocCodeSpace(sizeof(Int)*DEFAULT_NLABELS);
|
||||
LOCAL_LabelFirstArraySz = DEFAULT_NLABELS;
|
||||
if (!LOCAL_LabelFirstArray) {
|
||||
save_machine_regs();
|
||||
siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
}
|
||||
if (Yap_LabelFirstArray && max_label <= Yap_LabelFirstArraySz) {
|
||||
cip->label_offset = Yap_LabelFirstArray;
|
||||
if (LOCAL_LabelFirstArray && max_label <= LOCAL_LabelFirstArraySz) {
|
||||
cip->label_offset = LOCAL_LabelFirstArray;
|
||||
} else {
|
||||
cip->label_offset = (Int *)Yap_AllocCodeSpace(sizeof(Int)*max_label);
|
||||
if (!cip->label_offset) {
|
||||
@ -3926,7 +3926,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
||||
/* make sure we copy after second pass */
|
||||
cl->usc.ClSource = x;
|
||||
cl->ClSize = osize;
|
||||
ProfEnd=code_p;
|
||||
LOCAL_ProfEnd=code_p;
|
||||
return entry_code;
|
||||
} else {
|
||||
while ((cip->code_addr = (yamop *) Yap_AllocCodeSpace(size)) == NULL) {
|
||||
@ -3950,11 +3950,11 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
||||
}
|
||||
}
|
||||
code_p = do_pass(1, &entry_code, mode, &clause_has_blobs, &clause_has_dbterm, cip, size PASS_REGS);
|
||||
ProfEnd=code_p;
|
||||
LOCAL_ProfEnd=code_p;
|
||||
#ifdef LOW_PROF
|
||||
if (ProfilerOn &&
|
||||
Yap_OffLineProfiler) {
|
||||
Yap_inform_profiler_of_clause(entry_code, ProfEnd, ap, mode == ASSEMBLING_INDEX);
|
||||
Yap_inform_profiler_of_clause(entry_code, LOCAL_ProfEnd, ap, mode == ASSEMBLING_INDEX);
|
||||
}
|
||||
#endif /* LOW_PROF */
|
||||
return entry_code;
|
||||
|
@ -573,8 +573,8 @@ CreateNamedArray(PropEntry * pp, Int dim, AtomEntry *ae USES_REGS)
|
||||
#if THREADS
|
||||
p->owner_id = worker_id;
|
||||
#endif
|
||||
p->NextAE = DynamicArrays;
|
||||
DynamicArrays = p;
|
||||
p->NextAE = LOCAL_DynamicArrays;
|
||||
LOCAL_DynamicArrays = p;
|
||||
InitNamedArray(p, dim PASS_REGS);
|
||||
|
||||
}
|
||||
@ -632,8 +632,8 @@ CreateStaticArray(AtomEntry *ae, Int dim, static_array_types type, CODEADDR star
|
||||
p->KindOfPE = ArrayProperty;
|
||||
p->NextOfPE = ae->PropsOfAE;
|
||||
INIT_RWLOCK(p->ArRWLock);
|
||||
p->NextAE = StaticArrays;
|
||||
StaticArrays = p;
|
||||
p->NextAE = LOCAL_StaticArrays;
|
||||
LOCAL_StaticArrays = p;
|
||||
}
|
||||
WRITE_LOCK(p->ArRWLock);
|
||||
p->ArrayEArity = -dim;
|
||||
|
@ -41,10 +41,10 @@ AddToQueue(attvar_record *attv USES_REGS)
|
||||
t[0] = (CELL)&(attv->Done);
|
||||
t[1] = attv->Value;
|
||||
/* follow the chain */
|
||||
WGs = Yap_ReadTimedVar(WokenGoals);
|
||||
WGs = Yap_ReadTimedVar(LOCAL_WokenGoals);
|
||||
ng = Yap_MkApplTerm(FunctorAttGoal, 2, t);
|
||||
|
||||
Yap_UpdateTimedVar(WokenGoals, MkPairTerm(ng, WGs));
|
||||
Yap_UpdateTimedVar(LOCAL_WokenGoals, MkPairTerm(ng, WGs));
|
||||
if ((Term)WGs == TermNil) {
|
||||
/* from now on, we have to start waking up goals */
|
||||
Yap_signal(YAP_WAKEUP_SIGNAL);
|
||||
@ -58,9 +58,9 @@ AddFailToQueue( USES_REGS1 )
|
||||
Term WGs;
|
||||
|
||||
/* follow the chain */
|
||||
WGs = Yap_ReadTimedVar(WokenGoals);
|
||||
WGs = Yap_ReadTimedVar(LOCAL_WokenGoals);
|
||||
|
||||
Yap_UpdateTimedVar(WokenGoals, MkPairTerm(MkAtomTerm(AtomFail), WGs));
|
||||
Yap_UpdateTimedVar(LOCAL_WokenGoals, MkPairTerm(MkAtomTerm(AtomFail), WGs));
|
||||
if ((Term)WGs == TermNil) {
|
||||
/* from now on, we have to start waking up goals */
|
||||
Yap_signal(YAP_WAKEUP_SIGNAL);
|
||||
|
@ -855,7 +855,7 @@ YAP_LookupAtom(char *c)
|
||||
|
||||
while (TRUE) {
|
||||
a = Yap_LookupAtom(c);
|
||||
if (a == NIL || (ActiveSignals & YAP_CDOVF_SIGNAL)) {
|
||||
if (a == NIL || (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL)) {
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
|
||||
}
|
||||
@ -873,7 +873,7 @@ YAP_LookupWideAtom(wchar_t *c)
|
||||
|
||||
while (TRUE) {
|
||||
a = Yap_LookupWideAtom(c);
|
||||
if (a == NIL || (ActiveSignals & YAP_CDOVF_SIGNAL)) {
|
||||
if (a == NIL || (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL)) {
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
|
||||
}
|
||||
@ -891,7 +891,7 @@ YAP_FullLookupAtom(char *c)
|
||||
|
||||
while (TRUE) {
|
||||
at = Yap_FullLookupAtom(c);
|
||||
if (at == NIL || (ActiveSignals & YAP_CDOVF_SIGNAL)) {
|
||||
if (at == NIL || (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL)) {
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
|
||||
}
|
||||
@ -1563,7 +1563,7 @@ YAP_Execute(PredEntry *pe, CPredicate exec_code)
|
||||
if (!ret) {
|
||||
Term t;
|
||||
|
||||
BallTerm = EX;
|
||||
LOCAL_BallTerm = EX;
|
||||
EX = NULL;
|
||||
if ((t = Yap_GetException())) {
|
||||
Yap_JumpToEnv(t);
|
||||
@ -1586,7 +1586,7 @@ YAP_ExecuteFirst(PredEntry *pe, CPredicate exec_code)
|
||||
Int val;
|
||||
CPredicateV codev = (CPredicateV)exec_code;
|
||||
struct foreign_context *ctx = (struct foreign_context *)(&EXTRA_CBACK_ARG(pe->ArityOfPE,1));
|
||||
struct open_query_struct *oexec = execution;
|
||||
struct open_query_struct *oexec = LOCAL_execution;
|
||||
extern void PL_close_foreign_frame(struct open_query_struct *);
|
||||
|
||||
PP = pe;
|
||||
@ -1599,13 +1599,13 @@ YAP_ExecuteFirst(PredEntry *pe, CPredicate exec_code)
|
||||
val = ((codev)(B->cp_args-LCL0,0,ctx));
|
||||
}
|
||||
/* make sure we clean up the frames left by the user */
|
||||
while (execution != oexec)
|
||||
PL_close_foreign_frame(execution);
|
||||
while (LOCAL_execution != oexec)
|
||||
PL_close_foreign_frame(LOCAL_execution);
|
||||
PP = NULL;
|
||||
if (val == 0) {
|
||||
Term t;
|
||||
|
||||
BallTerm = EX;
|
||||
LOCAL_BallTerm = EX;
|
||||
EX = NULL;
|
||||
if ((t = Yap_GetException())) {
|
||||
cut_c_pop();
|
||||
@ -1628,7 +1628,7 @@ YAP_ExecuteFirst(PredEntry *pe, CPredicate exec_code)
|
||||
if (!ret) {
|
||||
Term t;
|
||||
|
||||
BallTerm = EX;
|
||||
LOCAL_BallTerm = EX;
|
||||
EX = NULL;
|
||||
if ((t = Yap_GetException())) {
|
||||
Yap_JumpToEnv(t);
|
||||
@ -1651,7 +1651,7 @@ YAP_ExecuteOnCut(PredEntry *pe, CPredicate exec_code, struct cut_c_str *top)
|
||||
Int val;
|
||||
CPredicateV codev = (CPredicateV)exec_code;
|
||||
struct foreign_context *ctx = (struct foreign_context *)(&EXTRA_CBACK_ARG(pe->ArityOfPE,1));
|
||||
struct open_query_struct *oexec = execution;
|
||||
struct open_query_struct *oexec = LOCAL_execution;
|
||||
extern void PL_close_foreign_frame(struct open_query_struct *);
|
||||
CELL *args = B->cp_args;
|
||||
|
||||
@ -1667,15 +1667,15 @@ YAP_ExecuteOnCut(PredEntry *pe, CPredicate exec_code, struct cut_c_str *top)
|
||||
val = ((codev)(args-LCL0,0,ctx));
|
||||
}
|
||||
/* make sure we clean up the frames left by the user */
|
||||
while (execution != oexec)
|
||||
PL_close_foreign_frame(execution);
|
||||
while (LOCAL_execution != oexec)
|
||||
PL_close_foreign_frame(LOCAL_execution);
|
||||
|
||||
PP = NULL;
|
||||
// B = LCL0-(CELL*)oB;
|
||||
if (val == 0) {
|
||||
Term t;
|
||||
|
||||
BallTerm = EX;
|
||||
LOCAL_BallTerm = EX;
|
||||
EX = NULL;
|
||||
if ((t = Yap_GetException())) {
|
||||
cut_c_pop();
|
||||
@ -1693,7 +1693,7 @@ YAP_ExecuteOnCut(PredEntry *pe, CPredicate exec_code, struct cut_c_str *top)
|
||||
if (!ret) {
|
||||
Term t;
|
||||
|
||||
BallTerm = EX;
|
||||
LOCAL_BallTerm = EX;
|
||||
EX = NULL;
|
||||
if ((t = Yap_GetException())) {
|
||||
Yap_JumpToEnv(t);
|
||||
@ -1713,7 +1713,7 @@ YAP_ExecuteNext(PredEntry *pe, CPredicate exec_code)
|
||||
Int val;
|
||||
CPredicateV codev = (CPredicateV)exec_code;
|
||||
struct foreign_context *ctx = (struct foreign_context *)(&EXTRA_CBACK_ARG(pe->ArityOfPE,1));
|
||||
struct open_query_struct *oexec = execution;
|
||||
struct open_query_struct *oexec = LOCAL_execution;
|
||||
extern void PL_close_foreign_frame(struct open_query_struct *);
|
||||
|
||||
PP = pe;
|
||||
@ -1724,13 +1724,13 @@ YAP_ExecuteNext(PredEntry *pe, CPredicate exec_code)
|
||||
val = ((codev)(B->cp_args-LCL0,0,ctx));
|
||||
}
|
||||
/* make sure we clean up the frames left by the user */
|
||||
while (execution != oexec)
|
||||
PL_close_foreign_frame(execution);
|
||||
while (LOCAL_execution != oexec)
|
||||
PL_close_foreign_frame(LOCAL_execution);
|
||||
PP = NULL;
|
||||
if (val == 0) {
|
||||
Term t;
|
||||
|
||||
BallTerm = EX;
|
||||
LOCAL_BallTerm = EX;
|
||||
EX = NULL;
|
||||
if ((t = Yap_GetException())) {
|
||||
cut_c_pop();
|
||||
@ -1754,7 +1754,7 @@ YAP_ExecuteNext(PredEntry *pe, CPredicate exec_code)
|
||||
if (!ret) {
|
||||
Term t;
|
||||
|
||||
BallTerm = EX;
|
||||
LOCAL_BallTerm = EX;
|
||||
EX = NULL;
|
||||
if ((t = Yap_GetException())) {
|
||||
Yap_JumpToEnv(t);
|
||||
@ -2196,9 +2196,6 @@ YAP_EnterGoal(PredEntry *pe, Term *ptr, YAP_dogoalinfo *dgi)
|
||||
CP = YESCODE;
|
||||
B = myB;
|
||||
HB = H;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
WPP = NULL;
|
||||
#endif
|
||||
ASP = YENV = (CELL *)B;
|
||||
YENV[E_CB] = Unsigned (B);
|
||||
out = run_emulator(dgi);
|
||||
@ -2276,7 +2273,7 @@ YAP_RunGoal(Term t)
|
||||
yamop *old_CP = CP;
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
Yap_AllowRestart = FALSE;
|
||||
LOCAL_AllowRestart = FALSE;
|
||||
Yap_PrologMode = UserMode;
|
||||
out = Yap_RunTopGoal(t);
|
||||
Yap_PrologMode = UserCCallMode;
|
||||
@ -2284,11 +2281,11 @@ YAP_RunGoal(Term t)
|
||||
P = (yamop *)ENV[E_CP];
|
||||
ENV = (CELL *)ENV[E_E];
|
||||
CP = old_CP;
|
||||
Yap_AllowRestart = TRUE;
|
||||
LOCAL_AllowRestart = TRUE;
|
||||
} else {
|
||||
ENV = B->cp_env;
|
||||
B = B->cp_b;
|
||||
Yap_AllowRestart = FALSE;
|
||||
LOCAL_AllowRestart = FALSE;
|
||||
}
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
@ -2327,7 +2324,7 @@ YAP_RunGoalOnce(Term t)
|
||||
#endif
|
||||
P = (yamop *)ASP[E_CP];
|
||||
CP = old_CP;
|
||||
Yap_AllowRestart = FALSE;
|
||||
LOCAL_AllowRestart = FALSE;
|
||||
RECOVER_MACHINE_REGS();
|
||||
return(out);
|
||||
}
|
||||
@ -2338,7 +2335,7 @@ YAP_RestartGoal(void)
|
||||
CACHE_REGS
|
||||
int out;
|
||||
BACKUP_MACHINE_REGS();
|
||||
if (Yap_AllowRestart) {
|
||||
if (LOCAL_AllowRestart) {
|
||||
P = (yamop *)FAILCODE;
|
||||
do_putcf = myputc;
|
||||
Yap_PrologMode = UserMode;
|
||||
@ -2348,7 +2345,7 @@ YAP_RestartGoal(void)
|
||||
/* cleanup */
|
||||
Yap_CloseSlots( PASS_REGS1 );
|
||||
Yap_trust_last();
|
||||
Yap_AllowRestart = FALSE;
|
||||
LOCAL_AllowRestart = FALSE;
|
||||
}
|
||||
} else {
|
||||
out = FALSE;
|
||||
@ -2363,7 +2360,7 @@ YAP_ShutdownGoal(int backtrack)
|
||||
CACHE_REGS
|
||||
BACKUP_MACHINE_REGS();
|
||||
|
||||
if (Yap_AllowRestart) {
|
||||
if (LOCAL_AllowRestart) {
|
||||
choiceptr cut_pt;
|
||||
|
||||
cut_pt = B;
|
||||
@ -2390,7 +2387,7 @@ YAP_ShutdownGoal(int backtrack)
|
||||
#ifdef DEPTH_LIMIT
|
||||
DEPTH = ASP[E_DEPTH];
|
||||
#endif
|
||||
Yap_AllowRestart = FALSE;
|
||||
LOCAL_AllowRestart = FALSE;
|
||||
}
|
||||
RECOVER_MACHINE_REGS();
|
||||
return TRUE;
|
||||
@ -2468,11 +2465,11 @@ YAP_ClearExceptions(void)
|
||||
CACHE_REGS
|
||||
Yap_ResetExceptionTerm();
|
||||
if (EX) {
|
||||
BallTerm = EX;
|
||||
LOCAL_BallTerm = EX;
|
||||
}
|
||||
EX = NULL;
|
||||
Yap_ResetExceptionTerm();
|
||||
UncaughtThrow = FALSE;
|
||||
LOCAL_UncaughtThrow = FALSE;
|
||||
}
|
||||
|
||||
X_API IOSTREAM *
|
||||
@ -2588,7 +2585,7 @@ YAP_CompileClause(Term t)
|
||||
}
|
||||
YAPLeaveCriticalSection();
|
||||
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
|
||||
}
|
||||
|
154
C/cdmgr.c
154
C/cdmgr.c
@ -635,26 +635,26 @@ static void
|
||||
InitConsultStack( void )
|
||||
{
|
||||
CACHE_REGS
|
||||
ConsultLow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
|
||||
if (ConsultLow == NULL) {
|
||||
LOCAL_ConsultLow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
|
||||
if (LOCAL_ConsultLow == NULL) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCodes");
|
||||
return;
|
||||
}
|
||||
ConsultCapacity = InitialConsultCapacity;
|
||||
ConsultBase = ConsultSp =
|
||||
ConsultLow + ConsultCapacity;
|
||||
LOCAL_ConsultCapacity = InitialConsultCapacity;
|
||||
LOCAL_ConsultBase = LOCAL_ConsultSp =
|
||||
LOCAL_ConsultLow + LOCAL_ConsultCapacity;
|
||||
}
|
||||
|
||||
void
|
||||
Yap_ResetConsultStack( void )
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_FreeCodeSpace((char *)ConsultLow);
|
||||
ConsultBase =
|
||||
ConsultSp =
|
||||
ConsultLow =
|
||||
Yap_FreeCodeSpace((char *)LOCAL_ConsultLow);
|
||||
LOCAL_ConsultBase =
|
||||
LOCAL_ConsultSp =
|
||||
LOCAL_ConsultLow =
|
||||
NULL;
|
||||
ConsultCapacity = InitialConsultCapacity;
|
||||
LOCAL_ConsultCapacity = InitialConsultCapacity;
|
||||
}
|
||||
|
||||
|
||||
@ -780,9 +780,9 @@ static Term BlobTermInCodeAdjust(Term t)
|
||||
{
|
||||
CACHE_REGS
|
||||
#if TAGS_FAST_OPS
|
||||
return t-ClDiff;
|
||||
return t-LOCAL_ClDiff;
|
||||
#else
|
||||
return t+ClDiff;
|
||||
return t+LOCAL_ClDiff;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -863,7 +863,7 @@ Yap_BuildMegaClause(PredEntry *ap)
|
||||
while (TRUE) {
|
||||
memcpy((void *)ptr, (void *)cl->ClCode, sz);
|
||||
if (has_blobs) {
|
||||
ClDiff = (char *)(ptr)-(char *)cl->ClCode;
|
||||
LOCAL_ClDiff = (char *)(ptr)-(char *)cl->ClCode;
|
||||
restore_opcodes(ptr, NULL PASS_REGS);
|
||||
}
|
||||
ptr = (yamop *)((char *)ptr + sz);
|
||||
@ -965,9 +965,9 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
||||
Term tmod = ap->ModuleOfPred;
|
||||
if (!tmod)
|
||||
tmod = TermProlog;
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\t');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\t');
|
||||
Yap_DebugPlWrite(tmod);
|
||||
Yap_DebugPutc(Yap_c_error_stream,':');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,':');
|
||||
if (ap->ModuleOfPred == IDB_MODULE) {
|
||||
Term t = Deref(ARG1);
|
||||
if (IsAtomTerm(t)) {
|
||||
@ -978,7 +978,7 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
||||
Functor f = FunctorOfTerm(t);
|
||||
Atom At = NameOfFunctor(f);
|
||||
Yap_DebugPlWrite(MkAtomTerm(At));
|
||||
Yap_DebugPutc(Yap_c_error_stream,'/');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
||||
Yap_DebugPlWrite(MkIntTerm(ArityOfFunctor(f)));
|
||||
}
|
||||
} else {
|
||||
@ -989,11 +989,11 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
||||
Functor f = ap->FunctorOfPred;
|
||||
Atom At = NameOfFunctor(f);
|
||||
Yap_DebugPlWrite(MkAtomTerm(At));
|
||||
Yap_DebugPutc(Yap_c_error_stream,'/');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
||||
Yap_DebugPlWrite(MkIntTerm(ArityOfFunctor(f)));
|
||||
}
|
||||
}
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\n');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\n');
|
||||
}
|
||||
#endif
|
||||
/* Do not try to index a dynamic predicate or one whithout args */
|
||||
@ -1021,7 +1021,7 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (Yap_Option['i' - 'a' + 1])
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\n');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\n');
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1954,30 +1954,30 @@ static void expand_consult( void )
|
||||
{
|
||||
CACHE_REGS
|
||||
consult_obj *new_cl, *new_cs;
|
||||
UInt OldConsultCapacity = ConsultCapacity;
|
||||
UInt OldConsultCapacity = LOCAL_ConsultCapacity;
|
||||
|
||||
/* now double consult capacity */
|
||||
ConsultCapacity += InitialConsultCapacity;
|
||||
LOCAL_ConsultCapacity += InitialConsultCapacity;
|
||||
/* I assume it always works ;-) */
|
||||
while ((new_cl = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*ConsultCapacity)) == NULL) {
|
||||
if (!Yap_growheap(FALSE, sizeof(consult_obj)*ConsultCapacity, NULL)) {
|
||||
while ((new_cl = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*LOCAL_ConsultCapacity)) == NULL) {
|
||||
if (!Yap_growheap(FALSE, sizeof(consult_obj)*LOCAL_ConsultCapacity, NULL)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,Yap_ErrorMessage);
|
||||
return;
|
||||
}
|
||||
}
|
||||
new_cs = new_cl + InitialConsultCapacity;
|
||||
/* start copying */
|
||||
memcpy((void *)new_cs, (void *)ConsultLow, OldConsultCapacity*sizeof(consult_obj));
|
||||
memcpy((void *)new_cs, (void *)LOCAL_ConsultLow, OldConsultCapacity*sizeof(consult_obj));
|
||||
/* copying done, release old space */
|
||||
Yap_FreeCodeSpace((char *)ConsultLow);
|
||||
Yap_FreeCodeSpace((char *)LOCAL_ConsultLow);
|
||||
/* next, set up pointers correctly */
|
||||
new_cs += (ConsultSp-ConsultLow);
|
||||
/* put ConsultBase at same offset as before move */
|
||||
ConsultBase = ConsultBase+(new_cs-ConsultSp);
|
||||
new_cs += (LOCAL_ConsultSp-LOCAL_ConsultLow);
|
||||
/* put LOCAL_ConsultBase at same offset as before move */
|
||||
LOCAL_ConsultBase = LOCAL_ConsultBase+(new_cs-LOCAL_ConsultSp);
|
||||
/* new consult pointer */
|
||||
ConsultSp = new_cs;
|
||||
LOCAL_ConsultSp = new_cs;
|
||||
/* new end of memory */
|
||||
ConsultLow = new_cl;
|
||||
LOCAL_ConsultLow = new_cl;
|
||||
}
|
||||
|
||||
/* p was already locked */
|
||||
@ -1988,28 +1988,28 @@ not_was_reconsulted(PredEntry *p, Term t, int mode)
|
||||
register consult_obj *fp;
|
||||
Prop p0 = AbsProp((PropEntry *)p);
|
||||
|
||||
if (p == LastAssertedPred)
|
||||
if (p == LOCAL_LastAssertedPred)
|
||||
return FALSE;
|
||||
LastAssertedPred = p;
|
||||
if (!ConsultSp) {
|
||||
LOCAL_LastAssertedPred = p;
|
||||
if (!LOCAL_ConsultSp) {
|
||||
InitConsultStack();
|
||||
}
|
||||
if (p->cs.p_code.NOfClauses) {
|
||||
for (fp = ConsultSp; fp < ConsultBase; ++fp)
|
||||
for (fp = LOCAL_ConsultSp; fp < LOCAL_ConsultBase; ++fp)
|
||||
if (fp->p == p0)
|
||||
break;
|
||||
} else {
|
||||
fp = ConsultBase;
|
||||
fp = LOCAL_ConsultBase;
|
||||
}
|
||||
if (fp != ConsultBase)
|
||||
if (fp != LOCAL_ConsultBase)
|
||||
return FALSE;
|
||||
if (mode) {
|
||||
if (ConsultSp == ConsultLow+1) {
|
||||
if (LOCAL_ConsultSp == LOCAL_ConsultLow+1) {
|
||||
expand_consult();
|
||||
}
|
||||
--ConsultSp;
|
||||
ConsultSp->p = p0;
|
||||
if (ConsultBase[1].mode &&
|
||||
--LOCAL_ConsultSp;
|
||||
LOCAL_ConsultSp->p = p0;
|
||||
if (LOCAL_ConsultBase[1].mode &&
|
||||
!(p->PredFlags & MultiFileFlag)) /* we are in reconsult mode */ {
|
||||
retract_all(p, static_in_use(p,TRUE));
|
||||
}
|
||||
@ -2508,7 +2508,7 @@ p_compile_dynamic( USES_REGS1 )
|
||||
else mode = assertz;
|
||||
} else mode = IntegerOfTerm(t1);
|
||||
/* separate assert in current file from reconsult
|
||||
if (mode == assertz && consult_level && mod == CurrentModule)
|
||||
if (mode == assertz && LOCAL_consult_level && mod == CurrentModule)
|
||||
mode = consult;
|
||||
*/
|
||||
old_optimize = optimizer_on;
|
||||
@ -2537,10 +2537,10 @@ p_compile_dynamic( USES_REGS1 )
|
||||
static Atom
|
||||
YapConsultingFile ( USES_REGS1 )
|
||||
{
|
||||
if (consult_level == 0) {
|
||||
if (LOCAL_consult_level == 0) {
|
||||
return(AtomUser);
|
||||
} else {
|
||||
return(Yap_LookupAtom(ConsultBase[2].filename));
|
||||
return(Yap_LookupAtom(LOCAL_ConsultBase[2].filename));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2556,22 +2556,22 @@ static void
|
||||
init_consult(int mode, char *file)
|
||||
{
|
||||
CACHE_REGS
|
||||
if (!ConsultSp) {
|
||||
if (!LOCAL_ConsultSp) {
|
||||
InitConsultStack();
|
||||
}
|
||||
ConsultSp--;
|
||||
ConsultSp->filename = file;
|
||||
ConsultSp--;
|
||||
ConsultSp->mode = mode;
|
||||
ConsultSp--;
|
||||
ConsultSp->c = (ConsultBase-ConsultSp);
|
||||
ConsultBase = ConsultSp;
|
||||
LOCAL_ConsultSp--;
|
||||
LOCAL_ConsultSp->filename = file;
|
||||
LOCAL_ConsultSp--;
|
||||
LOCAL_ConsultSp->mode = mode;
|
||||
LOCAL_ConsultSp--;
|
||||
LOCAL_ConsultSp->c = (LOCAL_ConsultBase-LOCAL_ConsultSp);
|
||||
LOCAL_ConsultBase = LOCAL_ConsultSp;
|
||||
#if !defined(YAPOR) && !defined(YAPOR_SBA)
|
||||
/* if (consult_level == 0)
|
||||
/* if (LOCAL_consult_level == 0)
|
||||
do_toggle_static_predicates_in_use(TRUE); */
|
||||
#endif
|
||||
consult_level++;
|
||||
LastAssertedPred = NULL;
|
||||
LOCAL_consult_level++;
|
||||
LOCAL_LastAssertedPred = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@ -2589,7 +2589,7 @@ p_startconsult( USES_REGS1 )
|
||||
|
||||
mode = strcmp("consult",smode);
|
||||
init_consult(mode, RepAtom(AtomOfTerm(Deref(ARG2)))->StrOfAE);
|
||||
t = MkIntTerm(consult_level);
|
||||
t = MkIntTerm(LOCAL_consult_level);
|
||||
return (Yap_unify_constant(ARG3, t));
|
||||
}
|
||||
|
||||
@ -2598,20 +2598,20 @@ p_showconslultlev( USES_REGS1 )
|
||||
{
|
||||
Term t;
|
||||
|
||||
t = MkIntTerm(consult_level);
|
||||
t = MkIntTerm(LOCAL_consult_level);
|
||||
return (Yap_unify_constant(ARG1, t));
|
||||
}
|
||||
|
||||
static void
|
||||
end_consult( USES_REGS1 )
|
||||
{
|
||||
ConsultSp = ConsultBase;
|
||||
ConsultBase = ConsultSp+ConsultSp->c;
|
||||
ConsultSp += 3;
|
||||
consult_level--;
|
||||
LastAssertedPred = NULL;
|
||||
LOCAL_ConsultSp = LOCAL_ConsultBase;
|
||||
LOCAL_ConsultBase = LOCAL_ConsultSp+LOCAL_ConsultSp->c;
|
||||
LOCAL_ConsultSp += 3;
|
||||
LOCAL_consult_level--;
|
||||
LOCAL_LastAssertedPred = NULL;
|
||||
#if !defined(YAPOR) && !defined(YAPOR_SBA)
|
||||
/* if (consult_level == 0)
|
||||
/* if (LOCAL_consult_level == 0)
|
||||
do_toggle_static_predicates_in_use(FALSE);*/
|
||||
#endif
|
||||
}
|
||||
@ -4143,20 +4143,20 @@ p_is_call_counted( USES_REGS1 )
|
||||
static Int
|
||||
p_call_count_info( USES_REGS1 )
|
||||
{
|
||||
return(Yap_unify(MkIntegerTerm(ReductionsCounter),ARG1) &&
|
||||
Yap_unify(MkIntegerTerm(PredEntriesCounter),ARG2) &&
|
||||
Yap_unify(MkIntegerTerm(PredEntriesCounter),ARG3));
|
||||
return(Yap_unify(MkIntegerTerm(LOCAL_ReductionsCounter),ARG1) &&
|
||||
Yap_unify(MkIntegerTerm(LOCAL_PredEntriesCounter),ARG2) &&
|
||||
Yap_unify(MkIntegerTerm(LOCAL_PredEntriesCounter),ARG3));
|
||||
}
|
||||
|
||||
static Int
|
||||
p_call_count_reset( USES_REGS1 )
|
||||
{
|
||||
ReductionsCounter = 0;
|
||||
ReductionsCounterOn = FALSE;
|
||||
PredEntriesCounter = 0;
|
||||
PredEntriesCounterOn = FALSE;
|
||||
RetriesCounter = 0;
|
||||
RetriesCounterOn = FALSE;
|
||||
LOCAL_ReductionsCounter = 0;
|
||||
LOCAL_ReductionsCounterOn = FALSE;
|
||||
LOCAL_PredEntriesCounter = 0;
|
||||
LOCAL_PredEntriesCounterOn = FALSE;
|
||||
LOCAL_RetriesCounter = 0;
|
||||
LOCAL_RetriesCounterOn = FALSE;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@ -4168,14 +4168,14 @@ p_call_count_set( USES_REGS1 )
|
||||
int do_entries = IntOfTerm(ARG6);
|
||||
|
||||
if (do_calls)
|
||||
ReductionsCounter = IntegerOfTerm(Deref(ARG1));
|
||||
ReductionsCounterOn = do_calls;
|
||||
LOCAL_ReductionsCounter = IntegerOfTerm(Deref(ARG1));
|
||||
LOCAL_ReductionsCounterOn = do_calls;
|
||||
if (do_retries)
|
||||
RetriesCounter = IntegerOfTerm(Deref(ARG3));
|
||||
RetriesCounterOn = do_retries;
|
||||
LOCAL_RetriesCounter = IntegerOfTerm(Deref(ARG3));
|
||||
LOCAL_RetriesCounterOn = do_retries;
|
||||
if (do_entries)
|
||||
PredEntriesCounter = IntegerOfTerm(Deref(ARG5));
|
||||
PredEntriesCounterOn = do_entries;
|
||||
LOCAL_PredEntriesCounter = IntegerOfTerm(Deref(ARG5));
|
||||
LOCAL_PredEntriesCounterOn = do_entries;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
28
C/cmppreds.c
28
C/cmppreds.c
@ -481,14 +481,14 @@ flt_cmp(Float dif)
|
||||
static inline Int
|
||||
a_cmp(Term t1, Term t2 USES_REGS)
|
||||
{
|
||||
ArithError = FALSE;
|
||||
LOCAL_ArithError = FALSE;
|
||||
if (IsVarTerm(t1)) {
|
||||
ArithError = TRUE;
|
||||
LOCAL_ArithError = TRUE;
|
||||
Yap_Error(INSTANTIATION_ERROR, t1, "=:=/2");
|
||||
return FALSE;
|
||||
}
|
||||
if (IsVarTerm(t2)) {
|
||||
ArithError = TRUE;
|
||||
LOCAL_ArithError = TRUE;
|
||||
Yap_Error(INSTANTIATION_ERROR, t2, "=:=/2");
|
||||
return FALSE;
|
||||
}
|
||||
@ -516,7 +516,7 @@ a_cmp(Term t1, Term t2 USES_REGS)
|
||||
Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
|
||||
Yap_Error_Term = t2;
|
||||
Yap_ErrorMessage = "trying to evaluate nan";
|
||||
ArithError = TRUE;
|
||||
LOCAL_ArithError = TRUE;
|
||||
}
|
||||
#endif
|
||||
return flt_cmp(i1-f2);
|
||||
@ -534,7 +534,7 @@ a_cmp(Term t1, Term t2 USES_REGS)
|
||||
Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
|
||||
Yap_Error_Term = t1;
|
||||
Yap_ErrorMessage = "trying to evaluate nan";
|
||||
ArithError = TRUE;
|
||||
LOCAL_ArithError = TRUE;
|
||||
}
|
||||
#endif
|
||||
t2 = Yap_Eval(t2);
|
||||
@ -553,7 +553,7 @@ a_cmp(Term t1, Term t2 USES_REGS)
|
||||
Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
|
||||
Yap_Error_Term = t2;
|
||||
Yap_ErrorMessage = "trying to evaluate nan";
|
||||
ArithError = TRUE;
|
||||
LOCAL_ArithError = TRUE;
|
||||
}
|
||||
#endif
|
||||
return flt_cmp(f1-f2);
|
||||
@ -578,7 +578,7 @@ a_cmp(Term t1, Term t2 USES_REGS)
|
||||
Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
|
||||
Yap_Error_Term = t2;
|
||||
Yap_ErrorMessage = "trying to evaluate nan";
|
||||
ArithError = TRUE;
|
||||
LOCAL_ArithError = TRUE;
|
||||
}
|
||||
#endif
|
||||
return Yap_gmp_cmp_big_float(t1, f2);
|
||||
@ -603,7 +603,7 @@ p_acomp( USES_REGS1 )
|
||||
Int out;
|
||||
|
||||
out = a_cmp(t1, t2 PASS_REGS);
|
||||
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
if (LOCAL_ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -637,7 +637,7 @@ a_eq(Term t1, Term t2)
|
||||
}
|
||||
}
|
||||
out = a_cmp(t1,t2 PASS_REGS);
|
||||
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
if (LOCAL_ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
return out == 0;
|
||||
}
|
||||
|
||||
@ -646,7 +646,7 @@ a_dif(Term t1, Term t2)
|
||||
{
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1),Deref(t2) PASS_REGS);
|
||||
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
if (LOCAL_ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
return out != 0;
|
||||
}
|
||||
|
||||
@ -655,7 +655,7 @@ a_gt(Term t1, Term t2)
|
||||
{ /* A > B */
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1),Deref(t2) PASS_REGS);
|
||||
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
if (LOCAL_ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
return out > 0;
|
||||
}
|
||||
|
||||
@ -664,7 +664,7 @@ a_ge(Term t1, Term t2)
|
||||
{ /* A >= B */
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1),Deref(t2) PASS_REGS);
|
||||
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
if (LOCAL_ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
return out >= 0;
|
||||
}
|
||||
|
||||
@ -673,7 +673,7 @@ a_lt(Term t1, Term t2)
|
||||
{ /* A < B */
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1),Deref(t2) PASS_REGS);
|
||||
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
if (LOCAL_ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
return out < 0;
|
||||
}
|
||||
|
||||
@ -682,7 +682,7 @@ a_le(Term t1, Term t2)
|
||||
{ /* A <= B */
|
||||
CACHE_REGS
|
||||
Int out = a_cmp(Deref(t1),Deref(t2) PASS_REGS);
|
||||
if (ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
if (LOCAL_ArithError) { Yap_Error(Yap_Error_TYPE, Yap_Error_Term, Yap_ErrorMessage); return FALSE; }
|
||||
return out <= 0;
|
||||
}
|
||||
|
||||
|
@ -3618,7 +3618,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
||||
#ifdef LOW_PROF
|
||||
if (ProfilerOn &&
|
||||
Yap_OffLineProfiler) {
|
||||
Yap_inform_profiler_of_clause(acode, ProfEnd, cglobs.cint.CurrentPred,0);
|
||||
Yap_inform_profiler_of_clause(acode, LOCAL_ProfEnd, cglobs.cint.CurrentPred,0);
|
||||
}
|
||||
#endif /* LOW_PROF */
|
||||
return(acode);
|
||||
|
@ -112,9 +112,9 @@ AllocCMem (UInt size, struct intermediates *cip)
|
||||
blksz = CMEM_BLK_SIZE;
|
||||
if (!cip->blks) {
|
||||
CACHE_REGS
|
||||
if (Yap_CMemFirstBlock) {
|
||||
p = Yap_CMemFirstBlock;
|
||||
blksz = Yap_CMemFirstBlockSz;
|
||||
if (LOCAL_CMemFirstBlock) {
|
||||
p = LOCAL_CMemFirstBlock;
|
||||
blksz = LOCAL_CMemFirstBlockSz;
|
||||
p->u.next = NULL;
|
||||
} else {
|
||||
if (blksz < FIRST_CMEM_BLK_SIZE)
|
||||
@ -125,8 +125,8 @@ AllocCMem (UInt size, struct intermediates *cip)
|
||||
save_machine_regs();
|
||||
siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
|
||||
}
|
||||
Yap_CMemFirstBlock = p;
|
||||
Yap_CMemFirstBlockSz = blksz;
|
||||
LOCAL_CMemFirstBlock = p;
|
||||
LOCAL_CMemFirstBlockSz = blksz;
|
||||
}
|
||||
} else {
|
||||
p = (struct mem_blk *)Yap_AllocCodeSpace(blksz);
|
||||
@ -169,13 +169,13 @@ Yap_ReleaseCMem (struct intermediates *cip)
|
||||
struct mem_blk *p = cip->blks;
|
||||
while (p) {
|
||||
struct mem_blk *nextp = p->u.next;
|
||||
if (p != Yap_CMemFirstBlock)
|
||||
if (p != LOCAL_CMemFirstBlock)
|
||||
Yap_FreeCodeSpace((ADDR)p);
|
||||
p = nextp;
|
||||
}
|
||||
cip->blks = NULL;
|
||||
if (cip->label_offset &&
|
||||
cip->label_offset != Yap_LabelFirstArray) {
|
||||
cip->label_offset != LOCAL_LabelFirstArray) {
|
||||
Yap_FreeCodeSpace((ADDR)cip->label_offset);
|
||||
}
|
||||
#endif
|
||||
|
@ -505,7 +505,7 @@ static Int p_coroutining( USES_REGS1 )
|
||||
#if COROUTINING
|
||||
static Term
|
||||
ListOfWokenGoals( USES_REGS1 ) {
|
||||
return Yap_ReadTimedVar(WokenGoals);
|
||||
return Yap_ReadTimedVar(LOCAL_WokenGoals);
|
||||
}
|
||||
|
||||
Term
|
||||
@ -519,12 +519,12 @@ Yap_ListOfWokenGoals(void) {
|
||||
static Int p_awoken_goals( USES_REGS1 )
|
||||
{
|
||||
#ifdef COROUTINING
|
||||
Term WGs = Yap_ReadTimedVar(WokenGoals);
|
||||
Term WGs = Yap_ReadTimedVar(LOCAL_WokenGoals);
|
||||
if (WGs == TermNil) {
|
||||
return(FALSE);
|
||||
}
|
||||
WGs = ListOfWokenGoals( PASS_REGS1 );
|
||||
Yap_UpdateTimedVar(WokenGoals, TermNil);
|
||||
Yap_UpdateTimedVar(LOCAL_WokenGoals, TermNil);
|
||||
return(Yap_unify(ARG1,WGs));
|
||||
#else
|
||||
return(FALSE);
|
||||
|
@ -12,7 +12,7 @@
|
||||
static struct malloc_chunk *
|
||||
ChunkPtrAdjust (struct malloc_chunk *ptr)
|
||||
{
|
||||
return (struct malloc_chunk *) ((char *) (ptr) + HDiff);
|
||||
return (struct malloc_chunk *) ((char *) (ptr) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
|
||||
|
52
C/errors.c
52
C/errors.c
@ -118,15 +118,15 @@ DumpActiveGoals ( USES_REGS1 )
|
||||
fprintf(stderr,"Active ancestors:\n");
|
||||
if (pe->ModuleOfPred) mod = pe->ModuleOfPred;
|
||||
Yap_DebugPlWrite (mod);
|
||||
Yap_DebugPutc (Yap_c_error_stream,':');
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,':');
|
||||
if (pe->ArityOfPE == 0) {
|
||||
Yap_DebugPlWrite (MkAtomTerm ((Atom)f));
|
||||
} else {
|
||||
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
|
||||
Yap_DebugPutc (Yap_c_error_stream,'/');
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,'/');
|
||||
Yap_DebugPlWrite (MkIntTerm (ArityOfFunctor (f)));
|
||||
}
|
||||
Yap_DebugPutc (Yap_c_error_stream,'\n');
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,'\n');
|
||||
} else {
|
||||
UNLOCK(pe->PELock);
|
||||
}
|
||||
@ -152,21 +152,21 @@ DumpActiveGoals ( USES_REGS1 )
|
||||
mod = pe->ModuleOfPred;
|
||||
else mod = TermProlog;
|
||||
Yap_DebugPlWrite (mod);
|
||||
Yap_DebugPutc (Yap_c_error_stream,':');
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,':');
|
||||
if (pe->ArityOfPE == 0) {
|
||||
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor(f)));
|
||||
} else {
|
||||
Int i = 0, arity = pe->ArityOfPE;
|
||||
Term *args = &(b_ptr->cp_a1);
|
||||
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
|
||||
Yap_DebugPutc (Yap_c_error_stream,'(');
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,'(');
|
||||
for (i= 0; i < arity; i++) {
|
||||
if (i > 0) Yap_DebugPutc (Yap_c_error_stream,',');
|
||||
if (i > 0) Yap_DebugPutc (LOCAL_c_error_stream,',');
|
||||
Yap_DebugPlWrite(args[i]);
|
||||
}
|
||||
Yap_DebugPutc (Yap_c_error_stream,')');
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,')');
|
||||
}
|
||||
Yap_DebugPutc (Yap_c_error_stream,'\n');
|
||||
Yap_DebugPutc (LOCAL_c_error_stream,'\n');
|
||||
}
|
||||
UNLOCK(pe->PELock);
|
||||
b_ptr = b_ptr->cp_b;
|
||||
@ -293,7 +293,7 @@ dump_stack( USES_REGS1 )
|
||||
fprintf (stderr,"%% %luKB of Global Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(H-H0))/1024,H0,H);
|
||||
fprintf (stderr,"%% %luKB of Local Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(LCL0-ASP))/1024,ASP,LCL0);
|
||||
fprintf (stderr,"%% %luKB of Trail (%p--%p)\n",(unsigned long int)((ADDR)TR-Yap_TrailBase)/1024,Yap_TrailBase,TR);
|
||||
fprintf (stderr,"%% Performed %ld garbage collections\n", (unsigned long int)GcCalls);
|
||||
fprintf (stderr,"%% Performed %ld garbage collections\n", (unsigned long int)LOCAL_GcCalls);
|
||||
#if LOW_LEVEL_TRACER
|
||||
{
|
||||
extern long long vsc_count;
|
||||
@ -396,7 +396,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
|
||||
where = TermNil;
|
||||
#if DEBUG_STRICT
|
||||
if (Yap_heap_regs && !(Yap_PrologMode & BootMode))
|
||||
fprintf(stderr,"***** Processing Error %d (%lx,%x) %s***\n", type, (unsigned long int)ActiveSignals,Yap_PrologMode,format);
|
||||
fprintf(stderr,"***** Processing Error %d (%lx,%x) %s***\n", type, (unsigned long int)LOCAL_ActiveSignals,Yap_PrologMode,format);
|
||||
else
|
||||
fprintf(stderr,"***** Processing Error %d (%x) %s***\n", type,Yap_PrologMode,format);
|
||||
#endif
|
||||
@ -530,27 +530,27 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
|
||||
break;
|
||||
case CALL_COUNTER_UNDERFLOW:
|
||||
/* Do a long jump */
|
||||
ReductionsCounterOn = FALSE;
|
||||
PredEntriesCounterOn = FALSE;
|
||||
RetriesCounterOn = FALSE;
|
||||
LOCAL_ReductionsCounterOn = FALSE;
|
||||
LOCAL_PredEntriesCounterOn = FALSE;
|
||||
LOCAL_RetriesCounterOn = FALSE;
|
||||
Yap_JumpToEnv(MkAtomTerm(AtomCallCounter));
|
||||
P = (yamop *)FAILCODE;
|
||||
Yap_PrologMode &= ~InErrorMode;
|
||||
return(P);
|
||||
case PRED_ENTRY_COUNTER_UNDERFLOW:
|
||||
/* Do a long jump */
|
||||
ReductionsCounterOn = FALSE;
|
||||
PredEntriesCounterOn = FALSE;
|
||||
RetriesCounterOn = FALSE;
|
||||
LOCAL_ReductionsCounterOn = FALSE;
|
||||
LOCAL_PredEntriesCounterOn = FALSE;
|
||||
LOCAL_RetriesCounterOn = FALSE;
|
||||
Yap_JumpToEnv(MkAtomTerm(AtomCallAndRetryCounter));
|
||||
P = (yamop *)FAILCODE;
|
||||
Yap_PrologMode &= ~InErrorMode;
|
||||
return(P);
|
||||
case RETRY_COUNTER_UNDERFLOW:
|
||||
/* Do a long jump */
|
||||
ReductionsCounterOn = FALSE;
|
||||
PredEntriesCounterOn = FALSE;
|
||||
RetriesCounterOn = FALSE;
|
||||
LOCAL_ReductionsCounterOn = FALSE;
|
||||
LOCAL_PredEntriesCounterOn = FALSE;
|
||||
LOCAL_RetriesCounterOn = FALSE;
|
||||
Yap_JumpToEnv(MkAtomTerm(AtomRetryCounter));
|
||||
P = (yamop *)FAILCODE;
|
||||
Yap_PrologMode &= ~InErrorMode;
|
||||
@ -1859,21 +1859,21 @@ E);
|
||||
}
|
||||
if (serious) {
|
||||
/* disable active signals at this point */
|
||||
ActiveSignals = 0;
|
||||
LOCAL_ActiveSignals = 0;
|
||||
CreepFlag = CalculateStackGap();
|
||||
Yap_PrologMode &= ~InErrorMode;
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
/* we might be in the middle of a critical region */
|
||||
if (Yap_InterruptsDisabled) {
|
||||
Yap_InterruptsDisabled = 0;
|
||||
UncaughtThrow = TRUE;
|
||||
UNLOCK(SignalLock);
|
||||
if (LOCAL_InterruptsDisabled) {
|
||||
LOCAL_InterruptsDisabled = 0;
|
||||
LOCAL_UncaughtThrow = TRUE;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
#if PUSH_REGS
|
||||
restore_absmi_regs(&Yap_standard_regs);
|
||||
#endif
|
||||
siglongjmp(Yap_RestartEnv,1);
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
/* wait if we we are in user code,
|
||||
it's up to her to decide */
|
||||
|
||||
|
4
C/eval.c
4
C/eval.c
@ -40,7 +40,7 @@ static Term
|
||||
Eval(Term t USES_REGS)
|
||||
{
|
||||
if (IsVarTerm(t)) {
|
||||
ArithError = TRUE;
|
||||
LOCAL_ArithError = TRUE;
|
||||
return Yap_ArithError(INSTANTIATION_ERROR,t,"in arithmetic");
|
||||
} else if (IsNumTerm(t)) {
|
||||
return t;
|
||||
@ -151,7 +151,7 @@ Yap_ArithError(yap_error_number type, Term where, char *format,...)
|
||||
CACHE_REGS
|
||||
va_list ap;
|
||||
|
||||
ArithError = TRUE;
|
||||
LOCAL_ArithError = TRUE;
|
||||
Yap_Error_TYPE = type;
|
||||
Yap_Error_Term = where;
|
||||
if (!Yap_ErrorMessage)
|
||||
|
112
C/exec.c
112
C/exec.c
@ -160,15 +160,15 @@ do_execute(Term t, Term mod USES_REGS)
|
||||
/* first do predicate expansion, even before you process signals.
|
||||
This way you don't get to spy goal_expansion(). */
|
||||
if (PRED_GOAL_EXPANSION_ALL) {
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
/* disable creeping when we do goal expansion */
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) {
|
||||
ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) {
|
||||
LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
CreepFlag = CalculateStackGap();
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return CallMetaCall(mod PASS_REGS);
|
||||
} else if (ActiveSignals && !Yap_InterruptsDisabled) {
|
||||
} else if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) {
|
||||
return EnterCreepMode(t, mod PASS_REGS);
|
||||
}
|
||||
restart_exec:
|
||||
@ -331,16 +331,16 @@ do_execute_n(Term t, Term mod, unsigned int n USES_REGS)
|
||||
return CallError(TYPE_ERROR_CALLABLE, mod PASS_REGS);
|
||||
}
|
||||
if (PRED_GOAL_EXPANSION_ALL) {
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
/* disable creeping when we do goal expansion */
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) {
|
||||
ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) {
|
||||
LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
CreepFlag = CalculateStackGap();
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
ARG1 = copy_execn_to_heap(f, pt, n, arity, mod PASS_REGS);
|
||||
return CallMetaCall(mod PASS_REGS);
|
||||
} else if (ActiveSignals && !Yap_InterruptsDisabled) {
|
||||
} else if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) {
|
||||
return EnterCreepMode(copy_execn_to_heap(f, pt, n, arity, CurrentModule PASS_REGS), mod PASS_REGS);
|
||||
}
|
||||
if (arity > MaxTemps) {
|
||||
@ -378,12 +378,12 @@ static Int
|
||||
EnterCreepMode(Term t, Term mod USES_REGS) {
|
||||
PredEntry *PredCreep;
|
||||
|
||||
if (ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
|
||||
ARG1 = t;
|
||||
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap at meta-call");
|
||||
}
|
||||
if (!ActiveSignals) {
|
||||
if (!LOCAL_ActiveSignals) {
|
||||
return do_execute(ARG1, mod PASS_REGS);
|
||||
}
|
||||
}
|
||||
@ -394,9 +394,9 @@ EnterCreepMode(Term t, Term mod USES_REGS) {
|
||||
} else {
|
||||
ARG1 = MkPairTerm(TermProlog,t);
|
||||
}
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
P_before_spy = P;
|
||||
return CallPredicate(PredCreep, B, PredCreep->CodeOfPred PASS_REGS);
|
||||
}
|
||||
@ -631,7 +631,7 @@ p_execute_clause( USES_REGS1 )
|
||||
} else {
|
||||
code = Yap_ClauseFromTerm(clt)->ClCode;
|
||||
}
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
Yap_signal(YAP_CREEP_SIGNAL);
|
||||
}
|
||||
return CallPredicate(RepPredProp(pe), cut_cp, code PASS_REGS);
|
||||
@ -651,7 +651,7 @@ p_execute0( USES_REGS1 )
|
||||
unsigned int arity;
|
||||
Prop pe;
|
||||
|
||||
if (ActiveSignals && !Yap_InterruptsDisabled) {
|
||||
if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) {
|
||||
return EnterCreepMode(t, mod PASS_REGS);
|
||||
}
|
||||
restart_exec:
|
||||
@ -781,7 +781,7 @@ p_execute_nonstop( USES_REGS1 )
|
||||
/* N = arity; */
|
||||
/* call may not define new system predicates!! */
|
||||
if (RepPredProp(pe)->PredFlags & SpiedPredFlag) {
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) {
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) {
|
||||
Yap_signal(YAP_CREEP_SIGNAL);
|
||||
}
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
@ -791,8 +791,8 @@ p_execute_nonstop( USES_REGS1 )
|
||||
}
|
||||
#endif
|
||||
return CallPredicate(RepPredProp(pe), B, RepPredProp(pe)->cs.p_code.TrueCodeOfPred PASS_REGS);
|
||||
} else { if (ActiveSignals & YAP_CREEP_SIGNAL &&
|
||||
!Yap_InterruptsDisabled &&
|
||||
} else { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL &&
|
||||
!LOCAL_InterruptsDisabled &&
|
||||
(!(RepPredProp(pe)->PredFlags & (AsmPredFlag|CPredFlag)) ||
|
||||
RepPredProp(pe)->OpcodeOfPred == Yap_opcode(_call_bfunc_xx))) {
|
||||
Yap_signal(YAP_CREEP_SIGNAL);
|
||||
@ -962,12 +962,12 @@ exec_absmi(int top USES_REGS)
|
||||
/* set stack */
|
||||
ASP = (CELL *)PROTECT_FROZEN_B(B);
|
||||
Yap_StartSlots( PASS_REGS1 );
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
/* forget any signals active, we're reborne */
|
||||
ActiveSignals = 0;
|
||||
LOCAL_ActiveSignals = 0;
|
||||
CreepFlag = CalculateStackGap();
|
||||
Yap_PrologMode = UserMode;
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
P = (yamop *)FAILCODE;
|
||||
}
|
||||
break;
|
||||
@ -999,8 +999,8 @@ exec_absmi(int top USES_REGS)
|
||||
out = Yap_absmi(0);
|
||||
Yap_StartSlots( PASS_REGS1 );
|
||||
/* make sure we don't leave a FAIL signal hanging around */
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
return out;
|
||||
}
|
||||
@ -1048,9 +1048,6 @@ init_stack(int arity, CELL *pt, int top, choiceptr saved_b USES_REGS)
|
||||
#endif /* DEPTH_LIMIT */
|
||||
YENV = ASP = (CELL *)B;
|
||||
HB = H;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
WPP = NULL;
|
||||
#endif
|
||||
/* start with some slots so that we can use them */
|
||||
Yap_StartSlots( PASS_REGS1 );
|
||||
CP = YESCODE;
|
||||
@ -1475,7 +1472,7 @@ JumpToEnv(Term t USES_REGS) {
|
||||
if (EX)
|
||||
return FALSE;
|
||||
/* just keep the throwed object away, we don't need to care about it */
|
||||
if (!(BallTerm = Yap_StoreTermInDB(t, 0))) {
|
||||
if (!(LOCAL_BallTerm = Yap_StoreTermInDB(t, 0))) {
|
||||
/* fat chance */
|
||||
siglongjmp(Yap_RestartEnv,1);
|
||||
}
|
||||
@ -1509,13 +1506,13 @@ JumpToEnv(Term t USES_REGS) {
|
||||
/* we reached C-Code */
|
||||
if (handler->cp_ap == NOCODE) {
|
||||
/* up to the C-code to deal with this! */
|
||||
UncaughtThrow = TRUE;
|
||||
LOCAL_UncaughtThrow = TRUE;
|
||||
if (previous == NULL)
|
||||
B = handler;
|
||||
else
|
||||
previous->cp_b = handler;
|
||||
EX = BallTerm;
|
||||
BallTerm = NULL;
|
||||
EX = LOCAL_BallTerm;
|
||||
LOCAL_BallTerm = NULL;
|
||||
P = (yamop *)FAILCODE;
|
||||
/* make sure failure will be seen at next port */
|
||||
if (Yap_PrologMode & AsyncIntMode) {
|
||||
@ -1528,7 +1525,7 @@ JumpToEnv(Term t USES_REGS) {
|
||||
}
|
||||
/* uncaught throw */
|
||||
if (handler == NULL) {
|
||||
UncaughtThrow = TRUE;
|
||||
LOCAL_UncaughtThrow = TRUE;
|
||||
#if PUSH_REGS
|
||||
restore_absmi_regs(&Yap_standard_regs);
|
||||
#endif
|
||||
@ -1643,26 +1640,25 @@ Yap_InitYaamRegs(void)
|
||||
BBREG = B_FZ = (choiceptr) Yap_LocalBase;
|
||||
TR = TR_FZ = (tr_fr_ptr) Yap_TrailBase;
|
||||
#endif /* FROZEN_STACKS */
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
EX = NULL;
|
||||
init_stack(0, NULL, TRUE, NULL PASS_REGS);
|
||||
/* the first real choice-point will also have AP=FAIL */
|
||||
/* always have an empty slots for people to use */
|
||||
CurSlot = 0;
|
||||
GlobalArena = TermNil;
|
||||
LOCAL_GlobalArena = TermNil;
|
||||
h0var = MkVarTerm();
|
||||
#if COROUTINING
|
||||
WokenGoals = Yap_NewTimedVar(TermNil);
|
||||
AttsMutableList = Yap_NewTimedVar(h0var);
|
||||
LOCAL_WokenGoals = Yap_NewTimedVar(TermNil);
|
||||
LOCAL_AttsMutableList = Yap_NewTimedVar(h0var);
|
||||
#endif
|
||||
GcGeneration = Yap_NewTimedVar(h0var);
|
||||
GcCurrentPhase = 0L;
|
||||
GcPhase = Yap_NewTimedVar(MkIntTerm(GcCurrentPhase));
|
||||
LOCAL_GcGeneration = Yap_NewTimedVar(h0var);
|
||||
LOCAL_GcCurrentPhase = 0L;
|
||||
LOCAL_GcPhase = Yap_NewTimedVar(MkIntTerm(LOCAL_GcCurrentPhase));
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
PP = NULL;
|
||||
WPP = NULL;
|
||||
PREG_ADDR = NULL;
|
||||
#endif
|
||||
Yap_AllocateDefaultArena(128*1024, 2);
|
||||
@ -1678,8 +1674,8 @@ Yap_InitYaamRegs(void)
|
||||
static Int
|
||||
p_uncaught_throw( USES_REGS1 )
|
||||
{
|
||||
Int out = UncaughtThrow;
|
||||
UncaughtThrow = FALSE; /* just caught it */
|
||||
Int out = LOCAL_UncaughtThrow;
|
||||
LOCAL_UncaughtThrow = FALSE; /* just caught it */
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -1687,14 +1683,14 @@ static Int
|
||||
p_creep_allowed( USES_REGS1 )
|
||||
{
|
||||
if (PP != NULL) {
|
||||
LOCK(SignalLock);
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) {
|
||||
ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) {
|
||||
LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
} else {
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -1706,15 +1702,15 @@ p_debug_on( USES_REGS1 )
|
||||
{
|
||||
Term t = Deref(ARG1);
|
||||
if (IsVarTerm(t)) {
|
||||
if (DebugOn)
|
||||
if (LOCAL_DebugOn)
|
||||
return Yap_unify(MkAtomTerm(AtomTrue),ARG1);
|
||||
else
|
||||
return Yap_unify(MkAtomTerm(AtomFalse),ARG1);
|
||||
}
|
||||
if (t == MkAtomTerm(AtomTrue))
|
||||
DebugOn = TRUE;
|
||||
LOCAL_DebugOn = TRUE;
|
||||
else
|
||||
DebugOn = FALSE;
|
||||
LOCAL_DebugOn = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1723,9 +1719,9 @@ Yap_GetException(void)
|
||||
{
|
||||
CACHE_REGS
|
||||
Term t = 0L;
|
||||
if (BallTerm) {
|
||||
if (LOCAL_BallTerm) {
|
||||
do {
|
||||
t = Yap_PopTermFromDB(BallTerm);
|
||||
t = Yap_PopTermFromDB(LOCAL_BallTerm);
|
||||
if (t == 0) {
|
||||
if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
@ -1735,14 +1731,14 @@ Yap_GetException(void)
|
||||
}
|
||||
} else {
|
||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||
if (!Yap_growstack(BallTerm->NOfCells*CellSize)) {
|
||||
if (!Yap_growstack(LOCAL_BallTerm->NOfCells*CellSize)) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (t == 0);
|
||||
BallTerm = NULL;
|
||||
LOCAL_BallTerm = NULL;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
@ -1762,8 +1758,8 @@ void
|
||||
Yap_ResetExceptionTerm(void)
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_ReleaseTermFromDB(BallTerm);
|
||||
BallTerm = NULL;
|
||||
Yap_ReleaseTermFromDB(LOCAL_BallTerm);
|
||||
LOCAL_BallTerm = NULL;
|
||||
}
|
||||
|
||||
static Int
|
||||
|
60
C/globals.c
60
C/globals.c
@ -146,7 +146,7 @@ p_allocate_arena( USES_REGS1 )
|
||||
static Int
|
||||
p_default_arena_size( USES_REGS1 )
|
||||
{
|
||||
return Yap_unify(ARG1,MkIntegerTerm(ArenaSz(GlobalArena)));
|
||||
return Yap_unify(ARG1,MkIntegerTerm(ArenaSz(LOCAL_GlobalArena)));
|
||||
}
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ void
|
||||
Yap_AllocateDefaultArena(Int gsize, Int attsize)
|
||||
{
|
||||
CACHE_REGS
|
||||
GlobalArena = NewArena(gsize, 2, NULL PASS_REGS);
|
||||
LOCAL_GlobalArena = NewArena(gsize, 2, NULL PASS_REGS);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -172,7 +172,7 @@ adjust_cps(UInt size USES_REGS)
|
||||
static int
|
||||
GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity USES_REGS)
|
||||
{
|
||||
ArenaOverflows++;
|
||||
LOCAL_ArenaOverflows++;
|
||||
if (size == 0) {
|
||||
if (old_size < 128*1024) {
|
||||
size = old_size;
|
||||
@ -201,7 +201,7 @@ GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity USES_REGS)
|
||||
} else {
|
||||
XREGS[arity+1] = arena;
|
||||
/* try to recover some room */
|
||||
if (arena == GlobalArena && 10*(pt-H0) > 8*(H-H0)) {
|
||||
if (arena == LOCAL_GlobalArena && 10*(pt-H0) > 8*(H-H0)) {
|
||||
if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, gc_P(P,CP))) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
|
||||
return FALSE;
|
||||
@ -720,8 +720,8 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
||||
HB = oldHB;
|
||||
switch (res) {
|
||||
case -1:
|
||||
if (arena == GlobalArena)
|
||||
GlobalArenaOverflows++;
|
||||
if (arena == LOCAL_GlobalArena)
|
||||
LOCAL_GlobalArenaOverflows++;
|
||||
if (!GrowArena(arena, old_top, old_size, min_grow, arity+3 PASS_REGS)) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||
return 0L;
|
||||
@ -774,8 +774,8 @@ CreateTermInArena(Term arena, Atom Na, UInt Nar, UInt arity, Term *newarena, Ter
|
||||
ASP = oldASP;
|
||||
H = oldH;
|
||||
HB = oldHB;
|
||||
if (arena == GlobalArena)
|
||||
GlobalArenaOverflows++;
|
||||
if (arena == LOCAL_GlobalArena)
|
||||
LOCAL_GlobalArenaOverflows++;
|
||||
if (!GrowArena(arena, old_top, old_size, Nar*sizeof(CELL), arity+2 PASS_REGS)) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "while creating large global term");
|
||||
return 0L;
|
||||
@ -855,8 +855,8 @@ GetGlobalEntry(Atom at USES_REGS)
|
||||
#if THREADS
|
||||
new->owner_id = worker_id;
|
||||
#endif
|
||||
new->NextGE = GlobalVariables;
|
||||
GlobalVariables = new;
|
||||
new->NextGE = LOCAL_GlobalVariables;
|
||||
LOCAL_GlobalVariables = new;
|
||||
new->AtomOfGE = ae;
|
||||
new->NextOfPE = ae->PropsOfAE;
|
||||
ae->PropsOfAE = AbsGlobalProp(new);
|
||||
@ -869,8 +869,8 @@ static UInt
|
||||
garena_overflow_size(CELL *arena USES_REGS)
|
||||
{
|
||||
UInt dup = (((CELL *)arena-H0)*sizeof(CELL))>>3;
|
||||
if (dup < 64*1024*GlobalArenaOverflows)
|
||||
dup = 64*1024*GlobalArenaOverflows;
|
||||
if (dup < 64*1024*LOCAL_GlobalArenaOverflows)
|
||||
dup = 64*1024*LOCAL_GlobalArenaOverflows;
|
||||
if (dup > 1024*1024)
|
||||
return 1024*1024;
|
||||
return dup;
|
||||
@ -911,7 +911,7 @@ p_nb_setarg( USES_REGS1 )
|
||||
return FALSE;
|
||||
|
||||
to = Deref(ARG3);
|
||||
to = CopyTermToArena(ARG3, GlobalArena, FALSE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
|
||||
to = CopyTermToArena(ARG3, LOCAL_GlobalArena, FALSE, TRUE, 2, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
|
||||
if (to == 0L)
|
||||
return FALSE;
|
||||
|
||||
@ -958,7 +958,7 @@ p_nb_set_shared_arg( USES_REGS1 )
|
||||
}
|
||||
if (pos < 1 || pos > arity)
|
||||
return FALSE;
|
||||
to = CopyTermToArena(ARG3, GlobalArena, TRUE, TRUE, 3, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
|
||||
to = CopyTermToArena(ARG3, LOCAL_GlobalArena, TRUE, TRUE, 3, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
|
||||
if (to == 0L)
|
||||
return FALSE;
|
||||
destp[pos] = to;
|
||||
@ -1041,7 +1041,7 @@ p_nb_create_accumulator( USES_REGS1 )
|
||||
if (!Yap_unify(ARG2, acct)) {
|
||||
return FALSE;
|
||||
}
|
||||
to = CopyTermToArena(t, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
|
||||
to = CopyTermToArena(t, LOCAL_GlobalArena, TRUE, TRUE, 2, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
|
||||
if (to == 0L)
|
||||
return FALSE;
|
||||
destp = RepAppl(Deref(ARG2));
|
||||
@ -1091,7 +1091,7 @@ p_nb_add_to_accumulator( USES_REGS1 )
|
||||
target[1] = source[1];
|
||||
} else {
|
||||
/* we need to create a new long int */
|
||||
new = CopyTermToArena(new, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
|
||||
new = CopyTermToArena(new, LOCAL_GlobalArena, TRUE, TRUE, 2, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
|
||||
destp = RepAppl(Deref(ARG1));
|
||||
destp[1] = new;
|
||||
}
|
||||
@ -1118,7 +1118,7 @@ p_nb_add_to_accumulator( USES_REGS1 )
|
||||
new = Yap_MkApplTerm(FunctorPlus, 2, t2);
|
||||
|
||||
new = Yap_Eval(new);
|
||||
new = CopyTermToArena(new, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
|
||||
new = CopyTermToArena(new, LOCAL_GlobalArena, TRUE, TRUE, 2, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
|
||||
destp = RepAppl(Deref(ARG1));
|
||||
destp[1] = new;
|
||||
|
||||
@ -1158,7 +1158,7 @@ Yap_SetGlobalVal(Atom at, Term t0)
|
||||
Term to;
|
||||
GlobalEntry *ge;
|
||||
ge = GetGlobalEntry(at PASS_REGS);
|
||||
to = CopyTermToArena(t0, GlobalArena, FALSE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
|
||||
to = CopyTermToArena(t0, LOCAL_GlobalArena, FALSE, TRUE, 2, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
|
||||
if (to == 0L)
|
||||
return to;
|
||||
WRITE_LOCK(ge->GRWLock);
|
||||
@ -1172,7 +1172,7 @@ Yap_SaveTerm(Term t0)
|
||||
{
|
||||
CACHE_REGS
|
||||
Term to;
|
||||
to = CopyTermToArena(t0, GlobalArena, FALSE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
|
||||
to = CopyTermToArena(t0, LOCAL_GlobalArena, FALSE, TRUE, 2, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
|
||||
if (to == 0L)
|
||||
return to;
|
||||
return to;
|
||||
@ -1205,7 +1205,7 @@ p_nb_set_shared_val( USES_REGS1 )
|
||||
return (FALSE);
|
||||
}
|
||||
ge = GetGlobalEntry(AtomOfTerm(t) PASS_REGS);
|
||||
to = CopyTermToArena(ARG2, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
|
||||
to = CopyTermToArena(ARG2, LOCAL_GlobalArena, TRUE, TRUE, 2, &LOCAL_GlobalArena, garena_overflow_size(ArenaPt(LOCAL_GlobalArena) PASS_REGS) PASS_REGS);
|
||||
if (to == 0L)
|
||||
return FALSE;
|
||||
WRITE_LOCK(ge->GRWLock);
|
||||
@ -1295,10 +1295,10 @@ nbdelete(Atom at USES_REGS)
|
||||
}
|
||||
WRITE_LOCK(ge->GRWLock);
|
||||
ae = ge->AtomOfGE;
|
||||
if (GlobalVariables == ge) {
|
||||
GlobalVariables = ge->NextGE;
|
||||
if (LOCAL_GlobalVariables == ge) {
|
||||
LOCAL_GlobalVariables = ge->NextGE;
|
||||
} else {
|
||||
g = GlobalVariables;
|
||||
g = LOCAL_GlobalVariables;
|
||||
while (g->NextGE != ge)
|
||||
g = g->NextGE;
|
||||
g->NextGE = ge->NextGE;
|
||||
@ -1376,7 +1376,7 @@ p_nb_create( USES_REGS1 )
|
||||
Yap_Error(TYPE_ERROR_ATOM,tname,"nb_create");
|
||||
return FALSE;
|
||||
}
|
||||
to = CreateTermInArena(GlobalArena, AtomOfTerm(tname), IntegerOfTerm(tarity), 3, &GlobalArena, 0L PASS_REGS);
|
||||
to = CreateTermInArena(LOCAL_GlobalArena, AtomOfTerm(tname), IntegerOfTerm(tarity), 3, &LOCAL_GlobalArena, 0L PASS_REGS);
|
||||
if (!to)
|
||||
return FALSE;
|
||||
WRITE_LOCK(ge->GRWLock);
|
||||
@ -1428,7 +1428,7 @@ p_nb_create2( USES_REGS1 )
|
||||
Yap_Error(TYPE_ERROR_ATOM,tname,"nb_create");
|
||||
return FALSE;
|
||||
}
|
||||
to = CreateTermInArena(GlobalArena, AtomOfTerm(tname), IntegerOfTerm(tarity), 4, &GlobalArena, tinit PASS_REGS);
|
||||
to = CreateTermInArena(LOCAL_GlobalArena, AtomOfTerm(tname), IntegerOfTerm(tarity), 4, &LOCAL_GlobalArena, tinit PASS_REGS);
|
||||
if (!to)
|
||||
return FALSE;
|
||||
WRITE_LOCK(ge->GRWLock);
|
||||
@ -1445,7 +1445,7 @@ nb_queue(UInt arena_sz USES_REGS)
|
||||
Term queue_arena, queue, ar[QUEUE_FUNCTOR_ARITY], *nar;
|
||||
Term t = Deref(ARG1);
|
||||
|
||||
DepthArenas++;
|
||||
LOCAL_DepthArenas++;
|
||||
if (!IsVarTerm(t)) {
|
||||
if (!IsApplTerm(t)) {
|
||||
return FALSE;
|
||||
@ -1475,8 +1475,8 @@ static Int
|
||||
p_nb_queue( USES_REGS1 )
|
||||
{
|
||||
UInt arena_sz = (ASP-H)/16;
|
||||
if (DepthArenas > 1)
|
||||
arena_sz /= DepthArenas;
|
||||
if (LOCAL_DepthArenas > 1)
|
||||
arena_sz /= LOCAL_DepthArenas;
|
||||
if (arena_sz < MIN_ARENA_SIZE)
|
||||
arena_sz = MIN_ARENA_SIZE;
|
||||
if (arena_sz > MAX_ARENA_SIZE)
|
||||
@ -1556,7 +1556,7 @@ p_nb_queue_close( USES_REGS1 )
|
||||
Term t = Deref(ARG1);
|
||||
Int out;
|
||||
|
||||
DepthArenas--;
|
||||
LOCAL_DepthArenas--;
|
||||
if (!IsVarTerm(t)) {
|
||||
CELL *qp;
|
||||
|
||||
@ -2531,7 +2531,7 @@ init_current_nb( USES_REGS1 )
|
||||
}
|
||||
}
|
||||
READ_LOCK(HashChain[0].AERWLock);
|
||||
EXTRA_CBACK_ARG(1,1) = MkIntegerTerm((Int)GlobalVariables);
|
||||
EXTRA_CBACK_ARG(1,1) = MkIntegerTerm((Int)LOCAL_GlobalVariables);
|
||||
return cont_current_nb( PASS_REGS1 );
|
||||
}
|
||||
|
||||
|
190
C/grow.c
190
C/grow.c
@ -124,20 +124,20 @@ SetHeapRegs(int copying_threads USES_REGS)
|
||||
fprintf(Yap_stderr,"HeapBase = %x\tHeapTop=%x\nGlobalBase=%x\tGlobalTop=%x\nLocalBase=%x\tLocatTop=%x\n", Yap_HeapBase, HeapTop, Yap_GlobalBase, H, LCL0, ASP);
|
||||
#endif
|
||||
/* The old stack pointers */
|
||||
OldLCL0 = LCL0;
|
||||
OldASP = ASP;
|
||||
OldGlobalBase = (CELL *)Yap_GlobalBase;
|
||||
OldH = H;
|
||||
OldH0 = H0;
|
||||
OldTrailBase = Yap_TrailBase;
|
||||
OldTrailTop = Yap_TrailTop;
|
||||
OldTR = TR;
|
||||
OldHeapBase = Yap_HeapBase;
|
||||
OldHeapTop = HeapTop;
|
||||
LOCAL_OldLCL0 = LCL0;
|
||||
LOCAL_OldASP = ASP;
|
||||
LOCAL_OldGlobalBase = (CELL *)Yap_GlobalBase;
|
||||
LOCAL_OldH = H;
|
||||
LOCAL_OldH0 = H0;
|
||||
LOCAL_OldTrailBase = Yap_TrailBase;
|
||||
LOCAL_OldTrailTop = Yap_TrailTop;
|
||||
LOCAL_OldTR = TR;
|
||||
LOCAL_OldHeapBase = Yap_HeapBase;
|
||||
LOCAL_OldHeapTop = HeapTop;
|
||||
/* Adjust stack addresses */
|
||||
Yap_TrailBase = TrailAddrAdjust(Yap_TrailBase);
|
||||
Yap_TrailTop = TrailAddrAdjust(Yap_TrailTop);
|
||||
if (GDiff) {
|
||||
if (LOCAL_GDiff) {
|
||||
/* make sure we are not just expanding the delay stack */
|
||||
Yap_GlobalBase = BaseAddrAdjust(Yap_GlobalBase);
|
||||
}
|
||||
@ -157,10 +157,10 @@ SetHeapRegs(int copying_threads USES_REGS)
|
||||
ASP = PtoLocAdjust(ASP);
|
||||
if (H0)
|
||||
H0 = PtoGloAdjust(H0);
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LCL0)
|
||||
LCL0 = PtoLocAdjust(LCL0);
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
if (H)
|
||||
H = PtoGloAdjust(H);
|
||||
#ifdef CUT_C
|
||||
@ -190,17 +190,17 @@ SetHeapRegs(int copying_threads USES_REGS)
|
||||
else if (IsOldLocalPtr(S))
|
||||
S = PtoLocAdjust(S);
|
||||
if (!copying_threads) {
|
||||
if (GlobalArena)
|
||||
GlobalArena = AbsAppl(PtoGloAdjust(RepAppl(GlobalArena)));
|
||||
if (LOCAL_GlobalArena)
|
||||
LOCAL_GlobalArena = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_GlobalArena)));
|
||||
}
|
||||
#ifdef COROUTINING
|
||||
if (AttsMutableList)
|
||||
AttsMutableList = AbsAppl(PtoGloAdjust(RepAppl(AttsMutableList)));
|
||||
if (WokenGoals)
|
||||
WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(WokenGoals)));
|
||||
if (LOCAL_AttsMutableList)
|
||||
LOCAL_AttsMutableList = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_AttsMutableList)));
|
||||
if (LOCAL_WokenGoals)
|
||||
LOCAL_WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_WokenGoals)));
|
||||
#endif
|
||||
GcGeneration = AbsAppl(PtoGloAdjust(RepAppl(GcGeneration)));
|
||||
GcPhase = AbsAppl(PtoGloAdjust(RepAppl(GcPhase)));
|
||||
LOCAL_GcGeneration = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_GcGeneration)));
|
||||
LOCAL_GcPhase = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_GcPhase)));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -208,9 +208,9 @@ MoveLocalAndTrail( USES_REGS1 )
|
||||
{
|
||||
/* cpcellsd(To,From,NOfCells) - copy the cells downwards */
|
||||
#if USE_SYSTEM_MALLOC
|
||||
cpcellsd(ASP, (CELL *)((char *)OldASP+BaseDiff), (CELL *)OldTR - OldASP);
|
||||
cpcellsd(ASP, (CELL *)((char *)LOCAL_OldASP+LOCAL_BaseDiff), (CELL *)LOCAL_OldTR - LOCAL_OldASP);
|
||||
#else
|
||||
cpcellsd(ASP, OldASP, (CELL *)OldTR - OldASP);
|
||||
cpcellsd(ASP, LOCAL_OldASP, (CELL *)LOCAL_OldTR - LOCAL_OldASP);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ CopyLocalAndTrail( USES_REGS1 )
|
||||
{
|
||||
/* cpcellsd(To,From,NOfCells) - copy the cells downwards */
|
||||
#if USE_SYSTEM_MALLOC
|
||||
cpcellsd((void *)ASP, (void *)OldASP, (CELL *)OldTR - OldASP);
|
||||
cpcellsd((void *)ASP, (void *)LOCAL_OldASP, (CELL *)LOCAL_OldTR - LOCAL_OldASP);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ MoveGlobal( USES_REGS1 )
|
||||
* cpcellsd(To,From,NOfCells) - copy the cells downwards - in
|
||||
* absmi.asm
|
||||
*/
|
||||
cpcellsd((CELL *)Yap_GlobalBase, (CELL *)OldGlobalBase, OldH - (CELL *)OldGlobalBase);
|
||||
cpcellsd((CELL *)Yap_GlobalBase, (CELL *)LOCAL_OldGlobalBase, LOCAL_OldH - (CELL *)LOCAL_OldGlobalBase);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -329,7 +329,7 @@ MoveExpandedGlobal( USES_REGS1 )
|
||||
* cpcellsd(To,From,NOfCells) - copy the cells downwards - in
|
||||
* absmi.asm
|
||||
*/
|
||||
cpcellsd((CELL *)(Yap_GlobalBase+(GDiff-BaseDiff)), (CELL *)Yap_GlobalBase, OldH - (CELL *)OldGlobalBase);
|
||||
cpcellsd((CELL *)(Yap_GlobalBase+(LOCAL_GDiff-LOCAL_BaseDiff)), (CELL *)Yap_GlobalBase, LOCAL_OldH - (CELL *)LOCAL_OldGlobalBase);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -340,9 +340,9 @@ MoveGlobalWithHole( USES_REGS1 )
|
||||
* absmi.asm
|
||||
*/
|
||||
#if USE_SYSTEM_MALLOC
|
||||
cpcellsd((CELL *)((char *)Yap_GlobalBase+(GDiff0-BaseDiff)), (CELL *)Yap_GlobalBase, OldH - (CELL *)OldGlobalBase);
|
||||
cpcellsd((CELL *)((char *)Yap_GlobalBase+(LOCAL_GDiff0-LOCAL_BaseDiff)), (CELL *)Yap_GlobalBase, LOCAL_OldH - (CELL *)LOCAL_OldGlobalBase);
|
||||
#else
|
||||
cpcellsd((CELL *)((char *)OldGlobalBase+GDiff0), (CELL *)OldGlobalBase, OldH - (CELL *)OldGlobalBase);
|
||||
cpcellsd((CELL *)((char *)LOCAL_OldGlobalBase+LOCAL_GDiff0), (CELL *)LOCAL_OldGlobalBase, LOCAL_OldH - (CELL *)LOCAL_OldGlobalBase);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -353,9 +353,9 @@ MoveHalfGlobal(CELL *OldPt USES_REGS)
|
||||
* cpcellsd(To,From,NOfCells) - copy the cells downwards - in
|
||||
* absmi.asm
|
||||
*/
|
||||
UInt diff = OldH-OldPt;
|
||||
CELL *NewPt = (CELL *)((char*)OldPt+GDiff);
|
||||
CELL *IntPt = (CELL *)((char*)OldPt+GDiff0);
|
||||
UInt diff = LOCAL_OldH-OldPt;
|
||||
CELL *NewPt = (CELL *)((char*)OldPt+LOCAL_GDiff);
|
||||
CELL *IntPt = (CELL *)((char*)OldPt+LOCAL_GDiff0);
|
||||
cpcellsd(NewPt, IntPt, diff);
|
||||
}
|
||||
|
||||
@ -518,9 +518,9 @@ static void
|
||||
AdjustGlobal(long sz, int thread_copying USES_REGS)
|
||||
{
|
||||
CELL *pt, *pt_max;
|
||||
ArrayEntry *al = DynamicArrays;
|
||||
StaticArrayEntry *sal = StaticArrays;
|
||||
GlobalEntry *gl = GlobalVariables;
|
||||
ArrayEntry *al = LOCAL_DynamicArrays;
|
||||
StaticArrayEntry *sal = LOCAL_StaticArrays;
|
||||
GlobalEntry *gl = LOCAL_GlobalVariables;
|
||||
|
||||
while (al) {
|
||||
al->ValueOfVE = AdjustGlobTerm(al->ValueOfVE PASS_REGS);
|
||||
@ -797,23 +797,23 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o
|
||||
fprintf(Yap_stderr, "%% growing the heap %ld bytes\n", size);
|
||||
}
|
||||
/* CreepFlag is set to force heap expansion */
|
||||
if (ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||
LOCK(SignalLock);
|
||||
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||
LOCK(LOCAL_SignalLock);
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
}
|
||||
ASP -= 256;
|
||||
YAPEnterCriticalSection();
|
||||
TrDiff = LDiff = GDiff = GDiff0 = DelayDiff = BaseDiff = size;
|
||||
XDiff = HDiff = 0;
|
||||
GSplit = NULL;
|
||||
LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff = size;
|
||||
LOCAL_XDiff = LOCAL_HDiff = 0;
|
||||
LOCAL_GSplit = NULL;
|
||||
SetHeapRegs(FALSE PASS_REGS);
|
||||
MoveLocalAndTrail( PASS_REGS1 );
|
||||
if (fix_code) {
|
||||
CELL *SaveOldH = OldH;
|
||||
OldH = (CELL *)cip->freep;
|
||||
CELL *SaveOldH = LOCAL_OldH;
|
||||
LOCAL_OldH = (CELL *)cip->freep;
|
||||
MoveGlobal( PASS_REGS1 );
|
||||
OldH = SaveOldH;
|
||||
LOCAL_OldH = SaveOldH;
|
||||
} else {
|
||||
MoveGlobal( PASS_REGS1 );
|
||||
}
|
||||
@ -949,40 +949,40 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
|
||||
/* we got over a hole */
|
||||
if (minimal_request) {
|
||||
/* we went over a hole */
|
||||
BaseDiff = size+((CELL)Yap_TrailTop-(CELL)Yap_GlobalBase)-minimal_request;
|
||||
LDiff = TrDiff = size;
|
||||
LOCAL_BaseDiff = size+((CELL)Yap_TrailTop-(CELL)Yap_GlobalBase)-minimal_request;
|
||||
LOCAL_LDiff = LOCAL_TrDiff = size;
|
||||
} else {
|
||||
/* we may still have an overflow */
|
||||
BaseDiff = Yap_GlobalBase - old_GlobalBase;
|
||||
LOCAL_BaseDiff = Yap_GlobalBase - old_GlobalBase;
|
||||
/* if we grow, we need to move the stacks */
|
||||
LDiff = TrDiff = BaseDiff+size;
|
||||
LOCAL_LDiff = LOCAL_TrDiff = LOCAL_BaseDiff+size;
|
||||
}
|
||||
} else {
|
||||
/* stay still */
|
||||
LDiff = TrDiff = 0;
|
||||
BaseDiff = 0;
|
||||
LOCAL_LDiff = LOCAL_TrDiff = 0;
|
||||
LOCAL_BaseDiff = 0;
|
||||
}
|
||||
/* now, remember we have delay -- global with a hole in delay or a
|
||||
hole in global */
|
||||
if (!hsplit) {
|
||||
if (!do_grow) {
|
||||
DelayDiff = GDiff = GDiff0 = size;
|
||||
LOCAL_DelayDiff = LOCAL_GDiff = LOCAL_GDiff0 = size;
|
||||
request = 0L;
|
||||
} else {
|
||||
/* expand delay stack */
|
||||
DelayDiff = GDiff = GDiff0 = LDiff;
|
||||
LOCAL_DelayDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_LDiff;
|
||||
}
|
||||
} else if (insert_in_delays) {
|
||||
/* we want to expand a hole for the delay stack */
|
||||
DelayDiff = size-request;
|
||||
GDiff = GDiff0 = size;
|
||||
LOCAL_DelayDiff = size-request;
|
||||
LOCAL_GDiff = LOCAL_GDiff0 = size;
|
||||
} else {
|
||||
/* we want to expand a hole for the delay stack */
|
||||
GDiff0 = DelayDiff = BaseDiff;
|
||||
GDiff = BaseDiff+request;
|
||||
LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff;
|
||||
LOCAL_GDiff = LOCAL_BaseDiff+request;
|
||||
}
|
||||
GSplit = hsplit;
|
||||
XDiff = HDiff = 0;
|
||||
LOCAL_GSplit = hsplit;
|
||||
LOCAL_XDiff = LOCAL_HDiff = 0;
|
||||
Yap_GlobalBase = old_GlobalBase;
|
||||
SetHeapRegs(FALSE PASS_REGS);
|
||||
if (do_grow) {
|
||||
@ -996,7 +996,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
|
||||
MoveExpandedGlobal( PASS_REGS1 );
|
||||
}
|
||||
/* don't run through garbage */
|
||||
if (hsplit && (OldH != hsplit)) {
|
||||
if (hsplit && (LOCAL_OldH != hsplit)) {
|
||||
AdjustStacksAndTrail(request, FALSE PASS_REGS);
|
||||
} else {
|
||||
AdjustStacksAndTrail(0, FALSE PASS_REGS);
|
||||
@ -1008,7 +1008,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
|
||||
if (hsplit) {
|
||||
if (insert_in_delays) {
|
||||
/* we have things not quite where we want to have them */
|
||||
cpcellsd((CELL *)(omax+DelayDiff), (CELL *)(omax+GDiff0), (ADDR)hsplit-omax);
|
||||
cpcellsd((CELL *)(omax+LOCAL_DelayDiff), (CELL *)(omax+LOCAL_GDiff0), (ADDR)hsplit-omax);
|
||||
} else {
|
||||
MoveHalfGlobal(hsplit PASS_REGS);
|
||||
}
|
||||
@ -1028,7 +1028,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
|
||||
if (hsplit) {
|
||||
return request;
|
||||
} else
|
||||
return GDiff-BaseDiff;
|
||||
return LOCAL_GDiff-LOCAL_BaseDiff;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1287,11 +1287,11 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *ol
|
||||
fix_tabling_info( PASS_REGS1 );
|
||||
#endif /* TABLING */
|
||||
if (sz >= sizeof(CELL) * K16) {
|
||||
LOCK(SignalLock);
|
||||
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
LOCK(LOCAL_SignalLock);
|
||||
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return TRUE;
|
||||
}
|
||||
/* failed */
|
||||
@ -1342,12 +1342,12 @@ growatomtable( USES_REGS1 )
|
||||
UInt start_growth_time = Yap_cputime(), growth_time;
|
||||
int gc_verbose = Yap_is_gc_verbose();
|
||||
|
||||
LOCK(SignalLock);
|
||||
if (ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||
CreepFlag = CalculateStackGap();
|
||||
}
|
||||
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
UNLOCK(SignalLock);
|
||||
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
while ((ntb = (AtomHashEntry *)Yap_AllocCodeSpace(nsize*sizeof(AtomHashEntry))) == NULL) {
|
||||
/* leave for next time */
|
||||
#if !USE_SYSTEM_MALLOC
|
||||
@ -1408,12 +1408,12 @@ Yap_growheap(int fix_code, UInt in_size, void *cip)
|
||||
NOfAtoms > 2*AtomHashTableSize) {
|
||||
res = growatomtable( PASS_REGS1 );
|
||||
} else {
|
||||
LOCK(SignalLock);
|
||||
if (ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||
CreepFlag = CalculateStackGap();
|
||||
}
|
||||
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
UNLOCK(SignalLock);
|
||||
LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return TRUE;
|
||||
}
|
||||
LeaveGrowMode(GrowHeapMode);
|
||||
@ -1509,29 +1509,29 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
|
||||
return FALSE;
|
||||
}
|
||||
YAPEnterCriticalSection();
|
||||
GDiff = DelayDiff = BaseDiff = size-size0;
|
||||
LOCAL_GDiff = LOCAL_DelayDiff = LOCAL_BaseDiff = size-size0;
|
||||
} else {
|
||||
YAPEnterCriticalSection();
|
||||
if (Yap_GlobalBase != old_Yap_GlobalBase) {
|
||||
GDiff = BaseDiff = DelayDiff = Yap_GlobalBase-old_Yap_GlobalBase;
|
||||
LOCAL_GDiff = LOCAL_BaseDiff = LOCAL_DelayDiff = Yap_GlobalBase-old_Yap_GlobalBase;
|
||||
Yap_GlobalBase=old_Yap_GlobalBase;
|
||||
} else {
|
||||
GDiff = BaseDiff = DelayDiff = 0;
|
||||
LOCAL_GDiff = LOCAL_BaseDiff = LOCAL_DelayDiff = 0;
|
||||
}
|
||||
}
|
||||
XDiff = HDiff = 0;
|
||||
GDiff0=GDiff;
|
||||
LOCAL_XDiff = LOCAL_HDiff = 0;
|
||||
LOCAL_GDiff0=LOCAL_GDiff;
|
||||
#if USE_SYSTEM_MALLOC
|
||||
if (from_trail) {
|
||||
TrDiff = LDiff = GDiff;
|
||||
LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff;
|
||||
} else {
|
||||
TrDiff = LDiff = size+GDiff;
|
||||
LOCAL_TrDiff = LOCAL_LDiff = size+LOCAL_GDiff;
|
||||
}
|
||||
#else
|
||||
if (from_trail) {
|
||||
TrDiff = LDiff = size-size0;
|
||||
LOCAL_TrDiff = LOCAL_LDiff = size-size0;
|
||||
} else {
|
||||
TrDiff = LDiff = size;
|
||||
LOCAL_TrDiff = LOCAL_LDiff = size;
|
||||
}
|
||||
#endif
|
||||
ASP -= 256;
|
||||
@ -1539,10 +1539,10 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
|
||||
if (from_trail) {
|
||||
Yap_TrailTop += size0;
|
||||
}
|
||||
if (LDiff) {
|
||||
if (LOCAL_LDiff) {
|
||||
MoveLocalAndTrail( PASS_REGS1 );
|
||||
}
|
||||
if (GDiff) {
|
||||
if (LOCAL_GDiff) {
|
||||
#if !USE_SYSTEM_MALLOC
|
||||
/* That is done by realloc */
|
||||
MoveGlobal( PASS_REGS1 );
|
||||
@ -1563,7 +1563,7 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
|
||||
#ifdef TABLING
|
||||
fix_tabling_info( PASS_REGS1 );
|
||||
#endif /* TABLING */
|
||||
} else if (LDiff) {
|
||||
} else if (LOCAL_LDiff) {
|
||||
if (in_parser) {
|
||||
tr_fr_ptr nTR;
|
||||
|
||||
@ -1721,7 +1721,7 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
|
||||
} else {
|
||||
YAPEnterCriticalSection();
|
||||
if (in_parser) {
|
||||
TrDiff = LDiff = GDiff = BaseDiff = DelayDiff = XDiff = HDiff = GDiff0 = 0;
|
||||
LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff = LOCAL_BaseDiff = LOCAL_DelayDiff = LOCAL_XDiff = LOCAL_HDiff = LOCAL_GDiff0 = 0;
|
||||
AdjustScannerStacks(tksp, vep PASS_REGS);
|
||||
}
|
||||
Yap_TrailTop += size;
|
||||
@ -1734,12 +1734,12 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
|
||||
fprintf(Yap_stderr, "%% took %g sec\n", (double)growth_time/1000);
|
||||
fprintf(Yap_stderr, "%% Total of %g sec expanding trail \n", (double)total_trail_overflow_time/1000);
|
||||
}
|
||||
LOCK(SignalLock);
|
||||
if (ActiveSignals == YAP_TROVF_SIGNAL) {
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LOCAL_ActiveSignals == YAP_TROVF_SIGNAL) {
|
||||
CreepFlag = CalculateStackGap();
|
||||
}
|
||||
ActiveSignals &= ~YAP_TROVF_SIGNAL;
|
||||
UNLOCK(SignalLock);
|
||||
LOCAL_ActiveSignals &= ~YAP_TROVF_SIGNAL;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1860,9 +1860,9 @@ Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental)
|
||||
Yap_TrailBase = Yap_thread_gl[worker_p].trail_base;
|
||||
Yap_TrailTop = Yap_thread_gl[worker_p].trail_top;
|
||||
size = FOREIGN_ThreadHandle(worker_q).stack_address-FOREIGN_ThreadHandle(worker_p).stack_address;
|
||||
TrDiff = LDiff = GDiff = GDiff0 = DelayDiff = BaseDiff = size;
|
||||
XDiff = HDiff = 0;
|
||||
GSplit = NULL;
|
||||
LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff = size;
|
||||
LOCAL_XDiff = LOCAL_HDiff = 0;
|
||||
LOCAL_GSplit = NULL;
|
||||
H = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->H_;
|
||||
H0 = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->H0_;
|
||||
B = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->B_;
|
||||
@ -1876,9 +1876,9 @@ Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental)
|
||||
#ifdef CUT_C
|
||||
Yap_REGS.CUT_C_TOP = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->CUT_C_TOP;
|
||||
#endif
|
||||
DynamicArrays = NULL;
|
||||
StaticArrays = NULL;
|
||||
GlobalVariables = NULL;
|
||||
LOCAL_DynamicArrays = NULL;
|
||||
LOCAL_StaticArrays = NULL;
|
||||
LOCAL_GlobalVariables = NULL;
|
||||
SetHeapRegs(TRUE PASS_REGS);
|
||||
if (incremental) {
|
||||
IncrementalCopyStacksFromWorker( PASS_REGS1 );
|
||||
|
561
C/heapgc.c
561
C/heapgc.c
File diff suppressed because it is too large
Load Diff
44
C/index.c
44
C/index.c
@ -3454,7 +3454,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
|
||||
}
|
||||
#endif
|
||||
/* globals for assembler */
|
||||
IPredArity = ap->ArityOfPE;
|
||||
LOCAL_IPredArity = ap->ArityOfPE;
|
||||
if (cint.CodeStart) {
|
||||
if ((indx_out = Yap_assemble(ASSEMBLING_INDEX, TermNil, ap, FALSE, &cint, cint.i_labelno+1)) == NULL) {
|
||||
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
||||
@ -4577,12 +4577,12 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
|
||||
if (!tmod) tmod = TermProlog;
|
||||
#if THREADS
|
||||
Yap_DebugPlWrite(MkIntegerTerm(worker_id));
|
||||
Yap_DebugPutc(Yap_c_error_stream,' ');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,' ');
|
||||
#endif
|
||||
Yap_DebugPutc(Yap_c_error_stream,'>');
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\t');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'>');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\t');
|
||||
Yap_DebugPlWrite(tmod);
|
||||
Yap_DebugPutc(Yap_c_error_stream,':');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,':');
|
||||
if (ap->ModuleOfPred == IDB_MODULE) {
|
||||
Term t = Deref(ARG1);
|
||||
if (IsAtomTerm(t)) {
|
||||
@ -4593,7 +4593,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
|
||||
Functor f = FunctorOfTerm(t);
|
||||
Atom At = NameOfFunctor(f);
|
||||
Yap_DebugPlWrite(MkAtomTerm(At));
|
||||
Yap_DebugPutc(Yap_c_error_stream,'/');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
||||
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
|
||||
}
|
||||
} else {
|
||||
@ -4604,14 +4604,14 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
|
||||
Functor f = ap->FunctorOfPred;
|
||||
Atom At = NameOfFunctor(f);
|
||||
Yap_DebugPlWrite(MkAtomTerm(At));
|
||||
Yap_DebugPutc(Yap_c_error_stream,'/');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
||||
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
|
||||
}
|
||||
}
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\n');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\n');
|
||||
#if THREADS
|
||||
Yap_DebugPlWrite(MkIntegerTerm(worker_id));
|
||||
Yap_DebugPutc(Yap_c_error_stream,' ');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,' ');
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -4639,7 +4639,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
|
||||
}
|
||||
#endif
|
||||
/* globals for assembler */
|
||||
IPredArity = ap->ArityOfPE;
|
||||
LOCAL_IPredArity = ap->ArityOfPE;
|
||||
if (cint.CodeStart) {
|
||||
if ((indx_out = Yap_assemble(ASSEMBLING_EINDEX, TermNil, ap, FALSE, &cint, cint.i_labelno+1)) == NULL) {
|
||||
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
|
||||
@ -6049,10 +6049,10 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
|
||||
if (Yap_Option['i' - 'a' + 1]) {
|
||||
Term tmod = ap->ModuleOfPred;
|
||||
if (!tmod) tmod = TermProlog;
|
||||
Yap_DebugPutc(Yap_c_error_stream,'+');
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\t');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'+');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\t');
|
||||
Yap_DebugPlWrite(tmod);
|
||||
Yap_DebugPutc(Yap_c_error_stream,':');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,':');
|
||||
if (ap->ModuleOfPred == IDB_MODULE) {
|
||||
Term t = Deref(ARG1);
|
||||
if (IsAtomTerm(t)) {
|
||||
@ -6063,7 +6063,7 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
|
||||
Functor f = FunctorOfTerm(t);
|
||||
Atom At = NameOfFunctor(f);
|
||||
Yap_DebugPlWrite(MkAtomTerm(At));
|
||||
Yap_DebugPutc(Yap_c_error_stream,'/');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
||||
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
|
||||
}
|
||||
} else {
|
||||
@ -6074,11 +6074,11 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
|
||||
Functor f = ap->FunctorOfPred;
|
||||
Atom At = NameOfFunctor(f);
|
||||
Yap_DebugPlWrite(MkAtomTerm(At));
|
||||
Yap_DebugPutc(Yap_c_error_stream,'/');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
||||
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
|
||||
}
|
||||
}
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\n');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\n');
|
||||
}
|
||||
#endif
|
||||
stack = (path_stack_entry *)TR;
|
||||
@ -6534,10 +6534,10 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
|
||||
Term tmod = ap->ModuleOfPred;
|
||||
|
||||
if (!tmod) tmod = TermProlog;
|
||||
Yap_DebugPutc(Yap_c_error_stream,'-');
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\t');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'-');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\t');
|
||||
Yap_DebugPlWrite(tmod);
|
||||
Yap_DebugPutc(Yap_c_error_stream,':');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,':');
|
||||
if (ap->ModuleOfPred != IDB_MODULE) {
|
||||
if (ap->ArityOfPE == 0) {
|
||||
Atom At = (Atom)ap->FunctorOfPred;
|
||||
@ -6546,7 +6546,7 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
|
||||
Functor f = ap->FunctorOfPred;
|
||||
Atom At = NameOfFunctor(f);
|
||||
Yap_DebugPlWrite(MkAtomTerm(At));
|
||||
Yap_DebugPutc(Yap_c_error_stream,'/');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
||||
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
|
||||
}
|
||||
} else {
|
||||
@ -6560,11 +6560,11 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
|
||||
Functor f = ap->FunctorOfPred;
|
||||
Atom At = NameOfFunctor(f);
|
||||
Yap_DebugPlWrite(MkAtomTerm(At));
|
||||
Yap_DebugPutc(Yap_c_error_stream,'/');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
||||
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
|
||||
}
|
||||
}
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\n');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\n');
|
||||
}
|
||||
#endif
|
||||
stack = (path_stack_entry *)TR;
|
||||
|
16
C/init.c
16
C/init.c
@ -1201,14 +1201,14 @@ InitFirstWorkerThreadHandle(void)
|
||||
{
|
||||
#ifdef THREADS
|
||||
CACHE_REGS
|
||||
ThreadHandle.id = 0;
|
||||
ThreadHandle.in_use = TRUE;
|
||||
ThreadHandle.default_yaam_regs =
|
||||
LOCAL_ThreadHandle.id = 0;
|
||||
LOCAL_ThreadHandle.in_use = TRUE;
|
||||
LOCAL_ThreadHandle.default_yaam_regs =
|
||||
&Yap_standard_regs;
|
||||
ThreadHandle.pthread_handle = pthread_self();
|
||||
LOCAL_ThreadHandle.pthread_handle = pthread_self();
|
||||
pthread_mutex_init(&FOREIGN_ThreadHandle(0).tlock, NULL);
|
||||
pthread_mutex_init(&FOREIGN_ThreadHandle(0).tlock_status, NULL);
|
||||
ThreadHandle.tdetach = MkAtomTerm(AtomFalse);
|
||||
LOCAL_ThreadHandle.tdetach = MkAtomTerm(AtomFalse);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1224,9 +1224,9 @@ void
|
||||
Yap_CloseScratchPad(void)
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_FreeCodeSpace(ScratchPad.ptr);
|
||||
ScratchPad.sz = SCRATCH_START_SIZE;
|
||||
ScratchPad.msz = SCRATCH_START_SIZE;
|
||||
Yap_FreeCodeSpace(LOCAL_ScratchPad.ptr);
|
||||
LOCAL_ScratchPad.sz = SCRATCH_START_SIZE;
|
||||
LOCAL_ScratchPad.msz = SCRATCH_START_SIZE;
|
||||
}
|
||||
|
||||
#include "iglobals.h"
|
||||
|
@ -405,9 +405,9 @@ p_dif( USES_REGS1 )
|
||||
* We may wake up goals during our attempt to unify the
|
||||
* two terms. If we are adding to the tail of a list of
|
||||
* woken goals that should be ok, but otherwise we need
|
||||
* to restore WokenGoals to its previous value.
|
||||
* to restore LOCAL_WokenGoals to its previous value.
|
||||
*/
|
||||
CELL OldWokenGoals = Yap_ReadTimedVar(WokenGoals);
|
||||
CELL OldWokenGoals = Yap_ReadTimedVar(LOCAL_WokenGoals);
|
||||
#endif
|
||||
register tr_fr_ptr pt0;
|
||||
/* store the old value of TR for clearing bindings */
|
||||
@ -425,7 +425,7 @@ p_dif( USES_REGS1 )
|
||||
d0 = Yap_IUnify(d0, d1);
|
||||
#ifdef COROUTINING
|
||||
/* now restore Woken Goals to its old value */
|
||||
Yap_UpdateTimedVar(WokenGoals, OldWokenGoals);
|
||||
Yap_UpdateTimedVar(LOCAL_WokenGoals, OldWokenGoals);
|
||||
if (OldWokenGoals == TermNil) {
|
||||
Yap_undo_signal(YAP_WAKEUP_SIGNAL);
|
||||
}
|
||||
|
18
C/iopreds.c
18
C/iopreds.c
@ -206,7 +206,7 @@ void
|
||||
Yap_DebugErrorPutc(int c)
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_DebugPutc (Yap_c_error_stream, c);
|
||||
Yap_DebugPutc (LOCAL_c_error_stream, c);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -238,7 +238,7 @@ typedef struct stream_ref
|
||||
int beam_write (void)
|
||||
{
|
||||
Yap_StartSlots();
|
||||
Yap_plwrite (ARG1, Stream[Yap_c_output_stream].stream_wputc, 0, 1200);
|
||||
Yap_plwrite (ARG1, Stream[LOCAL_c_output_stream].stream_wputc, 0, 1200);
|
||||
Yap_CloseSlots();
|
||||
if (EX != 0L) {
|
||||
Term ball = Yap_PopTermFromDB(EX);
|
||||
@ -436,13 +436,13 @@ Int
|
||||
Yap_FirstLineInParse (void)
|
||||
{
|
||||
CACHE_REGS
|
||||
return StartLine;
|
||||
return LOCAL_StartLine;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_startline ( USES_REGS1 )
|
||||
{
|
||||
return (Yap_unify_constant (ARG1, MkIntegerTerm (StartLine)));
|
||||
return (Yap_unify_constant (ARG1, MkIntegerTerm (LOCAL_StartLine)));
|
||||
}
|
||||
|
||||
/* control the parser error handler */
|
||||
@ -652,7 +652,7 @@ static Int
|
||||
|
||||
|
||||
H = old_H;
|
||||
TR = (tr_fr_ptr)ScannerStack;
|
||||
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
||||
|
||||
if (!strcmp(Yap_ErrorMessage,"Stack Overflow"))
|
||||
res = Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable);
|
||||
@ -661,14 +661,14 @@ static Int
|
||||
else
|
||||
res = Yap_growtrail_in_parser(&old_TR, &tokstart, &Yap_VarTable);
|
||||
if (res) {
|
||||
ScannerStack = (char *)TR;
|
||||
LOCAL_ScannerStack = (char *)TR;
|
||||
TR = old_TR;
|
||||
old_H = H;
|
||||
Yap_tokptr = Yap_toktide = tokstart;
|
||||
Yap_ErrorMessage = NULL;
|
||||
goto repeat_cycle;
|
||||
}
|
||||
ScannerStack = (char *)TR;
|
||||
LOCAL_ScannerStack = (char *)TR;
|
||||
TR = old_TR;
|
||||
}
|
||||
}
|
||||
@ -722,9 +722,9 @@ static Int
|
||||
old_TR = TR;
|
||||
/* restart global */
|
||||
H = old_H;
|
||||
TR = (tr_fr_ptr)ScannerStack;
|
||||
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
||||
Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable);
|
||||
ScannerStack = (char *)TR;
|
||||
LOCAL_ScannerStack = (char *)TR;
|
||||
TR = old_TR;
|
||||
}
|
||||
}
|
||||
|
@ -696,10 +696,10 @@ ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS)
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (Yap_Option['p' - 'a' + 1]) {
|
||||
Yap_DebugPutc(Yap_c_error_stream,'[');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'[');
|
||||
Yap_DebugPlWrite(t);
|
||||
Yap_DebugPutc(Yap_c_error_stream,']');
|
||||
Yap_DebugPutc(Yap_c_error_stream,'\n');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,']');
|
||||
Yap_DebugPutc(LOCAL_c_error_stream,'\n');
|
||||
}
|
||||
#endif
|
||||
return t;
|
||||
|
86
C/save.c
86
C/save.c
@ -422,18 +422,18 @@ save_regs(int mode USES_REGS)
|
||||
return -1;
|
||||
if (mode == DO_EVERYTHING) {
|
||||
#ifdef COROUTINING
|
||||
if (putout(WokenGoals) < 0)
|
||||
if (putout(LOCAL_WokenGoals) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
#ifdef DEPTH_LIMIT
|
||||
if (putout(DEPTH) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
if (putout(GcGeneration) < 0)
|
||||
if (putout(LOCAL_GcGeneration) < 0)
|
||||
return -1;
|
||||
if (putout(GcPhase) < 0)
|
||||
if (putout(LOCAL_GcPhase) < 0)
|
||||
return -1;
|
||||
if (putout(GcCurrentPhase) < 0)
|
||||
if (putout(LOCAL_GcCurrentPhase) < 0)
|
||||
return -1;
|
||||
}
|
||||
/* The operand base */
|
||||
@ -459,11 +459,11 @@ save_regs(int mode USES_REGS)
|
||||
return -1;
|
||||
if (putcellptr(CellPtr(AuxTop)) < 0)
|
||||
return -1;
|
||||
if (putcellptr(CellPtr(ScratchPad.ptr)) < 0)
|
||||
if (putcellptr(CellPtr(LOCAL_ScratchPad.ptr)) < 0)
|
||||
return -1;
|
||||
if (putout(ScratchPad.sz) < 0)
|
||||
if (putout(LOCAL_ScratchPad.sz) < 0)
|
||||
return -1;
|
||||
if (putout(ScratchPad.msz) < 0)
|
||||
if (putout(LOCAL_ScratchPad.msz) < 0)
|
||||
return -1;
|
||||
if (mode == DO_EVERYTHING) {
|
||||
/* put the old trail base, just in case it moves again */
|
||||
@ -761,10 +761,10 @@ check_header(CELL *info, CELL *ATrail, CELL *AStack, CELL *AHeap USES_REGS)
|
||||
static int
|
||||
get_heap_info(USES_REGS1)
|
||||
{
|
||||
OldHeapBase = (ADDR) get_cellptr();
|
||||
LOCAL_OldHeapBase = (ADDR) get_cellptr();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
OldHeapTop = (ADDR) get_cellptr();
|
||||
LOCAL_OldHeapTop = (ADDR) get_cellptr();
|
||||
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
@ -783,16 +783,16 @@ get_heap_info(USES_REGS1)
|
||||
AuxTop = (ADDR)get_cellptr();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
ScratchPad.ptr = (ADDR)get_cellptr();
|
||||
LOCAL_ScratchPad.ptr = (ADDR)get_cellptr();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
ScratchPad.sz = get_cell();
|
||||
LOCAL_ScratchPad.sz = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
ScratchPad.msz = get_cell();
|
||||
LOCAL_ScratchPad.msz = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
HDiff = Unsigned(Yap_HeapBase) - Unsigned(OldHeapBase);
|
||||
LOCAL_HDiff = Unsigned(Yap_HeapBase) - Unsigned(LOCAL_OldHeapBase);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -871,7 +871,7 @@ get_regs(int flag USES_REGS)
|
||||
return -1;
|
||||
if (flag == DO_EVERYTHING) {
|
||||
#ifdef COROUTINING
|
||||
WokenGoals = get_cell();
|
||||
LOCAL_WokenGoals = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
#endif
|
||||
@ -880,13 +880,13 @@ get_regs(int flag USES_REGS)
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
#endif
|
||||
GcGeneration = get_cell();
|
||||
LOCAL_GcGeneration = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
GcPhase = get_cell();
|
||||
LOCAL_GcPhase = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
GcCurrentPhase = get_cell();
|
||||
LOCAL_GcCurrentPhase = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
}
|
||||
@ -897,7 +897,7 @@ get_regs(int flag USES_REGS)
|
||||
which_save = get_cell();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
XDiff = (CELL)XREGS - (CELL)OldXREGS;
|
||||
LOCAL_XDiff = (CELL)XREGS - (CELL)OldXREGS;
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
if (get_heap_info( PASS_REGS1 ) < 0)
|
||||
@ -912,19 +912,19 @@ get_regs(int flag USES_REGS)
|
||||
return -1;
|
||||
}
|
||||
/* get old trail base */
|
||||
OldTrailBase = (ADDR)get_cellptr();
|
||||
LOCAL_OldTrailBase = (ADDR)get_cellptr();
|
||||
if (Yap_ErrorMessage)
|
||||
return -1;
|
||||
/* Save the old register where we can easily access them */
|
||||
OldASP = ASP;
|
||||
OldLCL0 = LCL0;
|
||||
OldGlobalBase = (CELL *)Yap_GlobalBase;
|
||||
OldH = H;
|
||||
OldTR = TR;
|
||||
GDiff = Unsigned(NewGlobalBase) - Unsigned(Yap_GlobalBase);
|
||||
GDiff0 = 0;
|
||||
LDiff = Unsigned(NewLCL0) - Unsigned(LCL0);
|
||||
TrDiff = LDiff;
|
||||
LOCAL_OldASP = ASP;
|
||||
LOCAL_OldLCL0 = LCL0;
|
||||
LOCAL_OldGlobalBase = (CELL *)Yap_GlobalBase;
|
||||
LOCAL_OldH = H;
|
||||
LOCAL_OldTR = TR;
|
||||
LOCAL_GDiff = Unsigned(NewGlobalBase) - Unsigned(Yap_GlobalBase);
|
||||
LOCAL_GDiff0 = 0;
|
||||
LOCAL_LDiff = Unsigned(NewLCL0) - Unsigned(LCL0);
|
||||
LOCAL_TrDiff = LOCAL_LDiff;
|
||||
Yap_GlobalBase = (ADDR)NewGlobalBase;
|
||||
LCL0 = NewLCL0;
|
||||
}
|
||||
@ -949,7 +949,7 @@ get_hash(void)
|
||||
static int
|
||||
CopyCode( USES_REGS1 )
|
||||
{
|
||||
if (myread(splfild, (char *) Yap_HeapBase, (Unsigned(OldHeapTop) - Unsigned(OldHeapBase))) < 0) {
|
||||
if (myread(splfild, (char *) Yap_HeapBase, (Unsigned(LOCAL_OldHeapTop) - Unsigned(LOCAL_OldHeapBase))) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
@ -963,14 +963,14 @@ CopyStacks( USES_REGS1 )
|
||||
Int j;
|
||||
char *NewASP;
|
||||
|
||||
j = Unsigned(OldLCL0) - Unsigned(ASP);
|
||||
NewASP = (char *) (Unsigned(ASP) + (Unsigned(LCL0) - Unsigned(OldLCL0)));
|
||||
j = Unsigned(LOCAL_OldLCL0) - Unsigned(ASP);
|
||||
NewASP = (char *) (Unsigned(ASP) + (Unsigned(LCL0) - Unsigned(LOCAL_OldLCL0)));
|
||||
if (myread(splfild, (char *) NewASP, j) < 0)
|
||||
return -1;
|
||||
j = Unsigned(H) - Unsigned(OldGlobalBase);
|
||||
j = Unsigned(H) - Unsigned(LOCAL_OldGlobalBase);
|
||||
if (myread(splfild, (char *) Yap_GlobalBase, j) < 0)
|
||||
return -1;
|
||||
j = Unsigned(TR) - Unsigned(OldTrailBase);
|
||||
j = Unsigned(TR) - Unsigned(LOCAL_OldTrailBase);
|
||||
if (myread(splfild, Yap_TrailBase, j))
|
||||
return -1;
|
||||
return 1;
|
||||
@ -1061,7 +1061,7 @@ restore_regs(int flag USES_REGS)
|
||||
EX = DBTermAdjust(EX);
|
||||
RestoreDBTerm(EX, TRUE PASS_REGS);
|
||||
}
|
||||
WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(WokenGoals)));
|
||||
LOCAL_WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_WokenGoals)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1137,7 +1137,7 @@ rehash(CELL *oldcode, int NOfE, int KindOfEntries USES_REGS)
|
||||
CELL WorkTerm, failplace = 0;
|
||||
CELL *Base = oldcode;
|
||||
|
||||
if (HDiff == 0)
|
||||
if (LOCAL_HDiff == 0)
|
||||
return;
|
||||
basep = H;
|
||||
if (H + (NOfE*2) > ASP) {
|
||||
@ -1216,7 +1216,7 @@ RestoreFreeSpace( USES_REGS1 )
|
||||
Yap_av = (struct malloc_state *)AddrAdjust((ADDR)Yap_av);
|
||||
Yap_RestoreDLMalloc();
|
||||
if (AuxSp != NULL) {
|
||||
if (AuxBase < OldHeapBase || AuxBase > OldHeapTop) {
|
||||
if (AuxBase < LOCAL_OldHeapBase || AuxBase > LOCAL_OldHeapTop) {
|
||||
AuxSp = NULL;
|
||||
AuxBase = NULL;
|
||||
AuxTop = NULL;
|
||||
@ -1224,7 +1224,7 @@ RestoreFreeSpace( USES_REGS1 )
|
||||
AuxSp = PtoHeapCellAdjust(AuxSp);
|
||||
AuxBase = AddrAdjust(AuxBase);
|
||||
AuxTop = AddrAdjust(AuxTop);
|
||||
ScratchPad.ptr = AddrAdjust(ScratchPad.ptr);
|
||||
LOCAL_ScratchPad.ptr = AddrAdjust(LOCAL_ScratchPad.ptr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@ -1590,8 +1590,8 @@ check_opcodes(OPCODE old_ops[])
|
||||
static void
|
||||
RestoreHeap(OPCODE old_ops[] USES_REGS)
|
||||
{
|
||||
int heap_moved = (OldHeapBase != Yap_HeapBase ||
|
||||
XDiff), opcodes_moved;
|
||||
int heap_moved = (LOCAL_OldHeapBase != Yap_HeapBase ||
|
||||
LOCAL_XDiff), opcodes_moved;
|
||||
Term mod = CurrentModule;
|
||||
|
||||
CurrentModule = PROLOG_MODULE;
|
||||
@ -1740,10 +1740,10 @@ Restore(char *s, char *lib_dir USES_REGS)
|
||||
RestoreHeap(old_ops PASS_REGS);
|
||||
switch(restore_mode) {
|
||||
case DO_EVERYTHING:
|
||||
if (OldHeapBase != Yap_HeapBase ||
|
||||
OldLCL0 != LCL0 ||
|
||||
OldGlobalBase != (CELL *)Yap_GlobalBase ||
|
||||
OldTrailBase != Yap_TrailBase) {
|
||||
if (LOCAL_OldHeapBase != Yap_HeapBase ||
|
||||
LOCAL_OldLCL0 != LCL0 ||
|
||||
LOCAL_OldGlobalBase != (CELL *)Yap_GlobalBase ||
|
||||
LOCAL_OldTrailBase != Yap_TrailBase) {
|
||||
Yap_AdjustStacksAndTrail();
|
||||
if (which_save == 2) {
|
||||
Yap_AdjustRegs(2);
|
||||
|
36
C/scanner.c
36
C/scanner.c
@ -173,16 +173,16 @@ AllocScannerMemory(unsigned int size)
|
||||
CACHE_REGS
|
||||
char *AuxSpScan;
|
||||
|
||||
AuxSpScan = ScannerStack;
|
||||
AuxSpScan = LOCAL_ScannerStack;
|
||||
size = AdjustSize(size);
|
||||
if (ScannerExtraBlocks) {
|
||||
if (LOCAL_ScannerExtraBlocks) {
|
||||
struct scanner_extra_alloc *ptr;
|
||||
|
||||
if (!(ptr = (struct scanner_extra_alloc *)malloc(size+sizeof(ScannerExtraBlock)))) {
|
||||
return NULL;
|
||||
}
|
||||
ptr->next = ScannerExtraBlocks;
|
||||
ScannerExtraBlocks = ptr;
|
||||
ptr->next = LOCAL_ScannerExtraBlocks;
|
||||
LOCAL_ScannerExtraBlocks = ptr;
|
||||
return (char *)(ptr+1);
|
||||
} else if (Yap_TrailTop <= AuxSpScan+size) {
|
||||
UInt alloc_size = sizeof(CELL) * K16;
|
||||
@ -195,12 +195,12 @@ AllocScannerMemory(unsigned int size)
|
||||
if (!(ptr = (struct scanner_extra_alloc *)malloc(size+sizeof(ScannerExtraBlock)))) {
|
||||
return NULL;
|
||||
}
|
||||
ptr->next = ScannerExtraBlocks;
|
||||
ScannerExtraBlocks = ptr;
|
||||
ptr->next = LOCAL_ScannerExtraBlocks;
|
||||
LOCAL_ScannerExtraBlocks = ptr;
|
||||
return (char *)(ptr+1);
|
||||
}
|
||||
}
|
||||
ScannerStack = AuxSpScan+size;
|
||||
LOCAL_ScannerStack = AuxSpScan+size;
|
||||
return AuxSpScan;
|
||||
}
|
||||
|
||||
@ -208,12 +208,12 @@ static void
|
||||
PopScannerMemory(char *block, unsigned int size)
|
||||
{
|
||||
CACHE_REGS
|
||||
if (block == ScannerStack-size) {
|
||||
ScannerStack -= size;
|
||||
} else if (block == (char *)(ScannerExtraBlocks+1)) {
|
||||
struct scanner_extra_alloc *ptr = ScannerExtraBlocks;
|
||||
if (block == LOCAL_ScannerStack-size) {
|
||||
LOCAL_ScannerStack -= size;
|
||||
} else if (block == (char *)(LOCAL_ScannerExtraBlocks+1)) {
|
||||
struct scanner_extra_alloc *ptr = LOCAL_ScannerExtraBlocks;
|
||||
|
||||
ScannerExtraBlocks = ptr->next;
|
||||
LOCAL_ScannerExtraBlocks = ptr->next;
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
@ -728,8 +728,8 @@ Yap_scan_num(IOSTREAM *inp)
|
||||
char *ptr;
|
||||
|
||||
Yap_ErrorMessage = NULL;
|
||||
ScannerStack = (char *)TR;
|
||||
ScannerExtraBlocks = NULL;
|
||||
LOCAL_ScannerStack = (char *)TR;
|
||||
LOCAL_ScannerExtraBlocks = NULL;
|
||||
if (!(ptr = AllocScannerMemory(4096))) {
|
||||
Yap_ErrorMessage = "Trail Overflow";
|
||||
Yap_Error_TYPE = OUT_OF_TRAIL_ERROR;
|
||||
@ -805,8 +805,8 @@ Yap_tokenizer(IOSTREAM *inp_stream, Term *tposp)
|
||||
Yap_VarTable = NULL;
|
||||
Yap_AnonVarTable = NULL;
|
||||
Yap_eot_before_eof = FALSE;
|
||||
ScannerStack = (char *)TR;
|
||||
ScannerExtraBlocks = NULL;
|
||||
LOCAL_ScannerStack = (char *)TR;
|
||||
LOCAL_ScannerExtraBlocks = NULL;
|
||||
l = NULL;
|
||||
p = NULL; /* Just to make lint happy */
|
||||
ch = getchr(inp_stream);
|
||||
@ -814,7 +814,7 @@ Yap_tokenizer(IOSTREAM *inp_stream, Term *tposp)
|
||||
ch = getchr(inp_stream);
|
||||
}
|
||||
*tposp = Yap_StreamPosition(inp_stream);
|
||||
StartLine = inp_stream->posbuf.lineno;
|
||||
LOCAL_StartLine = inp_stream->posbuf.lineno;
|
||||
do {
|
||||
wchar_t och;
|
||||
int quote, isvar;
|
||||
@ -1280,7 +1280,7 @@ void
|
||||
Yap_clean_tokenizer(TokEntry *tokstart, VarEntry *vartable, VarEntry *anonvartable)
|
||||
{
|
||||
CACHE_REGS
|
||||
struct scanner_extra_alloc *ptr = ScannerExtraBlocks;
|
||||
struct scanner_extra_alloc *ptr = LOCAL_ScannerExtraBlocks;
|
||||
while (ptr) {
|
||||
struct scanner_extra_alloc *next = ptr->next;
|
||||
free(ptr);
|
||||
|
68
C/stdpreds.c
68
C/stdpreds.c
@ -477,22 +477,22 @@ p_values( USES_REGS1 )
|
||||
inline static void
|
||||
do_signal(yap_signals sig USES_REGS)
|
||||
{
|
||||
LOCK(SignalLock);
|
||||
if (!Yap_InterruptsDisabled)
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (!LOCAL_InterruptsDisabled)
|
||||
CreepFlag = Unsigned(LCL0);
|
||||
ActiveSignals |= sig;
|
||||
UNLOCK(SignalLock);
|
||||
LOCAL_ActiveSignals |= sig;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
}
|
||||
|
||||
inline static void
|
||||
undo_signal(yap_signals sig USES_REGS)
|
||||
{
|
||||
LOCK(SignalLock);
|
||||
if (ActiveSignals == sig) {
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LOCAL_ActiveSignals == sig) {
|
||||
CreepFlag = CalculateStackGap();
|
||||
}
|
||||
ActiveSignals &= ~sig;
|
||||
UNLOCK(SignalLock);
|
||||
LOCAL_ActiveSignals &= ~sig;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
}
|
||||
|
||||
|
||||
@ -518,24 +518,24 @@ p_signal_creep( USES_REGS1 )
|
||||
at = AtomCreep;
|
||||
pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 1),0));
|
||||
CreepCode = pred;
|
||||
LOCK(SignalLock);
|
||||
ActiveSignals |= YAP_CREEP_SIGNAL;
|
||||
UNLOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
LOCAL_ActiveSignals |= YAP_CREEP_SIGNAL;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_disable_creep( USES_REGS1 )
|
||||
{
|
||||
LOCK(SignalLock);
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return TRUE;
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -543,14 +543,14 @@ p_disable_creep( USES_REGS1 )
|
||||
static Int
|
||||
p_disable_docreep( USES_REGS1 )
|
||||
{
|
||||
LOCK(SignalLock);
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (!ActiveSignals)
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals)
|
||||
CreepFlag = CalculateStackGap();
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
} else {
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -558,12 +558,12 @@ p_disable_docreep( USES_REGS1 )
|
||||
static Int
|
||||
p_stop_creep( USES_REGS1 )
|
||||
{
|
||||
LOCK(SignalLock);
|
||||
ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (!ActiveSignals) {
|
||||
LOCK(LOCAL_SignalLock);
|
||||
LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals) {
|
||||
CreepFlag = CalculateStackGap();
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -797,9 +797,9 @@ p_runtime( USES_REGS1 )
|
||||
now -= gc_time;
|
||||
ss_time = Yap_total_stack_shift_time();
|
||||
now -= ss_time;
|
||||
interval -= (gc_time-LastGcTime)+(ss_time-LastSSTime);
|
||||
LastGcTime = gc_time;
|
||||
LastSSTime = ss_time;
|
||||
interval -= (gc_time-LOCAL_LastGcTime)+(ss_time-LOCAL_LastSSTime);
|
||||
LOCAL_LastGcTime = gc_time;
|
||||
LOCAL_LastSSTime = ss_time;
|
||||
tnow = MkIntegerTerm(now);
|
||||
tinterval = MkIntegerTerm(interval);
|
||||
return( Yap_unify_constant(ARG1, tnow) &&
|
||||
@ -3927,18 +3927,18 @@ p_unlock_system( USES_REGS1 )
|
||||
static Int
|
||||
p_enterundefp( USES_REGS1 )
|
||||
{
|
||||
if (DoingUndefp) {
|
||||
if (LOCAL_DoingUndefp) {
|
||||
return FALSE;
|
||||
}
|
||||
DoingUndefp = TRUE;
|
||||
LOCAL_DoingUndefp = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_exitundefp( USES_REGS1 )
|
||||
{
|
||||
if (DoingUndefp) {
|
||||
DoingUndefp = FALSE;
|
||||
if (LOCAL_DoingUndefp) {
|
||||
LOCAL_DoingUndefp = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
166
C/sysbits.c
166
C/sysbits.c
@ -1671,7 +1671,7 @@ HandleSIGINT (int sig)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (Yap_InterruptsDisabled) {
|
||||
if (LOCAL_InterruptsDisabled) {
|
||||
return;
|
||||
}
|
||||
if (Yap_PrologMode & (CritMode|ConsoleGetcMode)) {
|
||||
@ -1786,7 +1786,7 @@ ReceiveSignal (int s)
|
||||
#if (_MSC_VER || defined(__MINGW32__))
|
||||
static BOOL WINAPI
|
||||
MSCHandleSignal(DWORD dwCtrlType) {
|
||||
if (Yap_InterruptsDisabled) {
|
||||
if (LOCAL_InterruptsDisabled) {
|
||||
return FALSE;
|
||||
}
|
||||
switch(dwCtrlType) {
|
||||
@ -2478,14 +2478,14 @@ p_alarm( USES_REGS1 )
|
||||
i1 = IntegerOfTerm(t);
|
||||
i2 = IntegerOfTerm(t2);
|
||||
if (i1 == 0 && i2 == 0) {
|
||||
LOCK(SignalLock);
|
||||
if (ActiveSignals & YAP_ALARM_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_ALARM_SIGNAL;
|
||||
if (!ActiveSignals) {
|
||||
LOCK(LOCAL_SignalLock);
|
||||
if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_ALARM_SIGNAL;
|
||||
if (!LOCAL_ActiveSignals) {
|
||||
CreepFlag = CalculateStackGap();
|
||||
}
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
}
|
||||
#if _MSC_VER || defined(__MINGW32__)
|
||||
{
|
||||
@ -2758,146 +2758,146 @@ Yap_ReInitWallTime (void)
|
||||
static Int
|
||||
p_first_signal( USES_REGS1 )
|
||||
{
|
||||
LOCK(SignalLock);
|
||||
LOCK(LOCAL_SignalLock);
|
||||
#ifdef THREADS
|
||||
pthread_mutex_lock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
/* always do wakeups first, because you don't want to keep the
|
||||
non-backtrackable variable bad */
|
||||
if (ActiveSignals & YAP_WAKEUP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_WAKEUP_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_WAKEUP_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_WAKEUP_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigWakeUp));
|
||||
}
|
||||
if (ActiveSignals & YAP_ITI_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_ITI_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_ITI_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_ITI_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigIti));
|
||||
}
|
||||
if (ActiveSignals & YAP_INT_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_INT_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_INT_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_INT_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigInt));
|
||||
}
|
||||
if (ActiveSignals & YAP_USR2_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_USR2_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_USR2_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_USR2_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigUsr2));
|
||||
}
|
||||
if (ActiveSignals & YAP_USR1_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_USR1_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_USR1_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_USR1_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigUsr1));
|
||||
}
|
||||
if (ActiveSignals & YAP_PIPE_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_PIPE_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_PIPE_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_PIPE_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigPipe));
|
||||
}
|
||||
if (ActiveSignals & YAP_HUP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_HUP_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_HUP_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_HUP_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigHup));
|
||||
}
|
||||
if (ActiveSignals & YAP_ALARM_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_ALARM_SIGNAL;
|
||||
UNLOCK(SignalLock);
|
||||
if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_ALARM_SIGNAL;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigAlarm));
|
||||
}
|
||||
if (ActiveSignals & YAP_VTALARM_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_VTALARM_SIGNAL;
|
||||
UNLOCK(SignalLock);
|
||||
if (LOCAL_ActiveSignals & YAP_VTALARM_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_VTALARM_SIGNAL;
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigVTAlarm));
|
||||
}
|
||||
if (ActiveSignals & YAP_DELAY_CREEP_SIGNAL) {
|
||||
ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
||||
if (LOCAL_ActiveSignals & YAP_DELAY_CREEP_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigDelayCreep));
|
||||
}
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigCreep));
|
||||
}
|
||||
if (ActiveSignals & YAP_TRACE_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_TRACE_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_TRACE_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_TRACE_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigTrace));
|
||||
}
|
||||
if (ActiveSignals & YAP_DEBUG_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_DEBUG_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_DEBUG_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_DEBUG_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigDebug));
|
||||
}
|
||||
if (ActiveSignals & YAP_BREAK_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_BREAK_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_BREAK_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_BREAK_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigBreak));
|
||||
}
|
||||
if (ActiveSignals & YAP_STACK_DUMP_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_STACK_DUMP_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_STACK_DUMP_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_STACK_DUMP_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigStackDump));
|
||||
}
|
||||
if (ActiveSignals & YAP_STATISTICS_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_STATISTICS_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_STATISTICS_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_STATISTICS_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomSigStatistics));
|
||||
}
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return Yap_unify(ARG1, MkAtomTerm(AtomFail));
|
||||
}
|
||||
#ifdef THREADS
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
#endif
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -2905,49 +2905,49 @@ static Int
|
||||
p_continue_signals( USES_REGS1 )
|
||||
{
|
||||
/* hack to force the signal anew */
|
||||
if (ActiveSignals & YAP_ITI_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_ITI_SIGNAL) {
|
||||
Yap_signal(YAP_ITI_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_INT_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_INT_SIGNAL) {
|
||||
Yap_signal(YAP_INT_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_USR2_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_USR2_SIGNAL) {
|
||||
Yap_signal(YAP_USR2_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_USR1_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_USR1_SIGNAL) {
|
||||
Yap_signal(YAP_USR1_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_HUP_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_HUP_SIGNAL) {
|
||||
Yap_signal(YAP_HUP_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_ALARM_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) {
|
||||
Yap_signal(YAP_ALARM_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_VTALARM_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_VTALARM_SIGNAL) {
|
||||
Yap_signal(YAP_VTALARM_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
|
||||
Yap_signal(YAP_CREEP_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_DELAY_CREEP_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_DELAY_CREEP_SIGNAL) {
|
||||
Yap_signal(YAP_DELAY_CREEP_SIGNAL|YAP_CREEP_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_TRACE_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_TRACE_SIGNAL) {
|
||||
Yap_signal(YAP_TRACE_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_DEBUG_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_DEBUG_SIGNAL) {
|
||||
Yap_signal(YAP_DEBUG_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_BREAK_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_BREAK_SIGNAL) {
|
||||
Yap_signal(YAP_BREAK_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_STACK_DUMP_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_STACK_DUMP_SIGNAL) {
|
||||
Yap_signal(YAP_STACK_DUMP_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_STATISTICS_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_STATISTICS_SIGNAL) {
|
||||
Yap_signal(YAP_STATISTICS_SIGNAL);
|
||||
}
|
||||
if (ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
|
||||
Yap_signal(YAP_FAIL_SIGNAL);
|
||||
}
|
||||
#ifdef THREADS
|
||||
@ -2992,24 +2992,24 @@ p_win32( USES_REGS1 )
|
||||
static Int
|
||||
p_enable_interrupts( USES_REGS1 )
|
||||
{
|
||||
LOCK(SignalLock);
|
||||
Yap_InterruptsDisabled--;
|
||||
if (ActiveSignals && !Yap_InterruptsDisabled) {
|
||||
LOCK(LOCAL_SignalLock);
|
||||
LOCAL_InterruptsDisabled--;
|
||||
if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) {
|
||||
CreepFlag = Unsigned(LCL0);
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Int
|
||||
p_disable_interrupts( USES_REGS1 )
|
||||
{
|
||||
LOCK(SignalLock);
|
||||
Yap_InterruptsDisabled++;
|
||||
if (ActiveSignals) {
|
||||
LOCK(LOCAL_SignalLock);
|
||||
LOCAL_InterruptsDisabled++;
|
||||
if (LOCAL_ActiveSignals) {
|
||||
CreepFlag = CalculateStackGap();
|
||||
}
|
||||
UNLOCK(SignalLock);
|
||||
UNLOCK(LOCAL_SignalLock);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
12
C/threads.c
12
C/threads.c
@ -92,9 +92,9 @@ store_specs(int new_worker_id, UInt ssize, UInt tsize, UInt sysize, Term *tpgoal
|
||||
FOREIGN_ThreadHandle(new_worker_id).ssize = ssize;
|
||||
FOREIGN_ThreadHandle(new_worker_id).tsize = tsize;
|
||||
FOREIGN_ThreadHandle(new_worker_id).sysize = sysize;
|
||||
FOREIGN(new_worker_id)->c_input_stream = Yap_c_input_stream;
|
||||
FOREIGN(new_worker_id)->c_output_stream = Yap_c_output_stream;
|
||||
FOREIGN(new_worker_id)->c_error_stream = Yap_c_error_stream;
|
||||
FOREIGN(new_worker_id)->c_input_stream = LOCAL_c_input_stream;
|
||||
FOREIGN(new_worker_id)->c_output_stream = LOCAL_c_output_stream;
|
||||
FOREIGN(new_worker_id)->c_error_stream = LOCAL_c_error_stream;
|
||||
pm = (ssize + tsize)*1024;
|
||||
if (!(FOREIGN_ThreadHandle(new_worker_id).stack_address = malloc(pm))) {
|
||||
return FALSE;
|
||||
@ -124,10 +124,10 @@ kill_thread_engine (int wid, int always_die)
|
||||
{
|
||||
CACHE_REGS
|
||||
Prop p0 = AbsPredProp(FOREIGN_ThreadHandle(wid).local_preds);
|
||||
GlobalEntry *gl = GlobalVariables;
|
||||
GlobalEntry *gl = LOCAL_GlobalVariables;
|
||||
|
||||
FOREIGN_ThreadHandle(wid).local_preds = NIL;
|
||||
GlobalVariables = NULL;
|
||||
LOCAL_GlobalVariables = NULL;
|
||||
/* kill all thread local preds */
|
||||
while(p0) {
|
||||
PredEntry *ap = RepPredProp(p0);
|
||||
@ -349,7 +349,7 @@ p_thread_zombie_self( USES_REGS1 )
|
||||
return Yap_unify(MkIntegerTerm(-1), ARG1);
|
||||
DEBUG_TLOCK_ACCESS(4, worker_id);
|
||||
pthread_mutex_lock(&(MY_ThreadHandle.tlock));
|
||||
if (ActiveSignals &= YAP_ITI_SIGNAL) {
|
||||
if (LOCAL_ActiveSignals &= YAP_ITI_SIGNAL) {
|
||||
DEBUG_TLOCK_ACCESS(5, worker_id);
|
||||
pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
|
||||
return FALSE;
|
||||
|
@ -396,12 +396,12 @@ static Int p_start_low_level_trace( USES_REGS1 )
|
||||
|
||||
static Int p_total_choicepoints( USES_REGS1 )
|
||||
{
|
||||
return Yap_unify(MkIntegerTerm(Yap_total_choicepoints),ARG1);
|
||||
return Yap_unify(MkIntegerTerm(LOCAL_total_choicepoints),ARG1);
|
||||
}
|
||||
|
||||
static Int p_reset_total_choicepoints( USES_REGS1 )
|
||||
{
|
||||
Yap_total_choicepoints = 0;
|
||||
LOCAL_total_choicepoints = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ STATIC_PROTO(wtype AtomIsSymbols, (unsigned char *));
|
||||
STATIC_PROTO(void putAtom, (Atom, int, wrf));
|
||||
STATIC_PROTO(void writeTerm, (Term, int, int, int, struct write_globs *, struct rewind_term *));
|
||||
|
||||
#define wrputc(X,WF) ((*WF)(Yap_c_output_stream,X)) /* writes a character */
|
||||
#define wrputc(X,WF) ((*WF)(LOCAL_c_output_stream,X)) /* writes a character */
|
||||
|
||||
static void
|
||||
wrputn(Int n, wrf writewch) /* writes an integer */
|
||||
|
@ -734,7 +734,7 @@ Macros to check the limits of stacks
|
||||
ENDP(pt0)
|
||||
|
||||
#if LOW_LEVEL_TRACER
|
||||
#define COUNT_CPS() Yap_total_choicepoints++
|
||||
#define COUNT_CPS() LOCAL_total_choicepoints++
|
||||
#else
|
||||
#define COUNT_CPS()
|
||||
#endif
|
||||
|
216
H/dlocals.h
216
H/dlocals.h
@ -5,137 +5,131 @@
|
||||
|
||||
|
||||
|
||||
#define Yap_c_input_stream WL->c_input_stream
|
||||
#define Yap_c_output_stream WL->c_output_stream
|
||||
#define Yap_c_error_stream WL->c_error_stream
|
||||
#define LOCAL_c_input_stream WL->c_input_stream
|
||||
#define LOCAL_c_output_stream WL->c_output_stream
|
||||
#define LOCAL_c_error_stream WL->c_error_stream
|
||||
|
||||
#define OldASP WL->rinfo.old_ASP
|
||||
#define OldLCL0 WL->rinfo.old_LCL0
|
||||
#define OldTR WL->rinfo.old_TR
|
||||
#define OldGlobalBase WL->rinfo.old_GlobalBase
|
||||
#define OldH WL->rinfo.old_H
|
||||
#define OldH0 WL->rinfo.old_H0
|
||||
#define OldTrailBase WL->rinfo.old_TrailBase
|
||||
#define OldTrailTop WL->rinfo.old_TrailTop
|
||||
#define OldHeapBase WL->rinfo.old_HeapBase
|
||||
#define OldHeapTop WL->rinfo.old_HeapTop
|
||||
#define ClDiff WL->rinfo.cl_diff
|
||||
#define GDiff WL->rinfo.g_diff
|
||||
#define HDiff WL->rinfo.h_diff
|
||||
#define GDiff0 WL->rinfo.g_diff0
|
||||
#define GSplit WL->rinfo.g_split
|
||||
#define LDiff WL->rinfo.l_diff
|
||||
#define TrDiff WL->rinfo.tr_diff
|
||||
#define XDiff WL->rinfo.x_diff
|
||||
#define DelayDiff WL->rinfo.delay_diff
|
||||
#define BaseDiff WL->rinfo.base_diff
|
||||
#define ReductionsCounter WL->call_counters.reductions
|
||||
#define PredEntriesCounter WL->call_counters.reductions_retries
|
||||
#define RetriesCounter WL->call_counters.retries
|
||||
#define ReductionsCounterOn WL->call_counters.reductions_on
|
||||
#define PredEntriesCounterOn WL->call_counters.reductions_retries_on
|
||||
#define RetriesCounterOn WL->call_counters.retries_on
|
||||
#define Yap_InterruptsDisabled WL->interrupts_disabled
|
||||
#define LOCAL_OldASP WL->rinfo.old_ASP
|
||||
#define LOCAL_OldLCL0 WL->rinfo.old_LCL0
|
||||
#define LOCAL_OldTR WL->rinfo.old_TR
|
||||
#define LOCAL_OldGlobalBase WL->rinfo.old_GlobalBase
|
||||
#define LOCAL_OldH WL->rinfo.old_H
|
||||
#define LOCAL_OldH0 WL->rinfo.old_H0
|
||||
#define LOCAL_OldTrailBase WL->rinfo.old_TrailBase
|
||||
#define LOCAL_OldTrailTop WL->rinfo.old_TrailTop
|
||||
#define LOCAL_OldHeapBase WL->rinfo.old_HeapBase
|
||||
#define LOCAL_OldHeapTop WL->rinfo.old_HeapTop
|
||||
#define LOCAL_ClDiff WL->rinfo.cl_diff
|
||||
#define LOCAL_GDiff WL->rinfo.g_diff
|
||||
#define LOCAL_HDiff WL->rinfo.h_diff
|
||||
#define LOCAL_GDiff0 WL->rinfo.g_diff0
|
||||
#define LOCAL_GSplit WL->rinfo.g_split
|
||||
#define LOCAL_LDiff WL->rinfo.l_diff
|
||||
#define LOCAL_TrDiff WL->rinfo.tr_diff
|
||||
#define LOCAL_XDiff WL->rinfo.x_diff
|
||||
#define LOCAL_DelayDiff WL->rinfo.delay_diff
|
||||
#define LOCAL_BaseDiff WL->rinfo.base_diff
|
||||
#define LOCAL_ReductionsCounter WL->call_counters.reductions
|
||||
#define LOCAL_PredEntriesCounter WL->call_counters.reductions_retries
|
||||
#define LOCAL_RetriesCounter WL->call_counters.retries
|
||||
#define LOCAL_ReductionsCounterOn WL->call_counters.reductions_on
|
||||
#define LOCAL_PredEntriesCounterOn WL->call_counters.reductions_retries_on
|
||||
#define LOCAL_RetriesCounterOn WL->call_counters.retries_on
|
||||
#define LOCAL_InterruptsDisabled WL->interrupts_disabled
|
||||
|
||||
|
||||
#define ConsultSp WL->consultsp
|
||||
#define LOCAL_ConsultSp WL->consultsp
|
||||
|
||||
#define ConsultCapacity WL->consultcapacity
|
||||
#define LOCAL_ConsultCapacity WL->consultcapacity
|
||||
|
||||
#define ConsultBase WL->consultbase
|
||||
#define LOCAL_ConsultBase WL->consultbase
|
||||
|
||||
#define ConsultLow WL->consultlow
|
||||
#define LOCAL_ConsultLow WL->consultlow
|
||||
|
||||
#define GlobalArena WL->global_arena
|
||||
#define GlobalArenaOverflows WL->global_arena_overflows
|
||||
#define DelayArenaOverflows WL->delay_arena_overflows
|
||||
#define ArenaOverflows WL->arena_overflows
|
||||
#define DepthArenas WL->depth_arenas
|
||||
#define ArithError WL->arith_error
|
||||
#define LastAssertedPred WL->last_asserted_pred
|
||||
#define DebugOn WL->debug_on
|
||||
#define FormatInfo WL->f_info
|
||||
#define ScannerStack WL->scanner_stack
|
||||
#define ScannerExtraBlocks WL->scanner_extra_blocks
|
||||
#define BallTerm WL->ball_term
|
||||
#define ActiveSignals WL->active_signals
|
||||
#define IPredArity WL->i_pred_arity
|
||||
#define ProfEnd WL->prof_end
|
||||
#define UncaughtThrow WL->uncaught_throw
|
||||
#define DoingUndefp WL->doing_undefp
|
||||
#define StartLine WL->start_line
|
||||
#define ScratchPad WL->scratchpad
|
||||
#define LOCAL_GlobalArena WL->global_arena
|
||||
#define LOCAL_GlobalArenaOverflows WL->global_arena_overflows
|
||||
#define LOCAL_ArenaOverflows WL->arena_overflows
|
||||
#define LOCAL_DepthArenas WL->depth_arenas
|
||||
#define LOCAL_ArithError WL->arith_error
|
||||
#define LOCAL_LastAssertedPred WL->last_asserted_pred
|
||||
#define LOCAL_DebugOn WL->debug_on
|
||||
#define LOCAL_ScannerStack WL->scanner_stack
|
||||
#define LOCAL_ScannerExtraBlocks WL->scanner_extra_blocks
|
||||
#define LOCAL_BallTerm WL->ball_term
|
||||
#define LOCAL_ActiveSignals WL->active_signals
|
||||
#define LOCAL_IPredArity WL->i_pred_arity
|
||||
#define LOCAL_ProfEnd WL->prof_end
|
||||
#define LOCAL_UncaughtThrow WL->uncaught_throw
|
||||
#define LOCAL_DoingUndefp WL->doing_undefp
|
||||
#define LOCAL_StartLine WL->start_line
|
||||
#define LOCAL_ScratchPad WL->scratchpad
|
||||
#ifdef COROUTINING
|
||||
#define WokenGoals WL->woken_goals
|
||||
#define AttsMutableList WL->atts_mutable_list
|
||||
#define LOCAL_WokenGoals WL->woken_goals
|
||||
#define LOCAL_AttsMutableList WL->atts_mutable_list
|
||||
#endif
|
||||
|
||||
#define GcGeneration WL->gc_generation
|
||||
#define GcPhase WL->gc_phase
|
||||
#define GcCurrentPhase WL->gc_current_phase
|
||||
#define GcCalls WL->gc_calls
|
||||
#define TotGcTime WL->tot_gc_time
|
||||
#define TotGcRecovered WL->tot_gc_recovered
|
||||
#define LastGcTime WL->last_gc_time
|
||||
#define LastSSTime WL->last_ss_time
|
||||
#define LOCAL_GcGeneration WL->gc_generation
|
||||
#define LOCAL_GcPhase WL->gc_phase
|
||||
#define LOCAL_GcCurrentPhase WL->gc_current_phase
|
||||
#define LOCAL_GcCalls WL->gc_calls
|
||||
#define LOCAL_TotGcTime WL->tot_gc_time
|
||||
#define LOCAL_TotGcRecovered WL->tot_gc_recovered
|
||||
#define LOCAL_LastGcTime WL->last_gc_time
|
||||
#define LOCAL_LastSSTime WL->last_ss_time
|
||||
#if LOW_LEVEL_TRACER
|
||||
#define Yap_total_choicepoints WL->total_cps
|
||||
#define LOCAL_total_choicepoints WL->total_cps
|
||||
#endif
|
||||
#define consult_level WL->consult_level_
|
||||
|
||||
#define LOCAL_consult_level WL->consult_level_
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#define SignalLock WL->signal_lock
|
||||
#define WPP WL->wpp
|
||||
#define LOCAL_SignalLock WL->signal_lock
|
||||
#endif
|
||||
|
||||
#define total_marked WL->tot_marked
|
||||
#define total_oldies WL->tot_oldies
|
||||
#if DEBUG && COROUTINING
|
||||
#define total_smarked WL->tot_smarked
|
||||
#define LOCAL_total_marked WL->tot_marked
|
||||
#define LOCAL_total_oldies WL->tot_oldies
|
||||
#define LOCAL_current_B WL->wl_current_B
|
||||
#define LOCAL_prev_HB WL->wl_prev_HB
|
||||
#define LOCAL_HGEN WL->hgen
|
||||
#define LOCAL_iptop WL->ip_top
|
||||
|
||||
#if defined(GC_NO_TAGS)
|
||||
#define LOCAL_bp WL->b_p
|
||||
#endif
|
||||
#define current_B WL->wl_current_B
|
||||
#define prev_HB WL->wl_prev_HB
|
||||
#define HGEN WL->hgen
|
||||
#define iptop WL->ip_top
|
||||
#if GC_NO_TAGS
|
||||
#define Yap_bp WL->b_p
|
||||
#endif
|
||||
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||
#define sTR WL->wl_sTR
|
||||
#define sTR0 WL->wl_sTR0
|
||||
#define new_TR WL->new_tr
|
||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
||||
#define LOCAL_sTR WL->wl_sTR
|
||||
#define LOCAL_sTR0 WL->wl_sTR0
|
||||
#define LOCAL_new_TR WL->new_tr
|
||||
#else
|
||||
#define sTR WL->wl_sTR
|
||||
#define sTR0 WL->wl_sTR0
|
||||
#define new_TR WL->new_tr
|
||||
#endif
|
||||
#define cont_top0 WL->conttop0
|
||||
#define cont_top WL->conttop
|
||||
#define discard_trail_entries WL->disc_trail_entries
|
||||
#define gc_ma_hash_table WL->Gc_ma_hash_table
|
||||
#define gc_ma_h_top WL->Gc_ma_h_top
|
||||
#define gc_ma_h_list WL->Gc_ma_h_list
|
||||
#define gc_timestamp WL->Gc_timestamp
|
||||
#define db_vec WL->DB_vec
|
||||
#define db_vec0 WL->DB_vec0
|
||||
#define db_root WL->DB_root
|
||||
#define db_nil WL->DB_nil
|
||||
#endif /* defined(YAPOR) || defined(THREADS) */
|
||||
#define Yap_gc_restore WL->gc_restore
|
||||
#define DynamicArrays WL->dynamic_arrays
|
||||
#define StaticArrays WL->static_arrays
|
||||
#define GlobalVariables WL->global_variables
|
||||
#define Yap_AllowRestart WL->allow_restart
|
||||
#define LOCAL_sTR WL->wl_sTR
|
||||
#define LOCAL_sTR0 WL->wl_sTR0
|
||||
#define LOCAL_new_TR WL->new_tr
|
||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
||||
#define LOCAL_cont_top0 WL->conttop0
|
||||
#define LOCAL_cont_top WL->conttop
|
||||
#define LOCAL_discard_trail_entries WL->disc_trail_entries
|
||||
#define LOCAL_gc_ma_hash_table WL->Gc_ma_hash_table
|
||||
#define LOCAL_gc_ma_h_top WL->Gc_ma_h_top
|
||||
#define LOCAL_gc_ma_h_list WL->Gc_ma_h_list
|
||||
#define LOCAL_gc_timestamp WL->Gc_timestamp
|
||||
#define LOCAL_db_vec WL->DB_vec
|
||||
#define LOCAL_db_vec0 WL->DB_vec0
|
||||
#define LOCAL_db_root WL->DB_root
|
||||
#define LOCAL_db_nil WL->DB_nil
|
||||
#define LOCAL_gc_restore WL->gc_restore
|
||||
#define LOCAL_DynamicArrays WL->dynamic_arrays
|
||||
#define LOCAL_StaticArrays WL->static_arrays
|
||||
#define LOCAL_GlobalVariables WL->global_variables
|
||||
#define LOCAL_AllowRestart WL->allow_restart
|
||||
|
||||
#define Yap_CMemFirstBlock WL->cmem_first_block
|
||||
#define Yap_CMemFirstBlockSz WL->cmem_first_block_sz
|
||||
#define LOCAL_CMemFirstBlock WL->cmem_first_block
|
||||
#define LOCAL_CMemFirstBlockSz WL->cmem_first_block_sz
|
||||
|
||||
#define Yap_LabelFirstArray WL->label_first_array
|
||||
#define Yap_LabelFirstArraySz WL->label_first_array_sz
|
||||
#define LOCAL_LabelFirstArray WL->label_first_array
|
||||
#define LOCAL_LabelFirstArraySz WL->label_first_array_sz
|
||||
|
||||
#define PL_local_data_p WL->Yap_ld_
|
||||
#define execution WL->_execution
|
||||
#define LOCAL_PL_local_data_p WL->Yap_ld_
|
||||
#define LOCAL_execution WL->_execution
|
||||
#ifdef THREADS
|
||||
#define ThreadHandle WL->thread_handle
|
||||
#define LOCAL_ThreadHandle WL->thread_handle
|
||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
||||
#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle)
|
||||
#endif
|
||||
|
@ -77,14 +77,10 @@
|
||||
(CellPtr(B) < CellPtr(val) && CellPtr(val) <= \
|
||||
LCL0 && HEAP_PTR(val))))
|
||||
|
||||
#if !defined(YAPOR) && !defined(THREADS)
|
||||
extern char *Yap_bp;
|
||||
#endif
|
||||
|
||||
#define MARK_BIT ((char)1)
|
||||
#define RMARK_BIT ((char)2)
|
||||
|
||||
#define mcell(X) Yap_bp[(X)-(CELL *)Yap_GlobalBase]
|
||||
#define mcell(X) LOCAL_bp[(X)-(CELL *)Yap_GlobalBase]
|
||||
|
||||
#define MARKED_PTR(P) MARKED_PTR__(P PASS_REGS)
|
||||
#define UNMARKED_MARK(P, BP) UNMARKED_MARK__(P, BP PASS_REGS)
|
||||
|
30
H/hlocals.h
30
H/hlocals.h
@ -50,16 +50,14 @@ typedef struct worker_local {
|
||||
|
||||
Term global_arena;
|
||||
UInt global_arena_overflows;
|
||||
Int delay_arena_overflows;
|
||||
Int arena_overflows;
|
||||
Int depth_arenas;
|
||||
int arith_error;
|
||||
struct pred_entry* last_asserted_pred;
|
||||
int debug_on;
|
||||
struct format_status* f_info;
|
||||
char* scanner_stack;
|
||||
struct scanner_extra_alloc* scanner_extra_blocks;
|
||||
struct DB_TERM *ball_term;
|
||||
struct DB_TERM* ball_term;
|
||||
UInt active_signals;
|
||||
UInt i_pred_arity;
|
||||
yamop* prof_end;
|
||||
@ -84,32 +82,29 @@ typedef struct worker_local {
|
||||
Int total_cps;
|
||||
#endif
|
||||
int consult_level_;
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar signal_lock;
|
||||
struct pred_entry* wpp;
|
||||
#endif
|
||||
|
||||
Int tot_marked;
|
||||
Int tot_oldies;
|
||||
#if DEBUG && COROUTINING
|
||||
UInt tot_smarked;
|
||||
#endif
|
||||
struct choicept *wl_current_B;
|
||||
struct choicept* wl_current_B;
|
||||
CELL* wl_prev_HB;
|
||||
CELL* hgen;
|
||||
CELL** ip_top;
|
||||
#if GC_NO_TAGS
|
||||
|
||||
#if defined(GC_NO_TAGS)
|
||||
char* b_p;
|
||||
#endif
|
||||
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
||||
Term* wl_sTR;
|
||||
Term* wl_sTR0;
|
||||
Term* new_tr;
|
||||
#else
|
||||
struct trail_frame* wl_sTR;
|
||||
struct trail_frame* wl_sTR0;
|
||||
struct trail_frame* new_tr;
|
||||
#else
|
||||
Term *wl_sTR;
|
||||
Term *wl_sTR0;
|
||||
Term *new_tr;
|
||||
#endif
|
||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
||||
struct gc_mark_continuation* conttop0;
|
||||
struct gc_mark_continuation* conttop;
|
||||
int disc_trail_entries;
|
||||
@ -121,7 +116,6 @@ typedef struct worker_local {
|
||||
ADDR DB_vec0;
|
||||
struct RB_red_blk_node* DB_root;
|
||||
struct RB_red_blk_node* DB_nil;
|
||||
#endif /* defined(YAPOR) || defined(THREADS) */
|
||||
sigjmp_buf gc_restore;
|
||||
struct array_entry* dynamic_arrays;
|
||||
struct static_array_entry* static_arrays;
|
||||
@ -134,7 +128,7 @@ typedef struct worker_local {
|
||||
Int* label_first_array;
|
||||
UInt label_first_array_sz;
|
||||
|
||||
struct PL_local_data *Yap_ld_;
|
||||
struct PL_local_data* Yap_ld_;
|
||||
struct open_query_struct* _execution;
|
||||
#ifdef THREADS
|
||||
struct thandle thread_handle;
|
||||
|
34
H/iglobals.h
34
H/iglobals.h
@ -24,30 +24,30 @@ static void InitGlobal(void) {
|
||||
|
||||
#if THREADS
|
||||
|
||||
Yap_global->n_of_threads = 1;
|
||||
Yap_NOfThreads = 1;
|
||||
|
||||
Yap_global->n_of_threads_created = 1;
|
||||
Yap_NOfThreadsCreated = 1;
|
||||
|
||||
Yap_global->threads_total_time = 0L;
|
||||
Yap_ThreadsTotalTime = 0L;
|
||||
#endif
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
|
||||
INIT_LOCK(Yap_global->bgl);
|
||||
INIT_LOCK(Yap_BGL);
|
||||
#endif
|
||||
|
||||
Yap_global->allow_local_expansion = TRUE;
|
||||
Yap_global->allow_global_expansion = TRUE;
|
||||
Yap_global->allow_trail_expansion = TRUE;
|
||||
Yap_global->size_of_overflow = 0;
|
||||
Yap_AllowLocalExpansion = TRUE;
|
||||
Yap_AllowGlobalExpansion = TRUE;
|
||||
Yap_AllowTrailExpansion = TRUE;
|
||||
Yap_SizeOfOverflow = 0;
|
||||
|
||||
Yap_global->agc_last_call = 0;
|
||||
Yap_AGcLastCall = 0;
|
||||
|
||||
Yap_global->agc_threshold = 10000;
|
||||
Yap_global->agc_hook = NULL;
|
||||
Yap_AGcThreshold = 10000;
|
||||
Yap_AGCHook = NULL;
|
||||
|
||||
#ifdef THREADS
|
||||
INIT_LOCK(Yap_global->thread_handles_lock);
|
||||
INIT_LOCK(Yap_ThreadHandlesLock);
|
||||
#endif
|
||||
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
@ -55,10 +55,10 @@ static void InitGlobal(void) {
|
||||
|
||||
#endif
|
||||
|
||||
Yap_global->initialised = FALSE;
|
||||
Yap_global->initialised_from_pl = FALSE;
|
||||
Yap_global->pl_argc = 0;
|
||||
Yap_global->pl_argv = NULL;
|
||||
Yap_Initialised = FALSE;
|
||||
Yap_InitialisedFromPL = FALSE;
|
||||
Yap_PL_Argc = 0;
|
||||
Yap_PL_Argv = NULL;
|
||||
|
||||
Yap_global->yap_halt_hook = NULL;
|
||||
Yap_HaltHooks = NULL;
|
||||
}
|
||||
|
272
H/ihstruct.h
272
H/ihstruct.h
@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(Yap_heap_regs->dlmalloc_lock);
|
||||
INIT_LOCK(DLMallocLock);
|
||||
#endif
|
||||
#endif
|
||||
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
||||
@ -51,10 +51,10 @@
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(Yap_heap_regs->free_blocks_lock);
|
||||
INIT_LOCK(Yap_heap_regs->heap_used_lock);
|
||||
INIT_LOCK(Yap_heap_regs->heap_top_lock);
|
||||
Yap_heap_regs->heap_top_owner = -1;
|
||||
INIT_LOCK(FreeBlocksLock);
|
||||
INIT_LOCK(HeapUsedLock);
|
||||
INIT_LOCK(HeapTopLock);
|
||||
HeapTopOwner = -1;
|
||||
#endif
|
||||
|
||||
|
||||
@ -62,13 +62,13 @@
|
||||
|
||||
#endif
|
||||
|
||||
Yap_heap_regs->execute_cpred_op_code = Yap_opcode(_execute_cpred);
|
||||
Yap_heap_regs->expand_op_code = Yap_opcode(_expand_index);
|
||||
Yap_heap_regs->fail_op = Yap_opcode(_op_fail);
|
||||
Yap_heap_regs->index_op = Yap_opcode(_index_pred);
|
||||
Yap_heap_regs->lockpred_op = Yap_opcode(_lock_pred);
|
||||
Yap_heap_regs->orlast_op = Yap_opcode(_or_last);
|
||||
Yap_heap_regs->undef_op = Yap_opcode(_undef_p);
|
||||
EXECUTE_CPRED_OP_CODE = Yap_opcode(_execute_cpred);
|
||||
EXPAND_OP_CODE = Yap_opcode(_expand_index);
|
||||
FAIL_OPCODE = Yap_opcode(_op_fail);
|
||||
INDEX_OPCODE = Yap_opcode(_index_pred);
|
||||
LOCKPRED_OPCODE = Yap_opcode(_lock_pred);
|
||||
ORLAST_OPCODE = Yap_opcode(_or_last);
|
||||
UNDEF_OPCODE = Yap_opcode(_undef_p);
|
||||
|
||||
|
||||
|
||||
@ -80,100 +80,100 @@
|
||||
|
||||
#include "iatoms.h"
|
||||
#ifdef EUROTRA
|
||||
Yap_heap_regs->term_dollar_u = MkAtomTerm(AtomDollarU);
|
||||
TermDollarU = MkAtomTerm(AtomDollarU);
|
||||
#endif
|
||||
Yap_heap_regs->term_prolog = MkAtomTerm(AtomProlog);
|
||||
Yap_heap_regs->term_refound_var = MkAtomTerm(AtomRefoundVar);
|
||||
Yap_heap_regs->user_module = MkAtomTerm(AtomUser);
|
||||
Yap_heap_regs->idb_module = MkAtomTerm(AtomIDB);
|
||||
Yap_heap_regs->attributes_module = MkAtomTerm(AtomAttributes);
|
||||
Yap_heap_regs->charsio_module = MkAtomTerm(AtomCharsio);
|
||||
Yap_heap_regs->terms_module = MkAtomTerm(AtomTerms);
|
||||
Yap_heap_regs->system_module = MkAtomTerm(AtomSystem);
|
||||
Yap_heap_regs->operating_system_module = MkAtomTerm(AtomOperatingSystemSupport);
|
||||
Yap_heap_regs->readutil_module = MkAtomTerm(AtomReadutil);
|
||||
Yap_heap_regs->hacks_module = MkAtomTerm(AtomYapHacks);
|
||||
Yap_heap_regs->arg_module = MkAtomTerm(AtomArg);
|
||||
Yap_heap_regs->globals_module = MkAtomTerm(AtomNb);
|
||||
Yap_heap_regs->swi_module = MkAtomTerm(AtomSwi);
|
||||
Yap_heap_regs->dbload_module = MkAtomTerm(AtomDBLoad);
|
||||
TermProlog = MkAtomTerm(AtomProlog);
|
||||
TermReFoundVar = MkAtomTerm(AtomRefoundVar);
|
||||
USER_MODULE = MkAtomTerm(AtomUser);
|
||||
IDB_MODULE = MkAtomTerm(AtomIDB);
|
||||
ATTRIBUTES_MODULE = MkAtomTerm(AtomAttributes);
|
||||
CHARSIO_MODULE = MkAtomTerm(AtomCharsio);
|
||||
TERMS_MODULE = MkAtomTerm(AtomTerms);
|
||||
SYSTEM_MODULE = MkAtomTerm(AtomSystem);
|
||||
OPERATING_SYSTEM_MODULE = MkAtomTerm(AtomOperatingSystemSupport);
|
||||
READUTIL_MODULE = MkAtomTerm(AtomReadutil);
|
||||
HACKS_MODULE = MkAtomTerm(AtomYapHacks);
|
||||
ARG_MODULE = MkAtomTerm(AtomArg);
|
||||
GLOBALS_MODULE = MkAtomTerm(AtomNb);
|
||||
SWI_MODULE = MkAtomTerm(AtomSwi);
|
||||
DBLOAD_MODULE = MkAtomTerm(AtomDBLoad);
|
||||
|
||||
|
||||
|
||||
Yap_heap_regs->current_modules = NULL;
|
||||
CurrentModules = NULL;
|
||||
|
||||
|
||||
Yap_InitModules();
|
||||
|
||||
Yap_heap_regs->execution_mode = INTERPRETED;
|
||||
Yap_ExecutionMode = INTERPRETED;
|
||||
|
||||
InitPredHash();
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
|
||||
#endif
|
||||
Yap_heap_regs->preds_in_hash_table = 0;
|
||||
PredsInHashTable = 0;
|
||||
|
||||
|
||||
Yap_heap_regs->creep_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomCreep,1),PROLOG_MODULE));
|
||||
Yap_heap_regs->undef_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomUndefp,1),PROLOG_MODULE));
|
||||
Yap_heap_regs->spy_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomSpy,1),PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_fail = RepPredProp(PredPropByAtom(AtomFail,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_true = RepPredProp(PredPropByAtom(AtomTrue,PROLOG_MODULE));
|
||||
CreepCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomCreep,1),PROLOG_MODULE));
|
||||
UndefCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomUndefp,1),PROLOG_MODULE));
|
||||
SpyCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomSpy,1),PROLOG_MODULE));
|
||||
PredFail = RepPredProp(PredPropByAtom(AtomFail,PROLOG_MODULE));
|
||||
PredTrue = RepPredProp(PredPropByAtom(AtomTrue,PROLOG_MODULE));
|
||||
#ifdef COROUTINING
|
||||
Yap_heap_regs->wake_up_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomWakeUpGoal,2),PROLOG_MODULE));
|
||||
WakeUpCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomWakeUpGoal,2),PROLOG_MODULE));
|
||||
#endif
|
||||
Yap_heap_regs->pred_goal_expansion = RepPredProp(PredPropByFunc(FunctorGoalExpansion,USER_MODULE));
|
||||
Yap_heap_regs->pred_meta_call = RepPredProp(PredPropByFunc(FunctorMetaCall,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_dollar_catch = RepPredProp(PredPropByFunc(FunctorCatch,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_recorded_with_key = RepPredProp(PredPropByFunc(FunctorRecordedWithKey,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_log_upd_clause = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_log_upd_clause_erase = RepPredProp(PredPropByFunc(FunctorDoLogUpdClauseErase,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_log_upd_clause0 = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_static_clause = RepPredProp(PredPropByFunc(FunctorDoStaticClause,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_throw = RepPredProp(PredPropByFunc(FunctorThrow,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_handle_throw = RepPredProp(PredPropByFunc(FunctorHandleThrow,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_is = RepPredProp(PredPropByFunc(FunctorIs,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_safe_call_cleanup = RepPredProp(PredPropByFunc(FunctorSafeCallCleanup,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_restore_regs = RepPredProp(PredPropByFunc(FunctorRestoreRegs,PROLOG_MODULE));
|
||||
PredGoalExpansion = RepPredProp(PredPropByFunc(FunctorGoalExpansion,USER_MODULE));
|
||||
PredMetaCall = RepPredProp(PredPropByFunc(FunctorMetaCall,PROLOG_MODULE));
|
||||
PredDollarCatch = RepPredProp(PredPropByFunc(FunctorCatch,PROLOG_MODULE));
|
||||
PredRecordedWithKey = RepPredProp(PredPropByFunc(FunctorRecordedWithKey,PROLOG_MODULE));
|
||||
PredLogUpdClause = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE));
|
||||
PredLogUpdClauseErase = RepPredProp(PredPropByFunc(FunctorDoLogUpdClauseErase,PROLOG_MODULE));
|
||||
PredLogUpdClause0 = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE));
|
||||
PredStaticClause = RepPredProp(PredPropByFunc(FunctorDoStaticClause,PROLOG_MODULE));
|
||||
PredThrow = RepPredProp(PredPropByFunc(FunctorThrow,PROLOG_MODULE));
|
||||
PredHandleThrow = RepPredProp(PredPropByFunc(FunctorHandleThrow,PROLOG_MODULE));
|
||||
PredIs = RepPredProp(PredPropByFunc(FunctorIs,PROLOG_MODULE));
|
||||
PredSafeCallCleanup = RepPredProp(PredPropByFunc(FunctorSafeCallCleanup,PROLOG_MODULE));
|
||||
PredRestoreRegs = RepPredProp(PredPropByFunc(FunctorRestoreRegs,PROLOG_MODULE));
|
||||
#ifdef YAPOR
|
||||
Yap_heap_regs->pred_getwork = RepPredProp(PredPropByAtom(AtomGetwork,PROLOG_MODULE));
|
||||
Yap_heap_regs->pred_getwork_seq = RepPredProp(PredPropByAtom(AtomGetworkSeq,PROLOG_MODULE));
|
||||
PredGetwork = RepPredProp(PredPropByAtom(AtomGetwork,PROLOG_MODULE));
|
||||
PredGetworkSeq = RepPredProp(PredPropByAtom(AtomGetworkSeq,PROLOG_MODULE));
|
||||
#endif /* YAPOR */
|
||||
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
Yap_heap_regs->yap_do_low_level_trace = FALSE;
|
||||
Yap_do_low_level_trace = FALSE;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
INIT_LOCK(Yap_low_level_trace_lock);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Yap_heap_regs->clause_space = 0;
|
||||
Yap_heap_regs->index_space_Tree = 0;
|
||||
Yap_heap_regs->index_space_EXT = 0;
|
||||
Yap_heap_regs->index_space_SW = 0;
|
||||
Yap_heap_regs->lu_clause_space = 0;
|
||||
Yap_heap_regs->lu_index_space_Tree = 0;
|
||||
Yap_heap_regs->lu_index_space_CP = 0;
|
||||
Yap_heap_regs->lu_index_space_EXT = 0;
|
||||
Yap_heap_regs->lu_index_space_SW = 0;
|
||||
Yap_ClauseSpace = 0;
|
||||
Yap_IndexSpace_Tree = 0;
|
||||
Yap_IndexSpace_EXT = 0;
|
||||
Yap_IndexSpace_SW = 0;
|
||||
Yap_LUClauseSpace = 0;
|
||||
Yap_LUIndexSpace_Tree = 0;
|
||||
Yap_LUIndexSpace_CP = 0;
|
||||
Yap_LUIndexSpace_EXT = 0;
|
||||
Yap_LUIndexSpace_SW = 0;
|
||||
|
||||
|
||||
Yap_heap_regs->dummycode->opc = Yap_opcode(_op_fail);
|
||||
Yap_heap_regs->failcode->opc = Yap_opcode(_op_fail);
|
||||
Yap_heap_regs->nocode->opc = Yap_opcode(_Nstop);
|
||||
DUMMYCODE->opc = Yap_opcode(_op_fail);
|
||||
FAILCODE->opc = Yap_opcode(_op_fail);
|
||||
NOCODE->opc = Yap_opcode(_Nstop);
|
||||
InitEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail);
|
||||
|
||||
InitEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail);
|
||||
|
||||
InitOtaplInst(RTRYCODE,_retry_and_mark,PredFail);
|
||||
#ifdef BEAM
|
||||
Yap_heap_regs->beam_retry_code->opc = Yap_opcode(_beam_retry_code);
|
||||
BEAM_RETRY_CODE->opc = Yap_opcode(_beam_retry_code);
|
||||
#endif /* BEAM */
|
||||
#ifdef YAPOR
|
||||
Yap_heap_regs->seq_def = FALSE;
|
||||
SEQUENTIAL_IS_DEFAULT = FALSE;
|
||||
InitOtaplInst(GETWORK,_getwork,PredGetwork);
|
||||
InitOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq);
|
||||
Yap_heap_regs->getwork_first_time->opc = Yap_opcode(_getwork_first_time);
|
||||
GETWORK_FIRST_TIME->opc = Yap_opcode(_getwork_first_time);
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
InitOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail);
|
||||
@ -185,121 +185,121 @@
|
||||
|
||||
|
||||
|
||||
Yap_heap_regs->debugger_p_before_spy = NULL;
|
||||
P_before_spy = NULL;
|
||||
|
||||
Yap_heap_regs->retry_recordedp_code = NULL;
|
||||
Yap_heap_regs->retry_recorded_k_code = NULL;
|
||||
RETRY_C_RECORDEDP_CODE = NULL;
|
||||
RETRY_C_RECORDED_K_CODE = NULL;
|
||||
|
||||
Yap_heap_regs->system_profiling = FALSE;
|
||||
Yap_heap_regs->system_call_counting = FALSE;
|
||||
Yap_heap_regs->system_pred_goal_expansion_all = FALSE;
|
||||
Yap_heap_regs->system_pred_goal_expansion_func = FALSE;
|
||||
Yap_heap_regs->system_pred_goal_expansion_on = FALSE;
|
||||
Yap_heap_regs->compiler_optimizer_on = TRUE;
|
||||
Yap_heap_regs->compiler_compile_mode = 0;
|
||||
Yap_heap_regs->compiler_profiling = FALSE;
|
||||
Yap_heap_regs->compiler_call_counting = FALSE;
|
||||
PROFILING = FALSE;
|
||||
CALL_COUNTING = FALSE;
|
||||
PRED_GOAL_EXPANSION_ALL = FALSE;
|
||||
PRED_GOAL_EXPANSION_FUNC = FALSE;
|
||||
PRED_GOAL_EXPANSION_ON = FALSE;
|
||||
optimizer_on = TRUE;
|
||||
compile_mode = 0;
|
||||
profiling = FALSE;
|
||||
call_counting = FALSE;
|
||||
|
||||
Yap_heap_regs->compiler_compile_arrays = FALSE;
|
||||
compile_arrays = FALSE;
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(Yap_heap_regs->dbterms_list_lock);
|
||||
INIT_LOCK(DBTermsListLock);
|
||||
#endif
|
||||
Yap_heap_regs->dbterms_list = NULL;
|
||||
DBTermsList = NULL;
|
||||
|
||||
Yap_heap_regs->expand_clauses_first = NULL;
|
||||
Yap_heap_regs->expand_clauses_last = NULL;
|
||||
Yap_heap_regs->expand_clauses = 0;
|
||||
ExpandClausesFirst = NULL;
|
||||
ExpandClausesLast = NULL;
|
||||
Yap_ExpandClauses = 0;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(Yap_heap_regs->expand_clauses_list_lock);
|
||||
INIT_LOCK(Yap_heap_regs->op_list_lock);
|
||||
INIT_LOCK(ExpandClausesListLock);
|
||||
INIT_LOCK(OpListLock);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
Yap_heap_regs->new_cps = 0L;
|
||||
Yap_heap_regs->live_cps = 0L;
|
||||
Yap_heap_regs->dirty_cps = 0L;
|
||||
Yap_heap_regs->freed_cps = 0L;
|
||||
Yap_NewCps = 0L;
|
||||
Yap_LiveCps = 0L;
|
||||
Yap_DirtyCps = 0L;
|
||||
Yap_FreedCps = 0L;
|
||||
#endif
|
||||
Yap_heap_regs->expand_clauses_sz = 0L;
|
||||
Yap_expand_clauses_sz = 0L;
|
||||
|
||||
Yap_heap_regs->udi_control_blocks = NULL;
|
||||
UdiControlBlocks = NULL;
|
||||
|
||||
|
||||
Yap_heap_regs->static_predicates_marked = FALSE;
|
||||
STATIC_PREDICATES_MARKED = FALSE;
|
||||
|
||||
Yap_heap_regs->IntKeys = NULL;
|
||||
Yap_heap_regs->IntLUKeys = NULL;
|
||||
Yap_heap_regs->IntBBKeys = NULL;
|
||||
INT_KEYS = NULL;
|
||||
INT_LU_KEYS = NULL;
|
||||
INT_BB_KEYS = NULL;
|
||||
|
||||
Yap_heap_regs->int_keys_size = INT_KEYS_DEFAULT_SIZE;
|
||||
Yap_heap_regs->int_keys_timestamp = 0L;
|
||||
Yap_heap_regs->int_bb_keys_size = INT_KEYS_DEFAULT_SIZE;
|
||||
INT_KEYS_SIZE = INT_KEYS_DEFAULT_SIZE;
|
||||
INT_KEYS_TIMESTAMP = 0L;
|
||||
INT_BB_KEYS_SIZE = INT_KEYS_DEFAULT_SIZE;
|
||||
|
||||
Yap_heap_regs->update_mode = UPDATE_MODE_LOGICAL;
|
||||
UPDATE_MODE = UPDATE_MODE_LOGICAL;
|
||||
|
||||
InitDBErasedMarker();
|
||||
InitLogDBErasedMarker();
|
||||
|
||||
Yap_heap_regs->dead_static_clauses = NULL;
|
||||
Yap_heap_regs->dead_mega_clauses = NULL;
|
||||
Yap_heap_regs->dead_static_indices = NULL;
|
||||
Yap_heap_regs->db_erased_list = NULL;
|
||||
Yap_heap_regs->db_erased_ilist = NULL;
|
||||
DeadStaticClauses = NULL;
|
||||
DeadMegaClauses = NULL;
|
||||
DeadStaticIndices = NULL;
|
||||
DBErasedList = NULL;
|
||||
DBErasedIList = NULL;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(Yap_heap_regs->dead_static_clauses_lock);
|
||||
INIT_LOCK(Yap_heap_regs->dead_mega_clauses_lock);
|
||||
INIT_LOCK(Yap_heap_regs->dead_static_indices_lock);
|
||||
INIT_LOCK(DeadStaticClausesLock);
|
||||
INIT_LOCK(DeadMegaClausesLock);
|
||||
INIT_LOCK(DeadStaticIndicesLock);
|
||||
#endif
|
||||
#ifdef COROUTINING
|
||||
|
||||
Yap_heap_regs->num_of_atts = 1;
|
||||
NUM_OF_ATTS = 1;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
InitFlags();
|
||||
|
||||
Yap_heap_regs->op_list = NULL;
|
||||
OpList = NULL;
|
||||
|
||||
|
||||
Yap_heap_regs->yap_streams = NULL;
|
||||
Stream = NULL;
|
||||
|
||||
Yap_heap_regs->n_of_file_aliases = 0;
|
||||
Yap_heap_regs->sz_of_file_aliases = 0;
|
||||
Yap_heap_regs->file_aliases = NULL;
|
||||
NOfFileAliases = 0;
|
||||
SzOfFileAliases = 0;
|
||||
FileAliases = NULL;
|
||||
|
||||
Yap_heap_regs->atprompt = AtomNil;
|
||||
AtPrompt = AtomNil;
|
||||
|
||||
|
||||
Yap_heap_regs->char_conversion_table = NULL;
|
||||
Yap_heap_regs->char_conversion_table2 = NULL;
|
||||
CharConversionTable = NULL;
|
||||
CharConversionTable2 = NULL;
|
||||
|
||||
Yap_heap_regs->parser_error_style = EXCEPTION_ON_PARSER_ERROR;
|
||||
ParserErrorStyle = EXCEPTION_ON_PARSER_ERROR;
|
||||
|
||||
Yap_heap_regs->yap_lib_dir = NULL;
|
||||
Yap_LibDir = NULL;
|
||||
|
||||
Yap_heap_regs->last_wtime = NULL;
|
||||
LastWtimePtr = NULL;
|
||||
|
||||
Yap_heap_regs->debugger_output_msg = 0L;
|
||||
output_msg = 0L;
|
||||
#if LOW_PROF
|
||||
Yap_heap_regs->profiler_on = FALSE;
|
||||
Yap_heap_regs->offline_profiler = FALSE;
|
||||
Yap_heap_regs->f_prof = NULL;
|
||||
Yap_heap_regs->f_preds = NULL;
|
||||
Yap_heap_regs->prof_preds = 0L;
|
||||
ProfilerOn = FALSE;
|
||||
Yap_OffLineProfiler = FALSE;
|
||||
FProf = NULL;
|
||||
FPreds = NULL;
|
||||
ProfPreds = 0L;
|
||||
#endif /* LOW_PROF */
|
||||
|
||||
Yap_heap_regs->foreign_code_loaded = NULL;
|
||||
Yap_heap_regs->foreign_code_base = NULL;
|
||||
Yap_heap_regs->foreign_code_top = NULL;
|
||||
Yap_heap_regs->foreign_code_max = NULL;
|
||||
ForeignCodeLoaded = NULL;
|
||||
ForeignCodeBase = NULL;
|
||||
ForeignCodeTop = NULL;
|
||||
ForeignCodeMax = NULL;
|
||||
|
||||
Yap_heap_regs->yap_records = NULL;
|
||||
Yap_Records = NULL;
|
||||
|
||||
InitSWIAtoms();
|
||||
|
||||
|
||||
|
||||
Yap_heap_regs->swi_blob_types = NULL;
|
||||
Yap_heap_regs->swi_blobs = NULL;
|
||||
SWI_BlobTypes = NULL;
|
||||
SWI_Blobs = NULL;
|
||||
|
16
H/ilocals.h
16
H/ilocals.h
@ -48,13 +48,11 @@ static void InitWorker(int wid) {
|
||||
|
||||
FOREIGN(wid)->global_arena = 0L;
|
||||
FOREIGN(wid)->global_arena_overflows = 0L;
|
||||
FOREIGN(wid)->delay_arena_overflows = 0L;
|
||||
FOREIGN(wid)->arena_overflows = 0L;
|
||||
FOREIGN(wid)->depth_arenas = 0;
|
||||
FOREIGN(wid)->arith_error = FALSE;
|
||||
FOREIGN(wid)->last_asserted_pred = NULL;
|
||||
FOREIGN(wid)->debug_on = FALSE;
|
||||
FOREIGN(wid)->f_info = NULL;
|
||||
FOREIGN(wid)->scanner_stack = NULL;
|
||||
FOREIGN(wid)->scanner_extra_blocks = NULL;
|
||||
FOREIGN(wid)->ball_term = NULL;
|
||||
@ -82,24 +80,21 @@ static void InitWorker(int wid) {
|
||||
FOREIGN(wid)->total_cps = 0;
|
||||
#endif
|
||||
FOREIGN(wid)->consult_level_ = 0;
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
INIT_LOCK(FOREIGN(wid)->signal_lock);
|
||||
FOREIGN(wid)->wpp = NULL;
|
||||
#endif
|
||||
|
||||
FOREIGN(wid)->tot_marked = 0L;
|
||||
FOREIGN(wid)->tot_oldies = 0L;
|
||||
#if DEBUG && COROUTINING
|
||||
FOREIGN(wid)->tot_smarked = 0L;
|
||||
#endif
|
||||
FOREIGN(wid)->wl_current_B = NULL;
|
||||
FOREIGN(wid)->wl_prev_HB = NULL;
|
||||
FOREIGN(wid)->hgen = NULL;
|
||||
FOREIGN(wid)->ip_top = NULL;
|
||||
#if GC_NO_TAGS
|
||||
|
||||
#if defined(GC_NO_TAGS)
|
||||
FOREIGN(wid)->b_p = NULL;
|
||||
#endif
|
||||
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
||||
FOREIGN(wid)->wl_sTR = NULL;
|
||||
FOREIGN(wid)->wl_sTR0 = NULL;
|
||||
FOREIGN(wid)->new_tr = NULL;
|
||||
@ -107,7 +102,7 @@ static void InitWorker(int wid) {
|
||||
FOREIGN(wid)->wl_sTR = NULL;
|
||||
FOREIGN(wid)->wl_sTR0 = NULL;
|
||||
FOREIGN(wid)->new_tr = NULL;
|
||||
#endif
|
||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
||||
FOREIGN(wid)->conttop0 = NULL;
|
||||
FOREIGN(wid)->conttop = NULL;
|
||||
FOREIGN(wid)->disc_trail_entries = 0;
|
||||
@ -119,7 +114,6 @@ static void InitWorker(int wid) {
|
||||
FOREIGN(wid)->DB_vec0 = NULL;
|
||||
FOREIGN(wid)->DB_root = NULL;
|
||||
FOREIGN(wid)->DB_nil = NULL;
|
||||
#endif /* defined(YAPOR) || defined(THREADS) */
|
||||
|
||||
FOREIGN(wid)->dynamic_arrays = NULL;
|
||||
FOREIGN(wid)->static_arrays = NULL;
|
||||
|
@ -33,7 +33,7 @@ static void RestoreGlobal(void) {
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
|
||||
REINIT_LOCK(Yap_global->bgl);
|
||||
REINIT_LOCK(Yap_BGL);
|
||||
#endif
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ static void RestoreGlobal(void) {
|
||||
|
||||
|
||||
#ifdef THREADS
|
||||
REINIT_LOCK(Yap_global->thread_handles_lock);
|
||||
REINIT_LOCK(Yap_ThreadHandlesLock);
|
||||
#endif
|
||||
|
||||
#if defined(YAPOR) || defined(TABLING)
|
||||
|
@ -1016,9 +1016,9 @@ static void
|
||||
RestoreBallTerm(int wid)
|
||||
{
|
||||
CACHE_REGS
|
||||
if (BallTerm) {
|
||||
BallTerm = DBTermAdjust(BallTerm);
|
||||
RestoreDBTerm(BallTerm, TRUE PASS_REGS);
|
||||
if (LOCAL_BallTerm) {
|
||||
LOCAL_BallTerm = DBTermAdjust(LOCAL_BallTerm);
|
||||
RestoreDBTerm(LOCAL_BallTerm, TRUE PASS_REGS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1030,7 +1030,7 @@ static void
|
||||
restore_codes(void)
|
||||
{
|
||||
CACHE_REGS
|
||||
Yap_heap_regs->heap_top = AddrAdjust(OldHeapTop);
|
||||
Yap_heap_regs->heap_top = AddrAdjust(LOCAL_OldHeapTop);
|
||||
#include "rhstruct.h"
|
||||
RestoreGlobal();
|
||||
#ifndef worker_id
|
||||
|
142
H/rhstruct.h
142
H/rhstruct.h
@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(Yap_heap_regs->dlmalloc_lock);
|
||||
REINIT_LOCK(DLMallocLock);
|
||||
#endif
|
||||
#endif
|
||||
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
|
||||
@ -51,24 +51,24 @@
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(Yap_heap_regs->free_blocks_lock);
|
||||
REINIT_LOCK(Yap_heap_regs->heap_used_lock);
|
||||
REINIT_LOCK(Yap_heap_regs->heap_top_lock);
|
||||
REINIT_LOCK(FreeBlocksLock);
|
||||
REINIT_LOCK(HeapUsedLock);
|
||||
REINIT_LOCK(HeapTopLock);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if USE_THREADED_CODE
|
||||
Yap_heap_regs->op_rtable = OpRTableAdjust(Yap_heap_regs->op_rtable);
|
||||
OP_RTABLE = OpRTableAdjust(OP_RTABLE);
|
||||
#endif
|
||||
|
||||
Yap_heap_regs->execute_cpred_op_code = Yap_opcode(_execute_cpred);
|
||||
Yap_heap_regs->expand_op_code = Yap_opcode(_expand_index);
|
||||
Yap_heap_regs->fail_op = Yap_opcode(_op_fail);
|
||||
Yap_heap_regs->index_op = Yap_opcode(_index_pred);
|
||||
Yap_heap_regs->lockpred_op = Yap_opcode(_lock_pred);
|
||||
Yap_heap_regs->orlast_op = Yap_opcode(_or_last);
|
||||
Yap_heap_regs->undef_op = Yap_opcode(_undef_p);
|
||||
EXECUTE_CPRED_OP_CODE = Yap_opcode(_execute_cpred);
|
||||
EXPAND_OP_CODE = Yap_opcode(_expand_index);
|
||||
FAIL_OPCODE = Yap_opcode(_op_fail);
|
||||
INDEX_OPCODE = Yap_opcode(_index_pred);
|
||||
LOCKPRED_OPCODE = Yap_opcode(_lock_pred);
|
||||
ORLAST_OPCODE = Yap_opcode(_or_last);
|
||||
UNDEF_OPCODE = Yap_opcode(_undef_p);
|
||||
|
||||
|
||||
|
||||
@ -80,27 +80,27 @@
|
||||
|
||||
#include "ratoms.h"
|
||||
#ifdef EUROTRA
|
||||
Yap_heap_regs->term_dollar_u = AtomTermAdjust(Yap_heap_regs->term_dollar_u);
|
||||
TermDollarU = AtomTermAdjust(TermDollarU);
|
||||
#endif
|
||||
Yap_heap_regs->term_prolog = AtomTermAdjust(Yap_heap_regs->term_prolog);
|
||||
Yap_heap_regs->term_refound_var = AtomTermAdjust(Yap_heap_regs->term_refound_var);
|
||||
Yap_heap_regs->user_module = AtomTermAdjust(Yap_heap_regs->user_module);
|
||||
Yap_heap_regs->idb_module = AtomTermAdjust(Yap_heap_regs->idb_module);
|
||||
Yap_heap_regs->attributes_module = AtomTermAdjust(Yap_heap_regs->attributes_module);
|
||||
Yap_heap_regs->charsio_module = AtomTermAdjust(Yap_heap_regs->charsio_module);
|
||||
Yap_heap_regs->terms_module = AtomTermAdjust(Yap_heap_regs->terms_module);
|
||||
Yap_heap_regs->system_module = AtomTermAdjust(Yap_heap_regs->system_module);
|
||||
Yap_heap_regs->operating_system_module = AtomTermAdjust(Yap_heap_regs->operating_system_module);
|
||||
Yap_heap_regs->readutil_module = AtomTermAdjust(Yap_heap_regs->readutil_module);
|
||||
Yap_heap_regs->hacks_module = AtomTermAdjust(Yap_heap_regs->hacks_module);
|
||||
Yap_heap_regs->arg_module = AtomTermAdjust(Yap_heap_regs->arg_module);
|
||||
Yap_heap_regs->globals_module = AtomTermAdjust(Yap_heap_regs->globals_module);
|
||||
Yap_heap_regs->swi_module = AtomTermAdjust(Yap_heap_regs->swi_module);
|
||||
Yap_heap_regs->dbload_module = AtomTermAdjust(Yap_heap_regs->dbload_module);
|
||||
TermProlog = AtomTermAdjust(TermProlog);
|
||||
TermReFoundVar = AtomTermAdjust(TermReFoundVar);
|
||||
USER_MODULE = AtomTermAdjust(USER_MODULE);
|
||||
IDB_MODULE = AtomTermAdjust(IDB_MODULE);
|
||||
ATTRIBUTES_MODULE = AtomTermAdjust(ATTRIBUTES_MODULE);
|
||||
CHARSIO_MODULE = AtomTermAdjust(CHARSIO_MODULE);
|
||||
TERMS_MODULE = AtomTermAdjust(TERMS_MODULE);
|
||||
SYSTEM_MODULE = AtomTermAdjust(SYSTEM_MODULE);
|
||||
OPERATING_SYSTEM_MODULE = AtomTermAdjust(OPERATING_SYSTEM_MODULE);
|
||||
READUTIL_MODULE = AtomTermAdjust(READUTIL_MODULE);
|
||||
HACKS_MODULE = AtomTermAdjust(HACKS_MODULE);
|
||||
ARG_MODULE = AtomTermAdjust(ARG_MODULE);
|
||||
GLOBALS_MODULE = AtomTermAdjust(GLOBALS_MODULE);
|
||||
SWI_MODULE = AtomTermAdjust(SWI_MODULE);
|
||||
DBLOAD_MODULE = AtomTermAdjust(DBLOAD_MODULE);
|
||||
|
||||
|
||||
|
||||
Yap_heap_regs->current_modules = ModEntryPtrAdjust(Yap_heap_regs->current_modules);
|
||||
CurrentModules = ModEntryPtrAdjust(CurrentModules);
|
||||
|
||||
|
||||
|
||||
@ -114,36 +114,36 @@
|
||||
|
||||
|
||||
|
||||
Yap_heap_regs->creep_code = PtoPredAdjust(Yap_heap_regs->creep_code);
|
||||
Yap_heap_regs->undef_code = PtoPredAdjust(Yap_heap_regs->undef_code);
|
||||
Yap_heap_regs->spy_code = PtoPredAdjust(Yap_heap_regs->spy_code);
|
||||
Yap_heap_regs->pred_fail = PtoPredAdjust(Yap_heap_regs->pred_fail);
|
||||
Yap_heap_regs->pred_true = PtoPredAdjust(Yap_heap_regs->pred_true);
|
||||
CreepCode = PtoPredAdjust(CreepCode);
|
||||
UndefCode = PtoPredAdjust(UndefCode);
|
||||
SpyCode = PtoPredAdjust(SpyCode);
|
||||
PredFail = PtoPredAdjust(PredFail);
|
||||
PredTrue = PtoPredAdjust(PredTrue);
|
||||
#ifdef COROUTINING
|
||||
Yap_heap_regs->wake_up_code = PtoPredAdjust(Yap_heap_regs->wake_up_code);
|
||||
WakeUpCode = PtoPredAdjust(WakeUpCode);
|
||||
#endif
|
||||
Yap_heap_regs->pred_goal_expansion = PtoPredAdjust(Yap_heap_regs->pred_goal_expansion);
|
||||
Yap_heap_regs->pred_meta_call = PtoPredAdjust(Yap_heap_regs->pred_meta_call);
|
||||
Yap_heap_regs->pred_dollar_catch = PtoPredAdjust(Yap_heap_regs->pred_dollar_catch);
|
||||
Yap_heap_regs->pred_recorded_with_key = PtoPredAdjust(Yap_heap_regs->pred_recorded_with_key);
|
||||
Yap_heap_regs->pred_log_upd_clause = PtoPredAdjust(Yap_heap_regs->pred_log_upd_clause);
|
||||
Yap_heap_regs->pred_log_upd_clause_erase = PtoPredAdjust(Yap_heap_regs->pred_log_upd_clause_erase);
|
||||
Yap_heap_regs->pred_log_upd_clause0 = PtoPredAdjust(Yap_heap_regs->pred_log_upd_clause0);
|
||||
Yap_heap_regs->pred_static_clause = PtoPredAdjust(Yap_heap_regs->pred_static_clause);
|
||||
Yap_heap_regs->pred_throw = PtoPredAdjust(Yap_heap_regs->pred_throw);
|
||||
Yap_heap_regs->pred_handle_throw = PtoPredAdjust(Yap_heap_regs->pred_handle_throw);
|
||||
Yap_heap_regs->pred_is = PtoPredAdjust(Yap_heap_regs->pred_is);
|
||||
Yap_heap_regs->pred_safe_call_cleanup = PtoPredAdjust(Yap_heap_regs->pred_safe_call_cleanup);
|
||||
Yap_heap_regs->pred_restore_regs = PtoPredAdjust(Yap_heap_regs->pred_restore_regs);
|
||||
PredGoalExpansion = PtoPredAdjust(PredGoalExpansion);
|
||||
PredMetaCall = PtoPredAdjust(PredMetaCall);
|
||||
PredDollarCatch = PtoPredAdjust(PredDollarCatch);
|
||||
PredRecordedWithKey = PtoPredAdjust(PredRecordedWithKey);
|
||||
PredLogUpdClause = PtoPredAdjust(PredLogUpdClause);
|
||||
PredLogUpdClauseErase = PtoPredAdjust(PredLogUpdClauseErase);
|
||||
PredLogUpdClause0 = PtoPredAdjust(PredLogUpdClause0);
|
||||
PredStaticClause = PtoPredAdjust(PredStaticClause);
|
||||
PredThrow = PtoPredAdjust(PredThrow);
|
||||
PredHandleThrow = PtoPredAdjust(PredHandleThrow);
|
||||
PredIs = PtoPredAdjust(PredIs);
|
||||
PredSafeCallCleanup = PtoPredAdjust(PredSafeCallCleanup);
|
||||
PredRestoreRegs = PtoPredAdjust(PredRestoreRegs);
|
||||
#ifdef YAPOR
|
||||
Yap_heap_regs->pred_getwork = PtoPredAdjust(Yap_heap_regs->pred_getwork);
|
||||
Yap_heap_regs->pred_getwork_seq = PtoPredAdjust(Yap_heap_regs->pred_getwork_seq);
|
||||
PredGetwork = PtoPredAdjust(PredGetwork);
|
||||
PredGetworkSeq = PtoPredAdjust(PredGetworkSeq);
|
||||
#endif /* YAPOR */
|
||||
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
REINIT_LOCK(Yap_low_level_trace_lock);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -158,22 +158,22 @@
|
||||
|
||||
|
||||
|
||||
Yap_heap_regs->dummycode->opc = Yap_opcode(_op_fail);
|
||||
Yap_heap_regs->failcode->opc = Yap_opcode(_op_fail);
|
||||
Yap_heap_regs->nocode->opc = Yap_opcode(_Nstop);
|
||||
DUMMYCODE->opc = Yap_opcode(_op_fail);
|
||||
FAILCODE->opc = Yap_opcode(_op_fail);
|
||||
NOCODE->opc = Yap_opcode(_Nstop);
|
||||
RestoreEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail);
|
||||
|
||||
RestoreEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail);
|
||||
|
||||
RestoreOtaplInst(RTRYCODE,_retry_and_mark,PredFail);
|
||||
#ifdef BEAM
|
||||
Yap_heap_regs->beam_retry_code->opc = Yap_opcode(_beam_retry_code);
|
||||
BEAM_RETRY_CODE->opc = Yap_opcode(_beam_retry_code);
|
||||
#endif /* BEAM */
|
||||
#ifdef YAPOR
|
||||
|
||||
RestoreOtaplInst(GETWORK,_getwork,PredGetwork);
|
||||
RestoreOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq);
|
||||
Yap_heap_regs->getwork_first_time->opc = Yap_opcode(_getwork_first_time);
|
||||
GETWORK_FIRST_TIME->opc = Yap_opcode(_getwork_first_time);
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
RestoreOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail);
|
||||
@ -185,10 +185,10 @@
|
||||
|
||||
|
||||
|
||||
Yap_heap_regs->debugger_p_before_spy = PtoOpAdjust(Yap_heap_regs->debugger_p_before_spy);
|
||||
P_before_spy = PtoOpAdjust(P_before_spy);
|
||||
|
||||
Yap_heap_regs->retry_recordedp_code = PtoOpAdjust(Yap_heap_regs->retry_recordedp_code);
|
||||
Yap_heap_regs->retry_recorded_k_code = PtoOpAdjust(Yap_heap_regs->retry_recorded_k_code);
|
||||
RETRY_C_RECORDEDP_CODE = PtoOpAdjust(RETRY_C_RECORDEDP_CODE);
|
||||
RETRY_C_RECORDED_K_CODE = PtoOpAdjust(RETRY_C_RECORDED_K_CODE);
|
||||
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(Yap_heap_regs->dbterms_list_lock);
|
||||
REINIT_LOCK(DBTermsListLock);
|
||||
#endif
|
||||
RestoreDBTermsList();
|
||||
|
||||
@ -211,8 +211,8 @@
|
||||
RestoreExpandList();
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(Yap_heap_regs->expand_clauses_list_lock);
|
||||
REINIT_LOCK(Yap_heap_regs->op_list_lock);
|
||||
REINIT_LOCK(ExpandClausesListLock);
|
||||
REINIT_LOCK(OpListLock);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -247,9 +247,9 @@
|
||||
RestoreDBErasedList();
|
||||
RestoreDBErasedIList();
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(Yap_heap_regs->dead_static_clauses_lock);
|
||||
REINIT_LOCK(Yap_heap_regs->dead_mega_clauses_lock);
|
||||
REINIT_LOCK(Yap_heap_regs->dead_static_indices_lock);
|
||||
REINIT_LOCK(DeadStaticClausesLock);
|
||||
REINIT_LOCK(DeadMegaClausesLock);
|
||||
REINIT_LOCK(DeadStaticIndicesLock);
|
||||
#endif
|
||||
#ifdef COROUTINING
|
||||
|
||||
@ -260,7 +260,7 @@
|
||||
|
||||
|
||||
|
||||
Yap_heap_regs->op_list = OpListAdjust(Yap_heap_regs->op_list);
|
||||
OpList = OpListAdjust(OpList);
|
||||
|
||||
|
||||
RestoreStreams();
|
||||
@ -269,17 +269,17 @@
|
||||
|
||||
RestoreAliases();
|
||||
|
||||
Yap_heap_regs->atprompt = AtomAdjust(Yap_heap_regs->atprompt);
|
||||
AtPrompt = AtomAdjust(AtPrompt);
|
||||
|
||||
|
||||
Yap_heap_regs->char_conversion_table = CodeCharPAdjust(Yap_heap_regs->char_conversion_table);
|
||||
Yap_heap_regs->char_conversion_table2 = CodeCharPAdjust(Yap_heap_regs->char_conversion_table2);
|
||||
CharConversionTable = CodeCharPAdjust(CharConversionTable);
|
||||
CharConversionTable2 = CodeCharPAdjust(CharConversionTable2);
|
||||
|
||||
|
||||
|
||||
Yap_heap_regs->yap_lib_dir = CodeCharPAdjust(Yap_heap_regs->yap_lib_dir);
|
||||
Yap_LibDir = CodeCharPAdjust(Yap_LibDir);
|
||||
|
||||
Yap_heap_regs->last_wtime = CodeVoidPAdjust(Yap_heap_regs->last_wtime);
|
||||
LastWtimePtr = CodeVoidPAdjust(LastWtimePtr);
|
||||
|
||||
|
||||
#if LOW_PROF
|
||||
|
20
H/rlocals.h
20
H/rlocals.h
@ -55,8 +55,6 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
RestoreBallTerm(wid);
|
||||
|
||||
|
||||
@ -82,24 +80,21 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
REINIT_LOCK(FOREIGN(wid)->signal_lock);
|
||||
|
||||
|
||||
|
||||
|
||||
#if DEBUG && COROUTINING
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if GC_NO_TAGS
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(GC_NO_TAGS)
|
||||
|
||||
#endif
|
||||
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
||||
|
||||
|
||||
|
||||
@ -107,7 +102,7 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
||||
|
||||
|
||||
|
||||
@ -119,7 +114,6 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
#endif /* defined(YAPOR) || defined(THREADS) */
|
||||
|
||||
FOREIGN(wid)->dynamic_arrays = PtoArrayEAdjust(FOREIGN(wid)->dynamic_arrays);
|
||||
FOREIGN(wid)->static_arrays = PtoArraySAdjust(FOREIGN(wid)->static_arrays);
|
||||
|
200
H/sshift.h
200
H/sshift.h
@ -140,13 +140,13 @@ inline EXTERN CELL *PtoGloAdjust__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN CELL *
|
||||
PtoGloAdjust__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
if (ptr < GSplit) {
|
||||
if (ptr < LOCAL_GSplit) {
|
||||
if (ptr < H0)
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + DelayDiff)));
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_DelayDiff)));
|
||||
else
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + GDiff0)));
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_GDiff0)));
|
||||
} else {
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + GDiff)));
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_GDiff)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,10 +157,10 @@ inline EXTERN CELL *PtoDelayAdjust__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN CELL *
|
||||
PtoDelayAdjust__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
if (!GSplit || ptr < GSplit)
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + DelayDiff)));
|
||||
if (!LOCAL_GSplit || ptr < LOCAL_GSplit)
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_DelayDiff)));
|
||||
else
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + GDiff0)));
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_GDiff0)));
|
||||
}
|
||||
|
||||
inline EXTERN CELL *PtoBaseAdjust__ (CELL * CACHE_TYPE);
|
||||
@ -168,7 +168,7 @@ inline EXTERN CELL *PtoBaseAdjust__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN CELL *
|
||||
PtoBaseAdjust__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + BaseDiff)));
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_BaseDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ inline EXTERN tr_fr_ptr PtoTRAdjust__ (tr_fr_ptr CACHE_TYPE);
|
||||
inline EXTERN tr_fr_ptr
|
||||
PtoTRAdjust__ (tr_fr_ptr ptr USES_REGS)
|
||||
{
|
||||
return (tr_fr_ptr) (((tr_fr_ptr) (CharP (ptr) + TrDiff)));
|
||||
return (tr_fr_ptr) (((tr_fr_ptr) (CharP (ptr) + LOCAL_TrDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ inline EXTERN CELL *CellPtoTRAdjust__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN CELL *
|
||||
CellPtoTRAdjust__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + TrDiff)));
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_TrDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ inline EXTERN CELL *PtoLocAdjust__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN CELL *
|
||||
PtoLocAdjust__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LDiff)));
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_LDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -207,7 +207,7 @@ inline EXTERN struct cut_c_str *CutCAdjust__ (struct cut_c_str * CACHE_TYPE);
|
||||
inline EXTERN struct cut_c_str *
|
||||
CutCAdjust__ (struct cut_c_str * ptr USES_REGS)
|
||||
{
|
||||
return (struct cut_c_str *) (CharP (ptr) + LDiff);
|
||||
return (struct cut_c_str *) (CharP (ptr) + LOCAL_LDiff);
|
||||
}
|
||||
|
||||
|
||||
@ -217,7 +217,7 @@ inline EXTERN choiceptr ChoicePtrAdjust__ (choiceptr CACHE_TYPE);
|
||||
inline EXTERN choiceptr
|
||||
ChoicePtrAdjust__ (choiceptr ptr USES_REGS)
|
||||
{
|
||||
return (choiceptr) (((choiceptr) (CharP (ptr) + LDiff)));
|
||||
return (choiceptr) (((choiceptr) (CharP (ptr) + LOCAL_LDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -228,7 +228,7 @@ inline EXTERN choiceptr ConsumerChoicePtrAdjust__ (choiceptr CACHE_TYPE);
|
||||
inline EXTERN choiceptr
|
||||
ConsumerChoicePtrAdjust__ (choiceptr ptr USES_REGS)
|
||||
{
|
||||
return (choiceptr) (((choiceptr) (CharP (ptr) + LDiff)));
|
||||
return (choiceptr) (((choiceptr) (CharP (ptr) + LOCAL_LDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -238,7 +238,7 @@ inline EXTERN choiceptr GeneratorChoicePtrAdjust__ (choiceptr CACHE_TYPE);
|
||||
inline EXTERN choiceptr
|
||||
GeneratorChoicePtrAdjust__ (choiceptr ptr USES_REGS)
|
||||
{
|
||||
return (choiceptr) (((choiceptr) (CharP (ptr) + LDiff)));
|
||||
return (choiceptr) (((choiceptr) (CharP (ptr) + LOCAL_LDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -250,13 +250,13 @@ inline EXTERN CELL GlobalAdjust__ (CELL CACHE_TYPE);
|
||||
inline EXTERN CELL
|
||||
GlobalAdjust__ (CELL val USES_REGS)
|
||||
{
|
||||
if ((CELL *)val < GSplit) {
|
||||
if ((CELL *)val < LOCAL_GSplit) {
|
||||
if ((CELL *)val < H0)
|
||||
return (CELL) (val + DelayDiff);
|
||||
return (CELL) (val + LOCAL_DelayDiff);
|
||||
else
|
||||
return (CELL) (val + GDiff0);
|
||||
return (CELL) (val + LOCAL_GDiff0);
|
||||
} else {
|
||||
return (CELL) (val + GDiff);
|
||||
return (CELL) (val + LOCAL_GDiff);
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,10 +267,10 @@ inline EXTERN CELL DelayAdjust__ (CELL CACHE_TYPE);
|
||||
inline EXTERN CELL
|
||||
DelayAdjust__ (CELL val USES_REGS)
|
||||
{
|
||||
if (!GSplit || (CELL *)val < GSplit)
|
||||
return (CELL) (val + DelayDiff);
|
||||
if (!LOCAL_GSplit || (CELL *)val < LOCAL_GSplit)
|
||||
return (CELL) (val + LOCAL_DelayDiff);
|
||||
else
|
||||
return (CELL) (val + GDiff0);
|
||||
return (CELL) (val + LOCAL_GDiff0);
|
||||
}
|
||||
|
||||
|
||||
@ -279,13 +279,13 @@ inline EXTERN ADDR GlobalAddrAdjust__ (ADDR CACHE_TYPE);
|
||||
inline EXTERN ADDR
|
||||
GlobalAddrAdjust__ (ADDR ptr USES_REGS)
|
||||
{
|
||||
if ((CELL *)ptr < GSplit) {
|
||||
if ((CELL *)ptr < LOCAL_GSplit) {
|
||||
if ((CELL *)ptr < H0)
|
||||
return (ADDR) (ptr + DelayDiff);
|
||||
return (ADDR) (ptr + LOCAL_DelayDiff);
|
||||
else
|
||||
return (ADDR) ((ptr + GDiff0));
|
||||
return (ADDR) ((ptr + LOCAL_GDiff0));
|
||||
} else {
|
||||
return (ADDR) ((ptr + GDiff));
|
||||
return (ADDR) ((ptr + LOCAL_GDiff));
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,10 +297,10 @@ inline EXTERN ADDR DelayAddrAdjust__ (ADDR CACHE_TYPE);
|
||||
inline EXTERN ADDR
|
||||
DelayAddrAdjust__ (ADDR ptr USES_REGS)
|
||||
{
|
||||
if (!GSplit || (CELL *)ptr < GSplit)
|
||||
return (ADDR) ((ptr + DelayDiff));
|
||||
if (!LOCAL_GSplit || (CELL *)ptr < LOCAL_GSplit)
|
||||
return (ADDR) ((ptr + LOCAL_DelayDiff));
|
||||
else
|
||||
return (ADDR) ((ptr + GDiff0));
|
||||
return (ADDR) ((ptr + LOCAL_GDiff0));
|
||||
}
|
||||
|
||||
|
||||
@ -309,7 +309,7 @@ inline EXTERN ADDR BaseAddrAdjust__ (ADDR CACHE_TYPE);
|
||||
inline EXTERN ADDR
|
||||
BaseAddrAdjust__ (ADDR ptr USES_REGS)
|
||||
{
|
||||
return (ADDR) ((ptr + BaseDiff));
|
||||
return (ADDR) ((ptr + LOCAL_BaseDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -319,7 +319,7 @@ inline EXTERN CELL LocalAdjust__ (CELL CACHE_TYPE);
|
||||
inline EXTERN CELL
|
||||
LocalAdjust__ (CELL val USES_REGS)
|
||||
{
|
||||
return (CELL) ((val + LDiff));
|
||||
return (CELL) ((val + LOCAL_LDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -329,7 +329,7 @@ inline EXTERN ADDR LocalAddrAdjust__ (ADDR CACHE_TYPE);
|
||||
inline EXTERN ADDR
|
||||
LocalAddrAdjust__ (ADDR ptr USES_REGS)
|
||||
{
|
||||
return (ADDR) ((ptr + LDiff));
|
||||
return (ADDR) ((ptr + LOCAL_LDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -339,7 +339,7 @@ inline EXTERN CELL TrailAdjust__ (CELL CACHE_TYPE);
|
||||
inline EXTERN CELL
|
||||
TrailAdjust__ (CELL val USES_REGS)
|
||||
{
|
||||
return (CELL) ((val + TrDiff));
|
||||
return (CELL) ((val + LOCAL_TrDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -349,7 +349,7 @@ inline EXTERN ADDR TrailAddrAdjust__ (ADDR CACHE_TYPE);
|
||||
inline EXTERN ADDR
|
||||
TrailAddrAdjust__ (ADDR ptr USES_REGS)
|
||||
{
|
||||
return (ADDR) ((ptr + TrDiff));
|
||||
return (ADDR) ((ptr + LOCAL_TrDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -359,7 +359,7 @@ inline EXTERN TokEntry *TokEntryAdjust__ (TokEntry * CACHE_TYPE);
|
||||
inline EXTERN TokEntry *
|
||||
TokEntryAdjust__ (TokEntry * ptr USES_REGS)
|
||||
{
|
||||
return (TokEntry *) (((CELL) ptr + TrDiff));
|
||||
return (TokEntry *) (((CELL) ptr + LOCAL_TrDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -369,7 +369,7 @@ inline EXTERN VarEntry *VarEntryAdjust__ (VarEntry * CACHE_TYPE);
|
||||
inline EXTERN VarEntry *
|
||||
VarEntryAdjust__ (VarEntry * ptr USES_REGS)
|
||||
{
|
||||
return (VarEntry *) (((CELL) ptr + TrDiff));
|
||||
return (VarEntry *) (((CELL) ptr + LOCAL_TrDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -381,7 +381,7 @@ inline EXTERN Functor
|
||||
FuncAdjust__ (Functor f USES_REGS)
|
||||
{
|
||||
if (!IsExtensionFunctor(f))
|
||||
return (Functor) ((CharP (f) + HDiff));
|
||||
return (Functor) ((CharP (f) + LOCAL_HDiff));
|
||||
return f;
|
||||
}
|
||||
|
||||
@ -392,7 +392,7 @@ CellPtoHeapAdjust__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
if (!ptr)
|
||||
return ptr;
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + HDiff)));
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN HoldEntry *HoldEntryAdjust__ (HoldEntry * CACHE_TYPE);
|
||||
@ -400,7 +400,7 @@ inline EXTERN HoldEntry *HoldEntryAdjust__ (HoldEntry * CACHE_TYPE);
|
||||
inline EXTERN HoldEntry *
|
||||
HoldEntryAdjust__ (HoldEntry * ptr USES_REGS)
|
||||
{
|
||||
return (HoldEntry *) (((HoldEntry *) (CharP (ptr) + HDiff)));
|
||||
return (HoldEntry *) (((HoldEntry *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN struct record_list *DBRecordAdjust__ (struct record_list * CACHE_TYPE);
|
||||
@ -410,7 +410,7 @@ DBRecordAdjust__ (struct record_list * ptr USES_REGS)
|
||||
{
|
||||
if (!ptr)
|
||||
return ptr;
|
||||
return (struct record_list *) (CharP (ptr) + HDiff);
|
||||
return (struct record_list *) (CharP (ptr) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
|
||||
@ -449,7 +449,7 @@ inline EXTERN Atom AtomAdjust__ (Atom CACHE_TYPE);
|
||||
inline EXTERN Atom
|
||||
AtomAdjust__ (Atom at USES_REGS)
|
||||
{
|
||||
return (Atom) ((at == NULL ? (at) : (Atom) (CharP (at) + HDiff)));
|
||||
return (Atom) ((at == NULL ? (at) : (Atom) (CharP (at) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN Atom NoAGCAtomAdjust__ (Atom CACHE_TYPE);
|
||||
@ -457,7 +457,7 @@ inline EXTERN Atom NoAGCAtomAdjust__ (Atom CACHE_TYPE);
|
||||
inline EXTERN Atom
|
||||
NoAGCAtomAdjust__ (Atom at USES_REGS)
|
||||
{
|
||||
return (Atom) ((at == NULL ? (at) : (Atom) (CharP (at) + HDiff)));
|
||||
return (Atom) ((at == NULL ? (at) : (Atom) (CharP (at) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -467,7 +467,7 @@ inline EXTERN Prop PropAdjust__ (Prop CACHE_TYPE);
|
||||
inline EXTERN Prop
|
||||
PropAdjust__ (Prop p USES_REGS)
|
||||
{
|
||||
return (Prop) ((p == NULL ? (p) : (Prop) (CharP (p) + HDiff)));
|
||||
return (Prop) ((p == NULL ? (p) : (Prop) (CharP (p) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -478,7 +478,7 @@ inline EXTERN struct PL_blob_t *BlobTypeAdjust__ (struct PL_blob_t *CACHE_TYPE);
|
||||
inline EXTERN struct PL_blob_t *
|
||||
BlobTypeAdjust__ (struct PL_blob_t *at USES_REGS)
|
||||
{
|
||||
return (struct PL_blob_t *) ((at == NULL ? (at) : (struct PL_blob_t *) (CharP (at) + HDiff)));
|
||||
return (struct PL_blob_t *) ((at == NULL ? (at) : (struct PL_blob_t *) (CharP (at) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN PredEntry *PredEntryAdjust__ (PredEntry * CACHE_TYPE);
|
||||
@ -486,7 +486,7 @@ inline EXTERN PredEntry *PredEntryAdjust__ (PredEntry * CACHE_TYPE);
|
||||
inline EXTERN PredEntry *
|
||||
PredEntryAdjust__ (PredEntry *p USES_REGS)
|
||||
{
|
||||
return (PredEntry *) ((p == NULL ? (p) : (PredEntry *) (CharP (p) + HDiff)));
|
||||
return (PredEntry *) ((p == NULL ? (p) : (PredEntry *) (CharP (p) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN struct mod_entry *ModEntryPtrAdjust__ (struct mod_entry * CACHE_TYPE);
|
||||
@ -494,7 +494,7 @@ inline EXTERN struct mod_entry *ModEntryPtrAdjust__ (struct mod_entry * CACHE_TY
|
||||
inline EXTERN struct mod_entry *
|
||||
ModEntryPtrAdjust__ (struct mod_entry *p USES_REGS)
|
||||
{
|
||||
return (struct mod_entry *) ((p == NULL ? (p) : (struct mod_entry *) (CharP (p) + HDiff)));
|
||||
return (struct mod_entry *) ((p == NULL ? (p) : (struct mod_entry *) (CharP (p) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN COUNT ConstantAdjust__ (COUNT CACHE_TYPE);
|
||||
@ -536,7 +536,7 @@ AtomTermAdjust__ (Term at USES_REGS)
|
||||
{
|
||||
if (at == 0L)
|
||||
return at;
|
||||
return (Term)(CharP(at) + HDiff);
|
||||
return (Term)(CharP(at) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
inline EXTERN Term ModuleAdjust__ (Term CACHE_TYPE);
|
||||
@ -554,7 +554,7 @@ CodeVarAdjust__ (Term var USES_REGS)
|
||||
{
|
||||
if (var == 0L)
|
||||
return var;
|
||||
return (Term)(CharP(var) + HDiff);
|
||||
return (Term)(CharP(var) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
|
||||
@ -565,7 +565,7 @@ inline EXTERN Term BlobTermInCodeAdjust__ (Term CACHE_TYPE);
|
||||
inline EXTERN Term
|
||||
BlobTermInCodeAdjust__ (Term t USES_REGS)
|
||||
{
|
||||
return (Term) (CharP(t) - HDiff);
|
||||
return (Term) (CharP(t) - LOCAL_HDiff);
|
||||
}
|
||||
|
||||
|
||||
@ -574,7 +574,7 @@ inline EXTERN Term CodeComposedTermAdjust__ (Term CACHE_TYPE);
|
||||
inline EXTERN Term
|
||||
CodeComposedTermAdjust__ (Term t USES_REGS)
|
||||
{
|
||||
return (Term) (CharP(t) - HDiff);
|
||||
return (Term) (CharP(t) - LOCAL_HDiff);
|
||||
}
|
||||
|
||||
|
||||
@ -585,7 +585,7 @@ inline EXTERN Term BlobTermInCodeAdjust__ (Term CACHE_TYPE);
|
||||
inline EXTERN Term
|
||||
BlobTermInCodeAdjust__ (Term t USES_REGS)
|
||||
{
|
||||
return (Term) (CharP(t) + HDiff);
|
||||
return (Term) (CharP(t) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
inline EXTERN Term CodeComposedTermAdjust__ (Term CACHE_TYPE);
|
||||
@ -593,7 +593,7 @@ inline EXTERN Term CodeComposedTermAdjust__ (Term CACHE_TYPE);
|
||||
inline EXTERN Term
|
||||
CodeComposedTermAdjust__ (Term t USES_REGS)
|
||||
{
|
||||
return (Term) (CharP(t) + HDiff);
|
||||
return (Term) (CharP(t) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
|
||||
@ -604,7 +604,7 @@ inline EXTERN AtomEntry *AtomEntryAdjust__ (AtomEntry * CACHE_TYPE);
|
||||
inline EXTERN AtomEntry *
|
||||
AtomEntryAdjust__ (AtomEntry * at USES_REGS)
|
||||
{
|
||||
return (AtomEntry *) ((AtomEntry *) (CharP (at) + HDiff));
|
||||
return (AtomEntry *) ((AtomEntry *) (CharP (at) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
inline EXTERN struct mfile *MFileAdjust__ (struct mfile * CACHE_TYPE);
|
||||
@ -612,7 +612,7 @@ inline EXTERN struct mfile *MFileAdjust__ (struct mfile * CACHE_TYPE);
|
||||
inline EXTERN struct mfile *
|
||||
MFileAdjust__ (struct mfile * at USES_REGS)
|
||||
{
|
||||
return (struct mfile *) (CharP (at) + HDiff);
|
||||
return (struct mfile *) (CharP (at) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
inline EXTERN GlobalEntry *GlobalEntryAdjust__ (GlobalEntry * CACHE_TYPE);
|
||||
@ -620,7 +620,7 @@ inline EXTERN GlobalEntry *GlobalEntryAdjust__ (GlobalEntry * CACHE_TYPE);
|
||||
inline EXTERN GlobalEntry *
|
||||
GlobalEntryAdjust__ (GlobalEntry * at USES_REGS)
|
||||
{
|
||||
return (GlobalEntry *) ((GlobalEntry *) (CharP (at) + HDiff));
|
||||
return (GlobalEntry *) ((GlobalEntry *) (CharP (at) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -630,7 +630,7 @@ inline EXTERN union CONSULT_OBJ *ConsultObjAdjust__ (union CONSULT_OBJ * CACHE_T
|
||||
inline EXTERN union CONSULT_OBJ *
|
||||
ConsultObjAdjust__ (union CONSULT_OBJ *co USES_REGS)
|
||||
{
|
||||
return (union CONSULT_OBJ *) ((union CONSULT_OBJ *) (CharP (co) + HDiff));
|
||||
return (union CONSULT_OBJ *) ((union CONSULT_OBJ *) (CharP (co) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -640,7 +640,7 @@ inline EXTERN DBRef DBRefAdjust__ (DBRef CACHE_TYPE);
|
||||
inline EXTERN DBRef
|
||||
DBRefAdjust__ (DBRef dbr USES_REGS)
|
||||
{
|
||||
return (DBRef) ((DBRef) (CharP (dbr) + HDiff));
|
||||
return (DBRef) ((DBRef) (CharP (dbr) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -650,7 +650,7 @@ inline EXTERN DBRef *DBRefPAdjust__ (DBRef * CACHE_TYPE);
|
||||
inline EXTERN DBRef *
|
||||
DBRefPAdjust__ (DBRef * dbrp USES_REGS)
|
||||
{
|
||||
return (DBRef *) ((DBRef *) (CharP (dbrp) + HDiff));
|
||||
return (DBRef *) ((DBRef *) (CharP (dbrp) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -660,7 +660,7 @@ inline EXTERN DBTerm *DBTermAdjust__ (DBTerm * CACHE_TYPE);
|
||||
inline EXTERN DBTerm *
|
||||
DBTermAdjust__ (DBTerm * dbtp USES_REGS)
|
||||
{
|
||||
return (DBTerm *) ((DBTerm *) (CharP (dbtp) + HDiff));
|
||||
return (DBTerm *) ((DBTerm *) (CharP (dbtp) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -671,7 +671,7 @@ inline EXTERN struct static_index *
|
||||
SIndexAdjust__ (struct static_index *si USES_REGS)
|
||||
{
|
||||
return (struct static_index
|
||||
*) ((struct static_index *) (CharP (si) + HDiff));
|
||||
*) ((struct static_index *) (CharP (si) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -683,7 +683,7 @@ inline EXTERN struct logic_upd_index *
|
||||
LUIndexAdjust__ (struct logic_upd_index *lui USES_REGS)
|
||||
{
|
||||
return (struct logic_upd_index
|
||||
*) ((struct logic_upd_index *) (CharP (lui) + HDiff));
|
||||
*) ((struct logic_upd_index *) (CharP (lui) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -693,7 +693,7 @@ inline EXTERN Term CodeAdjust__ (Term CACHE_TYPE);
|
||||
inline EXTERN Term
|
||||
CodeAdjust__ (Term dbr USES_REGS)
|
||||
{
|
||||
return (Term) (CharP(dbr) + HDiff);
|
||||
return (Term) (CharP(dbr) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
|
||||
@ -703,7 +703,7 @@ inline EXTERN ADDR AddrAdjust__ (ADDR CACHE_TYPE);
|
||||
inline EXTERN ADDR
|
||||
AddrAdjust__ (ADDR addr USES_REGS)
|
||||
{
|
||||
return (ADDR) ((ADDR) (CharP (addr) + HDiff));
|
||||
return (ADDR) ((ADDR) (CharP (addr) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -713,7 +713,7 @@ inline EXTERN CODEADDR CodeAddrAdjust__ (CODEADDR CACHE_TYPE);
|
||||
inline EXTERN CODEADDR
|
||||
CodeAddrAdjust__ (CODEADDR addr USES_REGS)
|
||||
{
|
||||
return (CODEADDR) ((CODEADDR) (CharP (addr) + HDiff));
|
||||
return (CODEADDR) ((CODEADDR) (CharP (addr) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -724,7 +724,7 @@ CodeCharPAdjust__ (char * addr USES_REGS)
|
||||
{
|
||||
if (!addr)
|
||||
return NULL;
|
||||
return addr + HDiff;
|
||||
return addr + LOCAL_HDiff;
|
||||
}
|
||||
|
||||
inline EXTERN void * CodeVoidPAdjust__ (void * CACHE_TYPE);
|
||||
@ -734,7 +734,7 @@ CodeVoidPAdjust__ (void * addr USES_REGS)
|
||||
{
|
||||
if (!addr)
|
||||
return NULL;
|
||||
return addr + HDiff;
|
||||
return addr + LOCAL_HDiff;
|
||||
}
|
||||
|
||||
inline EXTERN struct halt_hook *HaltHookAdjust__ (struct halt_hook * CACHE_TYPE);
|
||||
@ -744,7 +744,7 @@ HaltHookAdjust__ (struct halt_hook * addr USES_REGS)
|
||||
{
|
||||
if (!addr)
|
||||
return NULL;
|
||||
return (struct halt_hook *) (CharP (addr) + HDiff);
|
||||
return (struct halt_hook *) (CharP (addr) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
inline EXTERN BlockHeader *BlockAdjust__ (BlockHeader * CACHE_TYPE);
|
||||
@ -752,7 +752,7 @@ inline EXTERN BlockHeader *BlockAdjust__ (BlockHeader * CACHE_TYPE);
|
||||
inline EXTERN BlockHeader *
|
||||
BlockAdjust__ (BlockHeader * addr USES_REGS)
|
||||
{
|
||||
return (BlockHeader *) ((BlockHeader *) (CharP (addr) + HDiff));
|
||||
return (BlockHeader *) ((BlockHeader *) (CharP (addr) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
inline EXTERN yamop *PtoOpAdjust__ (yamop * CACHE_TYPE);
|
||||
@ -761,7 +761,7 @@ inline EXTERN yamop *
|
||||
PtoOpAdjust__ (yamop * ptr USES_REGS)
|
||||
{
|
||||
if (ptr)
|
||||
return (yamop *) (CharP (ptr) + HDiff);
|
||||
return (yamop *) (CharP (ptr) + LOCAL_HDiff);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -772,7 +772,7 @@ OpListAdjust__ (struct operator_entry * ptr USES_REGS)
|
||||
{
|
||||
if (!ptr)
|
||||
return ptr;
|
||||
return (struct operator_entry *) (CharP (ptr) + HDiff);
|
||||
return (struct operator_entry *) (CharP (ptr) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
|
||||
@ -781,7 +781,7 @@ inline EXTERN struct logic_upd_clause *PtoLUClauseAdjust__ (struct logic_upd_cla
|
||||
inline EXTERN struct logic_upd_clause *
|
||||
PtoLUClauseAdjust__ (struct logic_upd_clause * ptr USES_REGS)
|
||||
{
|
||||
return (struct logic_upd_clause *) (CharP (ptr) + HDiff);
|
||||
return (struct logic_upd_clause *) (CharP (ptr) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
inline EXTERN struct logic_upd_index *PtoLUIndexAdjust__ (struct logic_upd_index * CACHE_TYPE);
|
||||
@ -789,7 +789,7 @@ inline EXTERN struct logic_upd_index *PtoLUIndexAdjust__ (struct logic_upd_index
|
||||
inline EXTERN struct logic_upd_index *
|
||||
PtoLUIndexAdjust__ (struct logic_upd_index * ptr USES_REGS)
|
||||
{
|
||||
return (struct logic_upd_index *) (CharP (ptr) + HDiff);
|
||||
return (struct logic_upd_index *) (CharP (ptr) + LOCAL_HDiff);
|
||||
}
|
||||
|
||||
|
||||
@ -799,7 +799,7 @@ inline EXTERN CELL *PtoHeapCellAdjust__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN CELL *
|
||||
PtoHeapCellAdjust__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + HDiff)));
|
||||
return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN AtomHashEntry *PtoAtomHashEntryAdjust__ (AtomHashEntry * CACHE_TYPE);
|
||||
@ -807,7 +807,7 @@ inline EXTERN AtomHashEntry *PtoAtomHashEntryAdjust__ (AtomHashEntry * CACHE_TYP
|
||||
inline EXTERN AtomHashEntry *
|
||||
PtoAtomHashEntryAdjust__ (AtomHashEntry * ptr USES_REGS)
|
||||
{
|
||||
return (AtomHashEntry *) (((AtomHashEntry *) (CharP (ptr) + HDiff)));
|
||||
return (AtomHashEntry *) (((AtomHashEntry *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN Term TermToGlobalAdjust__ (Term CACHE_TYPE);
|
||||
@ -841,7 +841,7 @@ inline EXTERN opentry *OpRTableAdjust__ (opentry * CACHE_TYPE);
|
||||
inline EXTERN opentry *
|
||||
OpRTableAdjust__ (opentry * ptr USES_REGS)
|
||||
{
|
||||
return (opentry *) (((opentry *) (CharP (ptr) + HDiff)));
|
||||
return (opentry *) (((opentry *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN OpEntry *OpEntryAdjust__ (OpEntry * CACHE_TYPE);
|
||||
@ -849,7 +849,7 @@ inline EXTERN OpEntry *OpEntryAdjust__ (OpEntry * CACHE_TYPE);
|
||||
inline EXTERN OpEntry *
|
||||
OpEntryAdjust__ (OpEntry * ptr USES_REGS)
|
||||
{
|
||||
return (OpEntry *) (((OpEntry *) (CharP (ptr) + HDiff)));
|
||||
return (OpEntry *) (((OpEntry *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN PredEntry *PtoPredAdjust__ (PredEntry * CACHE_TYPE);
|
||||
@ -857,7 +857,7 @@ inline EXTERN PredEntry *PtoPredAdjust__ (PredEntry * CACHE_TYPE);
|
||||
inline EXTERN PredEntry *
|
||||
PtoPredAdjust__ (PredEntry * ptr USES_REGS)
|
||||
{
|
||||
return (PredEntry *) (((PredEntry *) (CharP (ptr) + HDiff)));
|
||||
return (PredEntry *) (((PredEntry *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
inline EXTERN PredEntry **PtoPtoPredAdjust__ (PredEntry ** CACHE_TYPE);
|
||||
@ -867,7 +867,7 @@ PtoPtoPredAdjust__ (PredEntry **ptr USES_REGS)
|
||||
{
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
return (PredEntry **) (((PredEntry **) (CharP (ptr) + HDiff)));
|
||||
return (PredEntry **) (((PredEntry **) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -879,7 +879,7 @@ PtoArrayEAdjust__ (ArrayEntry * ptr USES_REGS)
|
||||
{
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
return (ArrayEntry *) (((ArrayEntry *) (CharP (ptr) + HDiff)));
|
||||
return (ArrayEntry *) (((ArrayEntry *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -890,7 +890,7 @@ PtoGlobalEAdjust__ (GlobalEntry * ptr USES_REGS)
|
||||
{
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
return (GlobalEntry *) (((GlobalEntry *) (CharP (ptr) + HDiff)));
|
||||
return (GlobalEntry *) (((GlobalEntry *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -901,7 +901,7 @@ PtoArraySAdjust__ (StaticArrayEntry * ptr USES_REGS)
|
||||
{
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
return (StaticArrayEntry *) (((StaticArrayEntry *) (CharP (ptr) + HDiff)));
|
||||
return (StaticArrayEntry *) (((StaticArrayEntry *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -912,7 +912,7 @@ inline EXTERN struct logic_upd_clause *
|
||||
PtoLUCAdjust__ (struct logic_upd_clause *ptr USES_REGS)
|
||||
{
|
||||
return (struct logic_upd_clause
|
||||
*) (((struct logic_upd_clause *) (CharP (ptr) + HDiff)));
|
||||
*) (((struct logic_upd_clause *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -923,7 +923,7 @@ inline EXTERN struct static_clause *
|
||||
PtoStCAdjust__ (struct static_clause *ptr USES_REGS)
|
||||
{
|
||||
return (struct static_clause
|
||||
*) (((struct static_upd_clause *) (CharP (ptr) + HDiff)));
|
||||
*) (((struct static_upd_clause *) (CharP (ptr) + LOCAL_HDiff)));
|
||||
}
|
||||
|
||||
|
||||
@ -932,7 +932,7 @@ inline EXTERN struct dbterm_list *PtoDBTLAdjust__ (struct dbterm_list * CACHE_TY
|
||||
inline EXTERN struct dbterm_list *
|
||||
PtoDBTLAdjust__ (struct dbterm_list * addr USES_REGS)
|
||||
{
|
||||
return (struct dbterm_list *) ((ADDR) (CharP (addr) + HDiff));
|
||||
return (struct dbterm_list *) ((ADDR) (CharP (addr) + LOCAL_HDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -943,7 +943,7 @@ inline EXTERN wamreg XAdjust__ (wamreg CACHE_TYPE);
|
||||
inline EXTERN wamreg
|
||||
XAdjust__ (wamreg reg USES_REGS)
|
||||
{
|
||||
return (wamreg) ((wamreg) ((reg) + XDiff));
|
||||
return (wamreg) ((wamreg) ((reg) + LOCAL_XDiff));
|
||||
}
|
||||
|
||||
|
||||
@ -975,7 +975,7 @@ inline EXTERN int IsOldLocal__ (CELL CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldLocal__ (CELL reg USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldASP, reg, OldLCL0));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldASP, reg, LOCAL_OldLCL0));
|
||||
}
|
||||
|
||||
|
||||
@ -985,7 +985,7 @@ inline EXTERN int IsOldLocalPtr__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldLocalPtr__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldASP, ptr, OldLCL0));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldASP, ptr, LOCAL_OldLCL0));
|
||||
}
|
||||
|
||||
|
||||
@ -997,7 +997,7 @@ inline EXTERN int IsOldLocalInTR__ (CELL CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldLocalInTR__ (CELL reg USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldH, reg, OldLCL0));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldH, reg, LOCAL_OldLCL0));
|
||||
}
|
||||
|
||||
|
||||
@ -1007,7 +1007,7 @@ inline EXTERN int IsOldLocalInTRPtr__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldLocalInTRPtr__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldH, ptr, OldLCL0));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldH, ptr, LOCAL_OldLCL0));
|
||||
}
|
||||
|
||||
|
||||
@ -1018,7 +1018,7 @@ inline EXTERN int IsOldH__ (CELL CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldH__ (CELL reg USES_REGS)
|
||||
{
|
||||
return (int) ((CharP (reg) == CharP (OldH)));
|
||||
return (int) ((CharP (reg) == CharP (LOCAL_OldH)));
|
||||
}
|
||||
|
||||
|
||||
@ -1030,7 +1030,7 @@ inline EXTERN int IsOldGlobal__ (CELL CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldGlobal__ (CELL reg USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldGlobalBase, reg, OldH));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldGlobalBase, reg, LOCAL_OldH));
|
||||
}
|
||||
|
||||
|
||||
@ -1039,7 +1039,7 @@ inline EXTERN int IsOldDelay__ (CELL CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldDelay__ (CELL reg USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldGlobalBase, reg, OldH0));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldGlobalBase, reg, LOCAL_OldH0));
|
||||
}
|
||||
|
||||
|
||||
@ -1049,7 +1049,7 @@ inline EXTERN int IsOldGlobalPtr__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldGlobalPtr__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldGlobalBase, ptr, OldH));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldGlobalBase, ptr, LOCAL_OldH));
|
||||
}
|
||||
|
||||
|
||||
@ -1059,7 +1059,7 @@ inline EXTERN int IsOldTrail__ (CELL CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldTrail__ (CELL reg USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldTrailBase, reg, OldTR));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldTrailBase, reg, LOCAL_OldTR));
|
||||
}
|
||||
|
||||
|
||||
@ -1069,7 +1069,7 @@ inline EXTERN int IsOldTrailPtr__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldTrailPtr__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldTrailBase, ptr, OldTR));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldTrailBase, ptr, LOCAL_OldTR));
|
||||
}
|
||||
|
||||
|
||||
@ -1079,7 +1079,7 @@ inline EXTERN int IsOldVarTableTrailPtr__ (struct VARSTRUCT * CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldVarTableTrailPtr__ (struct VARSTRUCT *ptr USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldTrailBase, ptr, OldTR));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldTrailBase, ptr, LOCAL_OldTR));
|
||||
}
|
||||
|
||||
|
||||
@ -1089,7 +1089,7 @@ inline EXTERN int IsOldTokenTrailPtr__ (struct TOKEN * CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldTokenTrailPtr__ (struct TOKEN *ptr USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldTrailBase, ptr, OldTR));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldTrailBase, ptr, LOCAL_OldTR));
|
||||
}
|
||||
|
||||
|
||||
@ -1100,9 +1100,9 @@ inline EXTERN int
|
||||
IsOldCode__ (CELL reg USES_REGS)
|
||||
{
|
||||
#if USE_SYSTEM_MALLOC
|
||||
return reg < (CELL)OldGlobalBase || reg > (CELL)OldTrailTop;
|
||||
return reg < (CELL)LOCAL_OldGlobalBase || reg > (CELL)LOCAL_OldTrailTop;
|
||||
#else
|
||||
return (int) (IN_BETWEEN (OldHeapBase, reg, OldHeapTop));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldHeapBase, reg, LOCAL_OldHeapTop));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1113,7 +1113,7 @@ inline EXTERN int IsOldCodeCellPtr__ (CELL * CACHE_TYPE);
|
||||
inline EXTERN int
|
||||
IsOldCodeCellPtr__ (CELL * ptr USES_REGS)
|
||||
{
|
||||
return (int) (IN_BETWEEN (OldHeapBase, ptr, OldHeapTop));
|
||||
return (int) (IN_BETWEEN (LOCAL_OldHeapBase, ptr, LOCAL_OldHeapTop));
|
||||
}
|
||||
|
||||
|
||||
|
@ -265,7 +265,7 @@ chtype(Int ch)
|
||||
|
||||
|
||||
/* parser stack, used to be AuxSp, now is ASP */
|
||||
#define ParserAuxSp ScannerStack
|
||||
#define ParserAuxSp LOCAL_ScannerStack
|
||||
|
||||
/* routines in parser.c */
|
||||
VarEntry STD_PROTO(*Yap_LookupVar,(char *));
|
||||
|
@ -65,13 +65,13 @@ void make_root_choice_point(void) {
|
||||
this is tricky, we need to get the B from some other stack
|
||||
and convert back to our own stack;
|
||||
*/
|
||||
OldLCL0 = LCL0;
|
||||
LOCAL_OldLCL0 = LCL0;
|
||||
LCL0 = FOREIGN_ThreadHandle(0).current_yaam_regs->LCL0_;
|
||||
imageB = Get_Yap_root_cp();
|
||||
/* we know B */
|
||||
B->cp_tr = TR =
|
||||
(tr_fr_ptr)((CELL)(imageB->cp_tr)+((CELL)OldLCL0-(CELL)LCL0));
|
||||
LCL0 = OldLCL0;
|
||||
(tr_fr_ptr)((CELL)(imageB->cp_tr)+((CELL)LOCAL_OldLCL0-(CELL)LCL0));
|
||||
LCL0 = LOCAL_OldLCL0;
|
||||
}
|
||||
B->cp_h = H0;
|
||||
B->cp_ap = GETWORK;
|
||||
|
@ -931,7 +931,7 @@ typedef struct opcode_tab_entry {
|
||||
extern int optimizer_on;
|
||||
|
||||
/******************* the line for the current parse **********************/
|
||||
extern int StartLine;
|
||||
extern int LOCAL_StartLine;
|
||||
extern int StartCh;
|
||||
extern int CurFileNo;
|
||||
|
||||
|
@ -24,19 +24,19 @@
|
||||
|
||||
|
||||
/* The difference between the old stack pointers and the new ones */
|
||||
extern Int HDiff,
|
||||
GDiff,
|
||||
LDiff,
|
||||
TrDiff,
|
||||
XDiff,
|
||||
DelayDiff;
|
||||
extern Int LOCAL_HDiff,
|
||||
LOCAL_GDiff,
|
||||
LOCAL_LDiff,
|
||||
LOCAL_TrDiff,
|
||||
LOCAL_XDiff,
|
||||
LOCAL_DelayDiff;
|
||||
|
||||
/* The old stack pointers */
|
||||
extern CELL *OldASP, *OldLCL0;
|
||||
extern tr_fr_ptr OldTR;
|
||||
extern CELL *OldGlobalBase, *OldH, *OldH0;
|
||||
extern ADDR OldTrailBase, OldTrailTop;
|
||||
extern ADDR OldHeapBase, OldHeapTop;
|
||||
extern CELL *LOCAL_OldASP, *LOCAL_OldLCL0;
|
||||
extern tr_fr_ptr LOCAL_OldTR;
|
||||
extern CELL *LOCAL_OldGlobalBase, *LOCAL_OldH, *LOCAL_OldH0;
|
||||
extern ADDR LOCAL_OldTrailBase, LOCAL_OldTrailTop;
|
||||
extern ADDR LOCAL_OldHeapBase, LOCAL_OldHeapTop;
|
||||
|
||||
#define CharP(ptr) ((char *) (ptr))
|
||||
|
||||
@ -56,7 +56,7 @@ inline EXTERN CELL * PtoGloAdjust(CELL *);
|
||||
|
||||
inline EXTERN CELL * PtoGloAdjust(CELL * ptr)
|
||||
{
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + GDiff)) );
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + LOCAL_GDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ inline EXTERN CELL * PtoDelayAdjust(CELL *);
|
||||
|
||||
inline EXTERN CELL * PtoDelayAdjust(CELL * ptr)
|
||||
{
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + DelayDiff)) );
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + LOCAL_DelayDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ inline EXTERN tr_fr_ptr PtoTRAdjust(tr_fr_ptr);
|
||||
|
||||
inline EXTERN tr_fr_ptr PtoTRAdjust(tr_fr_ptr ptr)
|
||||
{
|
||||
return (tr_fr_ptr) (((tr_fr_ptr)(CharP(ptr) + TrDiff)) );
|
||||
return (tr_fr_ptr) (((tr_fr_ptr)(CharP(ptr) + LOCAL_TrDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ inline EXTERN CELL * CellPtoTRAdjust(CELL *);
|
||||
|
||||
inline EXTERN CELL * CellPtoTRAdjust(CELL * ptr)
|
||||
{
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + TrDiff)) );
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + LOCAL_TrDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ inline EXTERN CELL * PtoLocAdjust(CELL *);
|
||||
|
||||
inline EXTERN CELL * PtoLocAdjust(CELL * ptr)
|
||||
{
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + LDiff)) );
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + LOCAL_LDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ inline EXTERN choiceptr ChoicePtrAdjust(choiceptr);
|
||||
|
||||
inline EXTERN choiceptr ChoicePtrAdjust(choiceptr ptr)
|
||||
{
|
||||
return (choiceptr) (((choiceptr)(CharP(ptr) + LDiff)) );
|
||||
return (choiceptr) (((choiceptr)(CharP(ptr) + LOCAL_LDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ inline EXTERN choiceptr ConsumerChoicePtrAdjust(choiceptr);
|
||||
|
||||
inline EXTERN choiceptr ConsumerChoicePtrAdjust(choiceptr ptr)
|
||||
{
|
||||
return (choiceptr) (((choiceptr)(CharP(ptr) + LDiff)) );
|
||||
return (choiceptr) (((choiceptr)(CharP(ptr) + LOCAL_LDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ inline EXTERN choiceptr GeneratorChoicePtrAdjust(choiceptr);
|
||||
|
||||
inline EXTERN choiceptr GeneratorChoicePtrAdjust(choiceptr ptr)
|
||||
{
|
||||
return (choiceptr) (((choiceptr)(CharP(ptr) + LDiff)) );
|
||||
return (choiceptr) (((choiceptr)(CharP(ptr) + LOCAL_LDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ inline EXTERN CELL GlobalAdjust(CELL);
|
||||
|
||||
inline EXTERN CELL GlobalAdjust(CELL val)
|
||||
{
|
||||
return (CELL) ((val+GDiff) );
|
||||
return (CELL) ((val+LOCAL_GDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ inline EXTERN CELL DelayAdjust(CELL);
|
||||
|
||||
inline EXTERN CELL DelayAdjust(CELL val)
|
||||
{
|
||||
return (CELL) ((val+DelayDiff) );
|
||||
return (CELL) ((val+LOCAL_DelayDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ inline EXTERN ADDR GlobalAddrAdjust(ADDR);
|
||||
|
||||
inline EXTERN ADDR GlobalAddrAdjust(ADDR ptr)
|
||||
{
|
||||
return (ADDR) ((ptr+GDiff) );
|
||||
return (ADDR) ((ptr+LOCAL_GDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ inline EXTERN ADDR DelayAddrAdjust(ADDR);
|
||||
|
||||
inline EXTERN ADDR DelayAddrAdjust(ADDR ptr)
|
||||
{
|
||||
return (ADDR) ((ptr+DelayDiff) );
|
||||
return (ADDR) ((ptr+LOCAL_DelayDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ inline EXTERN CELL LocalAdjust(CELL);
|
||||
|
||||
inline EXTERN CELL LocalAdjust(CELL val)
|
||||
{
|
||||
return (CELL) ((val+LDiff) );
|
||||
return (CELL) ((val+LOCAL_LDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ inline EXTERN ADDR LocalAddrAdjust(ADDR);
|
||||
|
||||
inline EXTERN ADDR LocalAddrAdjust(ADDR ptr)
|
||||
{
|
||||
return (ADDR) ((ptr+LDiff) );
|
||||
return (ADDR) ((ptr+LOCAL_LDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ inline EXTERN CELL TrailAdjust(CELL);
|
||||
|
||||
inline EXTERN CELL TrailAdjust(CELL val)
|
||||
{
|
||||
return (CELL) ((val+TrDiff) );
|
||||
return (CELL) ((val+LOCAL_TrDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ inline EXTERN ADDR TrailAddrAdjust(ADDR);
|
||||
|
||||
inline EXTERN ADDR TrailAddrAdjust(ADDR ptr)
|
||||
{
|
||||
return (ADDR) ((ptr+TrDiff) );
|
||||
return (ADDR) ((ptr+LOCAL_TrDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ inline EXTERN Functor FuncAdjust(Functor);
|
||||
|
||||
inline EXTERN Functor FuncAdjust(Functor f)
|
||||
{
|
||||
return (Functor) ((Functor)(CharP(f)+HDiff) );
|
||||
return (Functor) ((Functor)(CharP(f)+LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -213,7 +213,7 @@ inline EXTERN CELL * CellPtoHeapAdjust(CELL *);
|
||||
|
||||
inline EXTERN CELL * CellPtoHeapAdjust(CELL * ptr)
|
||||
{
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + HDiff)) );
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + LOCAL_HDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -242,7 +242,7 @@ inline EXTERN Atom AtomAdjust(Atom);
|
||||
|
||||
inline EXTERN Atom AtomAdjust(Atom at)
|
||||
{
|
||||
return (Atom) ((at == NULL ? (at) : (Atom)(CharP(at)+HDiff) ));
|
||||
return (Atom) ((at == NULL ? (at) : (Atom)(CharP(at)+LOCAL_HDiff) ));
|
||||
}
|
||||
|
||||
|
||||
@ -251,7 +251,7 @@ inline EXTERN Prop PropAdjust(Prop);
|
||||
|
||||
inline EXTERN Prop PropAdjust(Prop p)
|
||||
{
|
||||
return (Prop) ((p == NULL ? (p) : (Prop)(CharP(p)+HDiff)) );
|
||||
return (Prop) ((p == NULL ? (p) : (Prop)(CharP(p)+LOCAL_HDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -271,7 +271,7 @@ inline EXTERN Term BlobTermAdjust(Term);
|
||||
|
||||
inline EXTERN Term BlobTermAdjust(Term t)
|
||||
{
|
||||
return (Term) ((t-HDiff) );
|
||||
return (Term) ((t-LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -281,7 +281,7 @@ inline EXTERN Term BlobTermAdjust(Term);
|
||||
|
||||
inline EXTERN Term BlobTermAdjust(Term t)
|
||||
{
|
||||
return (Term) ((t+HDiff) );
|
||||
return (Term) ((t+LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -291,7 +291,7 @@ inline EXTERN AtomEntry * AtomEntryAdjust(AtomEntry *);
|
||||
|
||||
inline EXTERN AtomEntry * AtomEntryAdjust(AtomEntry * at)
|
||||
{
|
||||
return (AtomEntry *) ((AtomEntry *)(CharP(at)+HDiff) );
|
||||
return (AtomEntry *) ((AtomEntry *)(CharP(at)+LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -300,7 +300,7 @@ inline EXTERN union CONSULT_OBJ * ConsultObjAdjust(union CONSULT_OBJ *);
|
||||
|
||||
inline EXTERN union CONSULT_OBJ * ConsultObjAdjust(union CONSULT_OBJ * co)
|
||||
{
|
||||
return (union CONSULT_OBJ *) ((union CONSULT_OBJ *)(CharP(co)+HDiff) );
|
||||
return (union CONSULT_OBJ *) ((union CONSULT_OBJ *)(CharP(co)+LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -309,7 +309,7 @@ inline EXTERN DBRef DBRefAdjust(DBRef);
|
||||
|
||||
inline EXTERN DBRef DBRefAdjust(DBRef dbr)
|
||||
{
|
||||
return (DBRef) ((DBRef)(CharP(dbr)+HDiff) );
|
||||
return (DBRef) ((DBRef)(CharP(dbr)+LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -318,7 +318,7 @@ inline EXTERN Term CodeAdjust(Term);
|
||||
|
||||
inline EXTERN Term CodeAdjust(Term dbr)
|
||||
{
|
||||
return (Term) (((Term)(dbr)+HDiff) );
|
||||
return (Term) (((Term)(dbr)+LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -327,7 +327,7 @@ inline EXTERN ADDR AddrAdjust(ADDR);
|
||||
|
||||
inline EXTERN ADDR AddrAdjust(ADDR addr)
|
||||
{
|
||||
return (ADDR) ((ADDR)(CharP(addr)+HDiff) );
|
||||
return (ADDR) ((ADDR)(CharP(addr)+LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -336,7 +336,7 @@ inline EXTERN CODEADDR CodeAddrAdjust(CODEADDR);
|
||||
|
||||
inline EXTERN CODEADDR CodeAddrAdjust(CODEADDR addr)
|
||||
{
|
||||
return (CODEADDR) ((CODEADDR)(CharP(addr)+HDiff) );
|
||||
return (CODEADDR) ((CODEADDR)(CharP(addr)+LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -345,7 +345,7 @@ inline EXTERN BlockHeader * BlockAdjust(BlockHeader *);
|
||||
|
||||
inline EXTERN BlockHeader * BlockAdjust(BlockHeader * addr)
|
||||
{
|
||||
return (BlockHeader *) ((BlockHeader *)(CharP(addr)+HDiff) );
|
||||
return (BlockHeader *) ((BlockHeader *)(CharP(addr)+LOCAL_HDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -354,7 +354,7 @@ inline EXTERN yamop * PtoOpAdjust(yamop *);
|
||||
|
||||
inline EXTERN yamop * PtoOpAdjust(yamop * ptr)
|
||||
{
|
||||
return (yamop *) (((yamop *)(CharP(ptr) + HDiff)) );
|
||||
return (yamop *) (((yamop *)(CharP(ptr) + LOCAL_HDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -363,7 +363,7 @@ inline EXTERN CELL * PtoHeapCellAdjust(CELL *);
|
||||
|
||||
inline EXTERN CELL * PtoHeapCellAdjust(CELL * ptr)
|
||||
{
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + HDiff)) );
|
||||
return (CELL *) (((CELL *)(CharP(ptr) + LOCAL_HDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -372,7 +372,7 @@ inline EXTERN PredEntry * PtoPredAdjust(PredEntry *);
|
||||
|
||||
inline EXTERN PredEntry * PtoPredAdjust(PredEntry * ptr)
|
||||
{
|
||||
return (PredEntry *) (((PredEntry *)(CharP(ptr) + HDiff)) );
|
||||
return (PredEntry *) (((PredEntry *)(CharP(ptr) + LOCAL_HDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -381,7 +381,7 @@ inline EXTERN ArrayEntry * PtoArrayEAdjust(ArrayEntry *);
|
||||
|
||||
inline EXTERN ArrayEntry * PtoArrayEAdjust(ArrayEntry * ptr)
|
||||
{
|
||||
return (ArrayEntry *) (((ArrayEntry *)(CharP(ptr) + HDiff)) );
|
||||
return (ArrayEntry *) (((ArrayEntry *)(CharP(ptr) + LOCAL_HDiff)) );
|
||||
}
|
||||
|
||||
|
||||
@ -391,7 +391,7 @@ inline EXTERN AREG XAdjust(AREG);
|
||||
|
||||
inline EXTERN AREG XAdjust(AREG reg)
|
||||
{
|
||||
return (AREG) ((AREG)((reg)+XDiff) );
|
||||
return (AREG) ((AREG)((reg)+LOCAL_XDiff) );
|
||||
}
|
||||
|
||||
|
||||
@ -421,7 +421,7 @@ inline EXTERN int IsOldLocal(CELL);
|
||||
|
||||
inline EXTERN int IsOldLocal(CELL reg)
|
||||
{
|
||||
return (int) (IN_BETWEEN(OldASP, reg, OldLCL0));
|
||||
return (int) (IN_BETWEEN(LOCAL_OldASP, reg, LOCAL_OldLCL0));
|
||||
}
|
||||
|
||||
|
||||
@ -432,7 +432,7 @@ inline EXTERN int IsOldLocalInTR(CELL);
|
||||
|
||||
inline EXTERN int IsOldLocalInTR(CELL reg)
|
||||
{
|
||||
return (int) (IN_BETWEEN(OldH, reg, OldLCL0) );
|
||||
return (int) (IN_BETWEEN(LOCAL_OldH, reg, LOCAL_OldLCL0) );
|
||||
}
|
||||
|
||||
|
||||
@ -441,7 +441,7 @@ inline EXTERN int IsOldLocalInTRPtr(CELL *);
|
||||
|
||||
inline EXTERN int IsOldLocalInTRPtr(CELL * ptr)
|
||||
{
|
||||
return (int) (IN_BETWEEN(OldH, ptr, OldLCL0) );
|
||||
return (int) (IN_BETWEEN(LOCAL_OldH, ptr, LOCAL_OldLCL0) );
|
||||
}
|
||||
|
||||
|
||||
@ -451,7 +451,7 @@ inline EXTERN int IsOldH(CELL);
|
||||
|
||||
inline EXTERN int IsOldH(CELL reg)
|
||||
{
|
||||
return (int) (( CharP(reg) == CharP(OldH) ) );
|
||||
return (int) (( CharP(reg) == CharP(LOCAL_OldH) ) );
|
||||
}
|
||||
|
||||
|
||||
@ -462,7 +462,7 @@ inline EXTERN int IsOldGlobal(CELL);
|
||||
|
||||
inline EXTERN int IsOldGlobal(CELL reg)
|
||||
{
|
||||
return (int) (IN_BETWEEN(OldH0, reg, OldH) );
|
||||
return (int) (IN_BETWEEN(LOCAL_OldH0, reg, LOCAL_OldH) );
|
||||
}
|
||||
|
||||
|
||||
@ -471,7 +471,7 @@ inline EXTERN int IsOldGlobalPtr(CELL *);
|
||||
|
||||
inline EXTERN int IsOldGlobalPtr(CELL * ptr)
|
||||
{
|
||||
return (int) (IN_BETWEEN( OldH0, ptr, OldH) );
|
||||
return (int) (IN_BETWEEN( LOCAL_OldH0, ptr, LOCAL_OldH) );
|
||||
}
|
||||
|
||||
|
||||
@ -480,7 +480,7 @@ inline EXTERN int IsOldDelay(CELL);
|
||||
|
||||
inline EXTERN int IsOldDelay(CELL reg)
|
||||
{
|
||||
return (int) (IN_BETWEEN(OldGlobalBase, reg, OldH0) );
|
||||
return (int) (IN_BETWEEN(LOCAL_OldGlobalBase, reg, LOCAL_OldH0) );
|
||||
}
|
||||
|
||||
|
||||
@ -489,7 +489,7 @@ inline EXTERN int IsOldDelayPtr(CELL *);
|
||||
|
||||
inline EXTERN int IsOldDelayPtr(CELL * ptr)
|
||||
{
|
||||
return (int) (IN_BETWEEN( OldGlobalBase, ptr, OldH0) );
|
||||
return (int) (IN_BETWEEN( LOCAL_OldGlobalBase, ptr, LOCAL_OldH0) );
|
||||
}
|
||||
|
||||
|
||||
@ -498,7 +498,7 @@ inline EXTERN int IsOldTrail(CELL);
|
||||
|
||||
inline EXTERN int IsOldTrail(CELL reg)
|
||||
{
|
||||
return (int) (IN_BETWEEN(OldTrailBase, reg, OldTR) );
|
||||
return (int) (IN_BETWEEN(LOCAL_OldTrailBase, reg, LOCAL_OldTR) );
|
||||
}
|
||||
|
||||
|
||||
@ -507,7 +507,7 @@ inline EXTERN int IsOldTrailPtr(CELL *);
|
||||
|
||||
inline EXTERN int IsOldTrailPtr(CELL * ptr)
|
||||
{
|
||||
return (int) (IN_BETWEEN(OldTrailBase, ptr, OldTR) );
|
||||
return (int) (IN_BETWEEN(LOCAL_OldTrailBase, ptr, LOCAL_OldTR) );
|
||||
}
|
||||
|
||||
|
||||
@ -516,7 +516,7 @@ inline EXTERN int IsOldCode(CELL);
|
||||
|
||||
inline EXTERN int IsOldCode(CELL reg)
|
||||
{
|
||||
return (int) (IN_BETWEEN(OldHeapBase, reg, OldHeapTop) );
|
||||
return (int) (IN_BETWEEN(LOCAL_OldHeapBase, reg, LOCAL_OldHeapTop) );
|
||||
}
|
||||
|
||||
|
||||
@ -525,7 +525,7 @@ inline EXTERN int IsOldCodeCellPtr(CELL *);
|
||||
|
||||
inline EXTERN int IsOldCodeCellPtr(CELL * ptr)
|
||||
{
|
||||
return (int) (IN_BETWEEN(OldHeapBase, ptr, OldHeapTop) );
|
||||
return (int) (IN_BETWEEN(LOCAL_OldHeapBase, ptr, LOCAL_OldHeapTop) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ X_API int PL_throw(term_t exception)
|
||||
{
|
||||
CACHE_REGS
|
||||
YAP_Throw(Yap_GetFromSlot(exception PASS_REGS));
|
||||
longjmp(execution->env, 0);
|
||||
longjmp(LOCAL_execution->env, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2133,14 +2133,14 @@ PL_open_foreign_frame(void)
|
||||
CACHE_REGS
|
||||
open_query *new = (open_query *)malloc(sizeof(open_query));
|
||||
if (!new) return 0;
|
||||
new->old = execution;
|
||||
new->old = LOCAL_execution;
|
||||
new->g = TermNil;
|
||||
new->open = FALSE;
|
||||
new->cp = CP;
|
||||
new->p = P;
|
||||
new->b = (CELL)(LCL0-(CELL*)B);
|
||||
new->slots = CurSlot;
|
||||
execution = new;
|
||||
LOCAL_execution = new;
|
||||
{
|
||||
/* initialise a new marker choicepoint */
|
||||
choiceptr cp_b = ((choiceptr)ASP)-1;
|
||||
@ -2168,7 +2168,7 @@ PL_close_foreign_frame(fid_t f)
|
||||
CurSlot = env->slots;
|
||||
B = (choiceptr)(LCL0-env->b);
|
||||
ASP = (CELL *)(LCL0-CurSlot);
|
||||
execution = env->old;
|
||||
LOCAL_execution = env->old;
|
||||
free(env);
|
||||
}
|
||||
|
||||
@ -2200,9 +2200,9 @@ PL_discard_foreign_frame(fid_t f)
|
||||
{
|
||||
CACHE_REGS
|
||||
open_query *env = (open_query *)f;
|
||||
if (execution != env) {
|
||||
if (LOCAL_execution != env) {
|
||||
/* handle the case where we do not want to kill the last open frame */
|
||||
open_query *env0 = execution;
|
||||
open_query *env0 = LOCAL_execution;
|
||||
while (env0 && env0 != env) env0 = env0->old;
|
||||
if (!env0)
|
||||
return;
|
||||
@ -2213,7 +2213,7 @@ PL_discard_foreign_frame(fid_t f)
|
||||
backtrack();
|
||||
CP = env->cp;
|
||||
P = env->p;
|
||||
execution = env->old;
|
||||
LOCAL_execution = env->old;
|
||||
ASP = LCL0-CurSlot;
|
||||
B = B->cp_b;
|
||||
free(env);
|
||||
@ -2228,8 +2228,8 @@ X_API qid_t PL_open_query(module_t ctx, int flags, predicate_t p, term_t t0)
|
||||
|
||||
/* ignore flags and module for now */
|
||||
PL_open_foreign_frame();
|
||||
execution->open=1;
|
||||
execution->state=0;
|
||||
LOCAL_execution->open=1;
|
||||
LOCAL_execution->state=0;
|
||||
PredicateInfo((PredEntry *)p, &yname, &arity, &m);
|
||||
t[0] = SWIModuleToModule(ctx);
|
||||
if (arity == 0) {
|
||||
@ -2243,19 +2243,19 @@ X_API qid_t PL_open_query(module_t ctx, int flags, predicate_t p, term_t t0)
|
||||
t[0] = MkAtomTerm((Atom)ctx);
|
||||
ti = Yap_MkApplTerm(FunctorModule,2,t);
|
||||
t[0] = ti;
|
||||
execution->g = Yap_MkApplTerm(FunctorCall,1,t);
|
||||
LOCAL_execution->g = Yap_MkApplTerm(FunctorCall,1,t);
|
||||
} else {
|
||||
if (m && m != CurrentModule) {
|
||||
Term ti;
|
||||
t[0] = m;
|
||||
ti = Yap_MkApplTerm(FunctorModule,2,t);
|
||||
t[0] = ti;
|
||||
execution->g = Yap_MkApplTerm(FunctorCall,1,t);
|
||||
LOCAL_execution->g = Yap_MkApplTerm(FunctorCall,1,t);
|
||||
} else {
|
||||
execution->g = t[1];
|
||||
LOCAL_execution->g = t[1];
|
||||
}
|
||||
}
|
||||
return execution;
|
||||
return LOCAL_execution;
|
||||
}
|
||||
|
||||
X_API int PL_next_solution(qid_t qi)
|
||||
@ -2263,12 +2263,12 @@ X_API int PL_next_solution(qid_t qi)
|
||||
CACHE_REGS
|
||||
int result;
|
||||
if (qi->open != 1) return 0;
|
||||
if (setjmp(execution->env))
|
||||
if (setjmp(LOCAL_execution->env))
|
||||
return 0;
|
||||
if (qi->state == 0) {
|
||||
result = YAP_RunGoal(qi->g);
|
||||
} else {
|
||||
Yap_AllowRestart = qi->open;
|
||||
LOCAL_AllowRestart = qi->open;
|
||||
result = YAP_RestartGoal();
|
||||
}
|
||||
qi->state = 1;
|
||||
|
219
misc/LOCALS
219
misc/LOCALS
@ -2,157 +2,150 @@
|
||||
START_WORKER_LOCAL
|
||||
|
||||
// Streams
|
||||
int c_input_stream Yap_c_input_stream =0
|
||||
int c_output_stream Yap_c_output_stream =1
|
||||
int c_error_stream Yap_c_error_stream =2
|
||||
int c_input_stream LOCAL_c_input_stream =0
|
||||
int c_output_stream LOCAL_c_output_stream =1
|
||||
int c_error_stream LOCAL_c_error_stream =2
|
||||
|
||||
/* shifts and restore: per local data-structure */
|
||||
restoreinfo rinfo
|
||||
. rinfo.old_ASP OldASP =NULL
|
||||
. rinfo.old_LCL0 OldLCL0 =NULL
|
||||
. rinfo.old_TR OldTR =NULL
|
||||
. rinfo.old_GlobalBase OldGlobalBase =NULL
|
||||
. rinfo.old_H OldH =NULL
|
||||
. rinfo.old_H0 OldH0 =NULL
|
||||
. rinfo.old_TrailBase OldTrailBase =NULL
|
||||
. rinfo.old_TrailTop OldTrailTop =NULL
|
||||
. rinfo.old_HeapBase OldHeapBase =NULL
|
||||
. rinfo.old_HeapTop OldHeapTop =NULL
|
||||
. rinfo.cl_diff ClDiff =0L
|
||||
. rinfo.g_diff GDiff =0L
|
||||
. rinfo.h_diff HDiff =0L
|
||||
. rinfo.g_diff0 GDiff0 =0L
|
||||
. rinfo.g_split GSplit =NULL
|
||||
. rinfo.l_diff LDiff =0L
|
||||
. rinfo.tr_diff TrDiff =0L
|
||||
. rinfo.x_diff XDiff =0L
|
||||
. rinfo.delay_diff DelayDiff =0L
|
||||
. rinfo.base_diff BaseDiff =0L
|
||||
. rinfo.old_ASP LOCAL_OldASP =NULL
|
||||
. rinfo.old_LCL0 LOCAL_OldLCL0 =NULL
|
||||
. rinfo.old_TR LOCAL_OldTR =NULL
|
||||
. rinfo.old_GlobalBase LOCAL_OldGlobalBase =NULL
|
||||
. rinfo.old_H LOCAL_OldH =NULL
|
||||
. rinfo.old_H0 LOCAL_OldH0 =NULL
|
||||
. rinfo.old_TrailBase LOCAL_OldTrailBase =NULL
|
||||
. rinfo.old_TrailTop LOCAL_OldTrailTop =NULL
|
||||
. rinfo.old_HeapBase LOCAL_OldHeapBase =NULL
|
||||
. rinfo.old_HeapTop LOCAL_OldHeapTop =NULL
|
||||
. rinfo.cl_diff LOCAL_ClDiff =0L
|
||||
. rinfo.g_diff LOCAL_GDiff =0L
|
||||
. rinfo.h_diff LOCAL_HDiff =0L
|
||||
. rinfo.g_diff0 LOCAL_GDiff0 =0L
|
||||
. rinfo.g_split LOCAL_GSplit =NULL
|
||||
. rinfo.l_diff LOCAL_LDiff =0L
|
||||
. rinfo.tr_diff LOCAL_TrDiff =0L
|
||||
. rinfo.x_diff LOCAL_XDiff =0L
|
||||
. rinfo.delay_diff LOCAL_DelayDiff =0L
|
||||
. rinfo.base_diff LOCAL_BaseDiff =0L
|
||||
|
||||
struct reduction_counters call_counters
|
||||
. call_counters.reductions ReductionsCounter =0L
|
||||
. call_counters.reductions_retries PredEntriesCounter =0L
|
||||
. call_counters.retries RetriesCounter =0L
|
||||
. call_counters.reductions_on ReductionsCounterOn =0L
|
||||
. call_counters.reductions_retries_on PredEntriesCounterOn =0L
|
||||
. call_counters.retries_on RetriesCounterOn =0L
|
||||
. call_counters.reductions LOCAL_ReductionsCounter =0L
|
||||
. call_counters.reductions_retries LOCAL_PredEntriesCounter =0L
|
||||
. call_counters.retries LOCAL_RetriesCounter =0L
|
||||
. call_counters.reductions_on LOCAL_ReductionsCounterOn =0L
|
||||
. call_counters.reductions_retries_on LOCAL_PredEntriesCounterOn =0L
|
||||
. call_counters.retries_on LOCAL_RetriesCounterOn =0L
|
||||
|
||||
int interrupts_disabled Yap_InterruptsDisabled =FALSE
|
||||
int interrupts_disabled LOCAL_InterruptsDisabled =FALSE
|
||||
|
||||
// support for consulting files
|
||||
/* current consult stack */
|
||||
union CONSULT_OBJ* consultsp ConsultSp =NULL
|
||||
union CONSULT_OBJ* consultsp LOCAL_ConsultSp =NULL
|
||||
/* current maximum number of cells in consult stack */
|
||||
UInt consultcapacity ConsultCapacity void
|
||||
UInt consultcapacity LOCAL_ConsultCapacity void
|
||||
/* top of consult stack */
|
||||
union CONSULT_OBJ* consultbase ConsultBase =NULL
|
||||
union CONSULT_OBJ* consultbase LOCAL_ConsultBase =NULL
|
||||
/* low-water mark for consult */
|
||||
union CONSULT_OBJ* consultlow ConsultLow =NULL
|
||||
union CONSULT_OBJ* consultlow LOCAL_ConsultLow =NULL
|
||||
|
||||
//global variables
|
||||
Term global_arena GlobalArena =0L TermToGlobalOrAtomAdjust
|
||||
UInt global_arena_overflows GlobalArenaOverflows =0L
|
||||
Int delay_arena_overflows DelayArenaOverflows =0L
|
||||
Int arena_overflows ArenaOverflows =0L
|
||||
Int depth_arenas DepthArenas =0
|
||||
Term global_arena LOCAL_GlobalArena =0L TermToGlobalOrAtomAdjust
|
||||
UInt global_arena_overflows LOCAL_GlobalArenaOverflows =0L
|
||||
Int arena_overflows LOCAL_ArenaOverflows =0L
|
||||
Int depth_arenas LOCAL_DepthArenas =0
|
||||
|
||||
int arith_error ArithError =FALSE
|
||||
struct pred_entry* last_asserted_pred LastAssertedPred =NULL
|
||||
int debug_on DebugOn =FALSE
|
||||
struct format_status* f_info FormatInfo =NULL
|
||||
char* scanner_stack ScannerStack =NULL
|
||||
struct scanner_extra_alloc* scanner_extra_blocks ScannerExtraBlocks =NULL
|
||||
struct DB_TERM *ball_term BallTerm =NULL RestoreBallTerm(wid)
|
||||
UInt active_signals ActiveSignals =0L
|
||||
UInt i_pred_arity IPredArity =0L
|
||||
yamop* prof_end ProfEnd =NULL
|
||||
int uncaught_throw UncaughtThrow =FALSE
|
||||
int doing_undefp DoingUndefp =FALSE
|
||||
Int start_line StartLine =0L
|
||||
scratch_block scratchpad ScratchPad InitScratchPad(wid)
|
||||
int arith_error LOCAL_ArithError =FALSE
|
||||
struct pred_entry* last_asserted_pred LOCAL_LastAssertedPred =NULL
|
||||
int debug_on LOCAL_DebugOn =FALSE
|
||||
char* scanner_stack LOCAL_ScannerStack =NULL
|
||||
struct scanner_extra_alloc* scanner_extra_blocks LOCAL_ScannerExtraBlocks =NULL
|
||||
struct DB_TERM* ball_term LOCAL_BallTerm =NULL RestoreBallTerm(wid)
|
||||
UInt active_signals LOCAL_ActiveSignals =0L
|
||||
UInt i_pred_arity LOCAL_IPredArity =0L
|
||||
yamop* prof_end LOCAL_ProfEnd =NULL
|
||||
int uncaught_throw LOCAL_UncaughtThrow =FALSE
|
||||
int doing_undefp LOCAL_DoingUndefp =FALSE
|
||||
Int start_line LOCAL_StartLine =0L
|
||||
scratch_block scratchpad LOCAL_ScratchPad InitScratchPad(wid)
|
||||
#ifdef COROUTINING
|
||||
Term woken_goals WokenGoals =0L TermToGlobalAdjust
|
||||
Term atts_mutable_list AttsMutableList =0L TermToGlobalAdjust
|
||||
Term woken_goals LOCAL_WokenGoals =0L TermToGlobalAdjust
|
||||
Term atts_mutable_list LOCAL_AttsMutableList =0L TermToGlobalAdjust
|
||||
#endif
|
||||
|
||||
// gc_stuff
|
||||
Term gc_generation GcGeneration =0L TermToGlobalAdjust
|
||||
Term gc_phase GcPhase =0L TermToGlobalAdjust
|
||||
UInt gc_current_phase GcCurrentPhase =0L
|
||||
UInt gc_calls GcCalls =0L
|
||||
Int tot_gc_time TotGcTime =0L
|
||||
YAP_ULONG_LONG tot_gc_recovered TotGcRecovered =0L
|
||||
Int last_gc_time LastGcTime =0L
|
||||
Int last_ss_time LastSSTime =0L
|
||||
Term gc_generation LOCAL_GcGeneration =0L TermToGlobalAdjust
|
||||
Term gc_phase LOCAL_GcPhase =0L TermToGlobalAdjust
|
||||
UInt gc_current_phase LOCAL_GcCurrentPhase =0L
|
||||
UInt gc_calls LOCAL_GcCalls =0L
|
||||
Int tot_gc_time LOCAL_TotGcTime =0L
|
||||
YAP_ULONG_LONG tot_gc_recovered LOCAL_TotGcRecovered =0L
|
||||
Int last_gc_time LOCAL_LastGcTime =0L
|
||||
Int last_ss_time LOCAL_LastSSTime =0L
|
||||
|
||||
#if LOW_LEVEL_TRACER
|
||||
Int total_cps Yap_total_choicepoints =0
|
||||
Int total_cps LOCAL_total_choicepoints =0
|
||||
#endif
|
||||
|
||||
int consult_level_ consult_level =0
|
||||
int consult_level_ LOCAL_consult_level =0
|
||||
|
||||
// global variables that cannot be global in a thread/or-p implementation
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar signal_lock SignalLock MkLock
|
||||
struct pred_entry* wpp WPP =NULL
|
||||
lockvar signal_lock LOCAL_SignalLock MkLock
|
||||
#endif
|
||||
/* in a single gc */
|
||||
Int tot_marked total_marked =0L
|
||||
Int tot_oldies total_oldies =0L
|
||||
#if DEBUG && COROUTINING
|
||||
UInt tot_smarked total_smarked =0L
|
||||
Int tot_marked LOCAL_total_marked =0L
|
||||
Int tot_oldies LOCAL_total_oldies =0L
|
||||
struct choicept* wl_current_B LOCAL_current_B =NULL
|
||||
CELL* wl_prev_HB LOCAL_prev_HB =NULL
|
||||
CELL* hgen LOCAL_HGEN =NULL
|
||||
CELL** ip_top LOCAL_iptop =NULL
|
||||
//#endif
|
||||
#if defined(GC_NO_TAGS)
|
||||
char* b_p LOCAL_bp =NULL
|
||||
#endif
|
||||
struct choicept *wl_current_B current_B =NULL
|
||||
CELL* wl_prev_HB prev_HB =NULL
|
||||
CELL* hgen HGEN =NULL
|
||||
CELL** ip_top iptop =NULL
|
||||
#if GC_NO_TAGS
|
||||
char* b_p Yap_bp =NULL
|
||||
#endif
|
||||
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||
struct trail_frame* wl_sTR sTR =NULL
|
||||
struct trail_frame* wl_sTR0 sTR0 =NULL
|
||||
struct trail_frame* new_tr new_TR =NULL
|
||||
|
||||
#if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
|
||||
Term* wl_sTR LOCAL_sTR =NULL
|
||||
Term* wl_sTR0 LOCAL_sTR0 =NULL
|
||||
Term* new_tr LOCAL_new_TR =NULL
|
||||
#else
|
||||
Term *wl_sTR sTR =NULL
|
||||
Term *wl_sTR0 sTR0 =NULL
|
||||
Term *new_tr new_TR =NULL
|
||||
#endif
|
||||
struct gc_mark_continuation* conttop0 cont_top0 =NULL
|
||||
struct gc_mark_continuation* conttop cont_top =NULL
|
||||
int disc_trail_entries discard_trail_entries =0
|
||||
gc_ma_hash_entry Gc_ma_hash_table[GC_MAVARS_HASH_SIZE] gc_ma_hash_table void
|
||||
gc_ma_hash_entry* Gc_ma_h_top gc_ma_h_top =NULL
|
||||
gc_ma_hash_entry* Gc_ma_h_list gc_ma_h_list =NULL
|
||||
UInt Gc_timestamp gc_timestamp =0L
|
||||
ADDR DB_vec db_vec =NULL
|
||||
ADDR DB_vec0 db_vec0 =NULL
|
||||
struct RB_red_blk_node* DB_root db_root =NULL
|
||||
struct RB_red_blk_node* DB_nil db_nil =NULL
|
||||
#endif /* defined(YAPOR) || defined(THREADS) */
|
||||
struct trail_frame* wl_sTR LOCAL_sTR =NULL
|
||||
struct trail_frame* wl_sTR0 LOCAL_sTR0 =NULL
|
||||
struct trail_frame* new_tr LOCAL_new_TR =NULL
|
||||
#endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
|
||||
struct gc_mark_continuation* conttop0 LOCAL_cont_top0 =NULL
|
||||
struct gc_mark_continuation* conttop LOCAL_cont_top =NULL
|
||||
int disc_trail_entries LOCAL_discard_trail_entries =0
|
||||
gc_ma_hash_entry Gc_ma_hash_table[GC_MAVARS_HASH_SIZE] LOCAL_gc_ma_hash_table void
|
||||
gc_ma_hash_entry* Gc_ma_h_top LOCAL_gc_ma_h_top =NULL
|
||||
gc_ma_hash_entry* Gc_ma_h_list LOCAL_gc_ma_h_list =NULL
|
||||
UInt Gc_timestamp LOCAL_gc_timestamp =0L
|
||||
ADDR DB_vec LOCAL_db_vec =NULL
|
||||
ADDR DB_vec0 LOCAL_db_vec0 =NULL
|
||||
struct RB_red_blk_node* DB_root LOCAL_db_root =NULL
|
||||
struct RB_red_blk_node* DB_nil LOCAL_db_nil =NULL
|
||||
|
||||
|
||||
sigjmp_buf gc_restore Yap_gc_restore void
|
||||
struct array_entry* dynamic_arrays DynamicArrays =NULL PtoArrayEAdjust
|
||||
struct static_array_entry* static_arrays StaticArrays =NULL PtoArraySAdjust
|
||||
struct global_entry* global_variables GlobalVariables =NULL PtoGlobalEAdjust
|
||||
int allow_restart Yap_AllowRestart =FALSE
|
||||
sigjmp_buf gc_restore LOCAL_gc_restore void
|
||||
struct array_entry* dynamic_arrays LOCAL_DynamicArrays =NULL PtoArrayEAdjust
|
||||
struct static_array_entry* static_arrays LOCAL_StaticArrays =NULL PtoArraySAdjust
|
||||
struct global_entry* global_variables LOCAL_GlobalVariables =NULL PtoGlobalEAdjust
|
||||
int allow_restart LOCAL_AllowRestart =FALSE
|
||||
|
||||
// Thread Local Area for Fast Storage of Intermediate Compiled Code.
|
||||
struct mem_blk* cmem_first_block Yap_CMemFirstBlock =NULL
|
||||
UInt cmem_first_block_sz Yap_CMemFirstBlockSz =0L
|
||||
struct mem_blk* cmem_first_block LOCAL_CMemFirstBlock =NULL
|
||||
UInt cmem_first_block_sz LOCAL_CMemFirstBlockSz =0L
|
||||
|
||||
// Thread Local Area for Labels.
|
||||
Int* label_first_array Yap_LabelFirstArray =NULL
|
||||
UInt label_first_array_sz Yap_LabelFirstArraySz =0L
|
||||
Int* label_first_array LOCAL_LabelFirstArray =NULL
|
||||
UInt label_first_array_sz LOCAL_LabelFirstArraySz =0L
|
||||
|
||||
// Thread Local Area for SWI-Prolog emulation routines.
|
||||
struct PL_local_data *Yap_ld_ PL_local_data_p =Yap_InitThreadIO(wid)
|
||||
|
||||
struct open_query_struct* _execution execution =NULL
|
||||
struct PL_local_data* Yap_ld_ LOCAL_PL_local_data_p =Yap_InitThreadIO(wid)
|
||||
|
||||
struct open_query_struct* _execution LOCAL_execution =NULL
|
||||
|
||||
#ifdef THREADS
|
||||
struct thandle thread_handle ThreadHandle InitThreadHandle(wid)
|
||||
struct thandle thread_handle LOCAL_ThreadHandle InitThreadHandle(wid)
|
||||
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
|
||||
#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle)
|
||||
#endif
|
||||
|
100
misc/buildheap
100
misc/buildheap
@ -126,6 +126,10 @@ fetch_name(Global) :-
|
||||
fetch_name(Global) :-
|
||||
Global = "Yap_heap_regs->".
|
||||
|
||||
fetch_name(Global,RField,_) :-
|
||||
globals(worker_init), !,
|
||||
append("FOREIGN(wid)->",RField,Global).
|
||||
fetch_name(Global,_,Global).
|
||||
|
||||
% handle *field[4]
|
||||
cut_c_stuff([0'*|Name], RName) :- !, % 'cut *
|
||||
@ -174,31 +178,31 @@ gen_hstruct(Inp,Out) :-
|
||||
glue(Inp2, " ", Inp3),
|
||||
gen_hstruct(Inp3,Out).
|
||||
gen_hstruct(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkAT", _]), !,
|
||||
fetch_name(Global),
|
||||
append([" ",Global,Field," = AtomTermAdjust(Yap_heap_regs->",Field,");"], Out).
|
||||
split(Inp," ",[_, Field, MacroName, "MkAT", _]), !,
|
||||
fetch_name(Global,Field,MacroName),
|
||||
append([" ",Global," = AtomTermAdjust(",Global,");"], Out).
|
||||
gen_hstruct(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkPred"| _]), !,
|
||||
split(Inp," ",[_, Field, MacroName, "MkPred"| _]), !,
|
||||
cut_c_stuff(Field, RField),
|
||||
fetch_name(Global),
|
||||
append([" ",Global,RField," = PtoPredAdjust(Yap_heap_regs->",RField,");"], Out).
|
||||
fetch_name(Global,RField,MacroName),
|
||||
append([" ",Global," = PtoPredAdjust(",Global,");"], Out).
|
||||
gen_hstruct(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkOp", Name]), !,
|
||||
fetch_name(Global),
|
||||
append([" ",Global,Field," = Yap_opcode(",Name,");"], Out).
|
||||
split(Inp," ",[_, Field, MacroName, "MkOp", Name]), !,
|
||||
fetch_name(Global,Field,MacroName),
|
||||
append([" ",Global," = Yap_opcode(",Name,");"], Out).
|
||||
gen_hstruct(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkLock"]), !,
|
||||
fetch_name(Global),
|
||||
append([" REINIT_LOCK(",Global,Field,");"], Out).
|
||||
split(Inp," ",[_, Field, MacroName, "MkLock"]), !,
|
||||
fetch_name(Global,Field,MacroName),
|
||||
append([" REINIT_LOCK(",Global,");"], Out).
|
||||
gen_hstruct(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkRWLock"]), !,
|
||||
fetch_name(Global),
|
||||
append([" REINIT_RWLOCK(",Global,Field,");"], Out).
|
||||
split(Inp," ",[_, Field, MacroName, "MkRWLock"]), !,
|
||||
fetch_name(Global,Field,MacroName),
|
||||
append([" REINIT_RWLOCK(",Global,");"], Out).
|
||||
gen_hstruct(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkInstE",OP]), !,
|
||||
split(Inp," ",[_, Field, MacroName, "MkInstE",OP]), !,
|
||||
cut_c_stuff(Field, RField),
|
||||
fetch_name(Global),
|
||||
append([" ",Global,RField,"->opc = Yap_opcode(",OP,");"], Out).
|
||||
fetch_name(Global,RField,MacroName),
|
||||
append([" ",Global,"->opc = Yap_opcode(",OP,");"], Out).
|
||||
gen_hstruct(Inp,"") :-
|
||||
split(Inp," ",[_, _, _, _]), !.
|
||||
gen_hstruct(Inp,"") :-
|
||||
@ -208,11 +212,11 @@ gen_hstruct(Inp,Restore) :-
|
||||
append("Restore",_,Restore0), !,
|
||||
append([" ",Restore0,";"],Restore). %'
|
||||
gen_hstruct(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, _, Adjust]),
|
||||
split(Inp," ",[_, Field, MacroName, _, Adjust]),
|
||||
append(Adjust,"Adjust",_), !,
|
||||
cut_c_stuff(Field, RField),
|
||||
fetch_name(Global),
|
||||
append([" ",Global,RField," = ",Adjust,"(",Global,RField,");"], Out).
|
||||
fetch_name(Global,RField,MacroName),
|
||||
append([" ",Global," = ",Adjust,"(",Global,");"], Out).
|
||||
gen_hstruct(Inp,_) :-
|
||||
split(Inp," ",[_, _, _| _]),
|
||||
format(user_error,"OOPS: could not gen_hstruct for ~s~n",[Inp]).
|
||||
@ -261,48 +265,48 @@ gen_init(Inp,Init) :-
|
||||
append("Yap_Init",_,Init0), !,
|
||||
append([" ",Init0,";"],Init).
|
||||
gen_init(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkAT", AtomName]), !,
|
||||
split(Inp," ",[_, Field, MacroName, "MkAT", AtomName]), !,
|
||||
cut_c_stuff(Field, RField),
|
||||
fetch_name(Global),
|
||||
append([" ",Global,RField," = MkAtomTerm(",AtomName,");"], Out).
|
||||
fetch_name(Global,RField,MacroName),
|
||||
append([" ",Global," = MkAtomTerm(",AtomName,");"], Out).
|
||||
gen_init(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkOp", Name]), !,
|
||||
fetch_name(Global),
|
||||
append([" ",Global,Field," = Yap_opcode(",Name,");"], Out).
|
||||
split(Inp," ",[_, Field, MacroName, "MkOp", Name]), !,
|
||||
fetch_name(Global,Field,MacroName),
|
||||
append([" ",Global," = Yap_opcode(",Name,");"], Out).
|
||||
gen_init(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkLock"]), !,
|
||||
fetch_name(Global),
|
||||
append([" INIT_LOCK(",Global,Field,");"], Out).
|
||||
split(Inp," ",[_, Field, MacroName, "MkLock"]), !,
|
||||
fetch_name(Global,Field,MacroName),
|
||||
append([" INIT_LOCK(",Global,");"], Out).
|
||||
gen_init(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkRWLock"]), !,
|
||||
fetch_name(Global),
|
||||
append([" INIT_RWLOCK(",Global,Field,");"], Out).
|
||||
split(Inp," ",[_, Field, MacroName, "MkRWLock"]), !,
|
||||
fetch_name(Global,Field,MacroName),
|
||||
append([" INIT_RWLOCK(",Global,");"], Out).
|
||||
gen_init(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkInstE",OP]), !,
|
||||
split(Inp," ",[_, Field, MacroName, "MkInstE",OP]), !,
|
||||
cut_c_stuff(Field, RField),
|
||||
fetch_name(Global),
|
||||
append([" ",Global,RField,"->opc = Yap_opcode(",OP,");"], Out).
|
||||
fetch_name(Global,RField,MacroName),
|
||||
append([" ",Global,"->opc = Yap_opcode(",OP,");"], Out).
|
||||
gen_init(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkPred", Atom, "0", Module]), !,
|
||||
split(Inp," ",[_, Field, MacroName, "MkPred", Atom, "0", Module]), !,
|
||||
cut_c_stuff(Field, RField),
|
||||
fetch_name(Global),
|
||||
append([" ",Global,RField," = RepPredProp(PredPropByAtom(",Atom,",",Module,"));"], Out).
|
||||
fetch_name(Global,RField,MacroName),
|
||||
append([" ",Global," = RepPredProp(PredPropByAtom(",Atom,",",Module,"));"], Out).
|
||||
gen_init(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkPred", Atom, Arity, Module]), !,
|
||||
split(Inp," ",[_, Field, MacroName, "MkPred", Atom, Arity, Module]), !,
|
||||
cut_c_stuff(Field, RField),
|
||||
fetch_name(Global),
|
||||
append([" ",Global,RField," = RepPredProp(PredPropByFunc(Yap_MkFunctor(",Atom,",",Arity,"),",Module,"));"], Out).
|
||||
fetch_name(Global,RField,MacroName),
|
||||
append([" ",Global," = RepPredProp(PredPropByFunc(Yap_MkFunctor(",Atom,",",Arity,"),",Module,"));"], Out).
|
||||
gen_init(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, "MkPred", Fun, Module]), !,
|
||||
split(Inp," ",[_, Field, MacroName, "MkPred", Fun, Module]), !,
|
||||
cut_c_stuff(Field, RField),
|
||||
fetch_name(Global),
|
||||
append([" ",Global,RField," = RepPredProp(PredPropByFunc(",Fun,",",Module,"));"], Out).
|
||||
fetch_name(Global,RField,MacroName),
|
||||
append([" ",Global," = RepPredProp(PredPropByFunc(",Fun,",",Module,"));"], Out).
|
||||
gen_init(Inp,Out) :-
|
||||
split(Inp," ",[_, Field, _, F0|_]),
|
||||
split(Inp," ",[_, Field, MacroName, F0|_]),
|
||||
append("=",F,F0), !,
|
||||
cut_c_stuff(Field, RField),
|
||||
fetch_name(Global),
|
||||
append([" ",Global,RField," = ",F,";"], Out).
|
||||
fetch_name(Global,RField,MacroName),
|
||||
append([" ",Global," = ",F,";"], Out).
|
||||
gen_init(Inp,_) :-
|
||||
split(Inp," ",[_, _, _| _]),
|
||||
format(user_error,"OOPS: could not gen_init for ~s~n",[Inp]).
|
||||
|
@ -255,7 +255,7 @@ extern PL_local_data_t lds;
|
||||
|
||||
// THIS HAS TO BE ABSTRACTED
|
||||
|
||||
#define GLOBAL_LD (PL_local_data_p)
|
||||
#define GLOBAL_LD (LOCAL_PL_local_data_p)
|
||||
|
||||
#if !defined(O_PLMT) && !defined(YAPOR)
|
||||
#define LOCAL_LD (GLOBAL_LD)
|
||||
|
@ -1098,7 +1098,7 @@ pl_readline(term_t flag)
|
||||
|
||||
static Term
|
||||
StreamPosition(IOSTREAM *st)
|
||||
{
|
||||
{ GET_LD
|
||||
Term t[4];
|
||||
if (!st)
|
||||
st = Suser_input;
|
||||
|
Reference in New Issue
Block a user