change LOCALS macros.

This commit is contained in:
Joao 2011-05-04 10:11:41 +01:00
parent 18ce4dd78b
commit dc3c54c164
47 changed files with 1448 additions and 1448 deletions

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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
View File

@ -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
View File

@ -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;
}

View File

@ -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
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);
@ -2197,7 +2197,7 @@ YAP_EnterGoal(PredEntry *pe, Term *ptr, YAP_dogoalinfo *dgi)
B = myB;
HB = H;
#if defined(YAPOR) || defined(THREADS)
WPP = NULL;
LOCAL_WPP = NULL;
#endif
ASP = YENV = (CELL *)B;
YENV[E_CB] = Unsigned (B);
@ -2276,7 +2276,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 +2284,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 +2327,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 +2338,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 +2348,7 @@ YAP_RestartGoal(void)
/* cleanup */
Yap_CloseSlots( PASS_REGS1 );
Yap_trust_last();
Yap_AllowRestart = FALSE;
LOCAL_AllowRestart = FALSE;
}
} else {
out = FALSE;
@ -2363,7 +2363,7 @@ YAP_ShutdownGoal(int backtrack)
CACHE_REGS
BACKUP_MACHINE_REGS();
if (Yap_AllowRestart) {
if (LOCAL_AllowRestart) {
choiceptr cut_pt;
cut_pt = B;