Merge branch 'master' of ssh://yap.git.sf.net/gitroot/yap/yap-6.3

This commit is contained in:
Vitor Santos Costa 2011-05-08 23:12:44 +01:00
commit 925b8fec01
55 changed files with 1744 additions and 1823 deletions

View File

@ -53,7 +53,7 @@ Cell *C, OldC;
Cell move_structures(Cell c) Cell move_structures(Cell c)
{ {
Cell *NewC, *NewH; Cell *NewC, *NewH;
Cell OldC,OldH; Cell OldC,LOCAL_OldH;
OldC=deref((Cell) c); OldC=deref((Cell) c);
/* /*
@ -67,7 +67,7 @@ Cell OldC,OldH;
return(OldC); return(OldC);
} }
OldH=(Cell) beam_H; LOCAL_OldH=(Cell) beam_H;
NewH=beam_H; NewH=beam_H;
if (isappl(OldC)) { if (isappl(OldC)) {
int i,arity; int i,arity;
@ -81,7 +81,7 @@ Cell OldC,OldH;
NewH++; NewH++;
NewC++; NewC++;
} }
return(absappl(OldH)); return(absappl(LOCAL_OldH));
} }
/* else if (ispair(c)) { */ /* else if (ispair(c)) { */
NewC=(Cell *) reppair(OldC); NewC=(Cell *) reppair(OldC);
@ -90,7 +90,7 @@ Cell OldC,OldH;
NewC++; NewC++;
NewH++; NewH++;
*NewH=move_structures((Cell) NewC); *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 copy_structures(Cell c)
{ {
Cell *NewC, *NewH; Cell *NewC, *NewH;
Cell OldC,OldH; Cell OldC,LOCAL_OldH;
OldC=deref((Cell) c); OldC=deref((Cell) c);
@ -451,7 +451,7 @@ Cell OldC,OldH;
return(OldC); return(OldC);
} }
OldH=(Cell) beam_H; LOCAL_OldH=(Cell) beam_H;
NewH=beam_H; NewH=beam_H;
if (isappl(OldC)) { if (isappl(OldC)) {
int i,arity; int i,arity;
@ -465,7 +465,7 @@ Cell OldC,OldH;
NewH++; NewH++;
NewC++; NewC++;
} }
return(absappl(OldH)); return(absappl(LOCAL_OldH));
} }
/* else if (ispair(c)) { */ /* else if (ispair(c)) { */
NewC=(Cell *) reppair(OldC); NewC=(Cell *) reppair(OldC);
@ -474,5 +474,5 @@ Cell OldC,OldH;
NewC++; NewC++;
NewH++; NewH++;
*NewH=copy_structures((Cell) NewC); *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); Yap_plwrite(MkIntTerm(new4), Yap_DebugPutc, 0, 1200);
break; break;
default: default:
Yap_DebugPutc (Yap_c_error_stream,'%'); Yap_DebugPutc (LOCAL_c_error_stream,'%');
Yap_DebugPutc (Yap_c_error_stream,ch); Yap_DebugPutc (LOCAL_c_error_stream,ch);
} }
else 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); LOCK(PREG->u.p.p->StatisticsForPred.lock);
PREG->u.p.p->StatisticsForPred.NOfEntries++; PREG->u.p.p->StatisticsForPred.NOfEntries++;
UNLOCK(PREG->u.p.p->StatisticsForPred.lock); UNLOCK(PREG->u.p.p->StatisticsForPred.lock);
ReductionsCounter--; LOCAL_ReductionsCounter--;
if (ReductionsCounter == 0 && ReductionsCounterOn) { if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
saveregs(); saveregs();
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
JMPNext(); JMPNext();
} }
PredEntriesCounter--; LOCAL_PredEntriesCounter--;
if (PredEntriesCounter == 0 && PredEntriesCounterOn) { if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs(); saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
@ -1209,8 +1209,8 @@ Yap_absmi(int inp)
LOCK(PREG->u.p.p->StatisticsForPred.lock); LOCK(PREG->u.p.p->StatisticsForPred.lock);
PREG->u.p.p->StatisticsForPred.NOfRetries++; PREG->u.p.p->StatisticsForPred.NOfRetries++;
UNLOCK(PREG->u.p.p->StatisticsForPred.lock); UNLOCK(PREG->u.p.p->StatisticsForPred.lock);
RetriesCounter--; LOCAL_RetriesCounter--;
if (RetriesCounter == 0 && RetriesCounterOn) { if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
/* act as if we had backtracked */ /* act as if we had backtracked */
ENV = B->cp_env; ENV = B->cp_env;
saveregs(); saveregs();
@ -1218,8 +1218,8 @@ Yap_absmi(int inp)
setregs(); setregs();
JMPNext(); JMPNext();
} }
PredEntriesCounter--; LOCAL_PredEntriesCounter--;
if (PredEntriesCounter == 0 && PredEntriesCounterOn) { if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
ENV = B->cp_env; ENV = B->cp_env;
saveregs(); saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
@ -1248,15 +1248,15 @@ Yap_absmi(int inp)
LOCK(((PredEntry *)(PREG->u.Otapl.p))->StatisticsForPred.lock); LOCK(((PredEntry *)(PREG->u.Otapl.p))->StatisticsForPred.lock);
((PredEntry *)(PREG->u.Otapl.p))->StatisticsForPred.NOfRetries++; ((PredEntry *)(PREG->u.Otapl.p))->StatisticsForPred.NOfRetries++;
UNLOCK(((PredEntry *)(PREG->u.Otapl.p))->StatisticsForPred.lock); UNLOCK(((PredEntry *)(PREG->u.Otapl.p))->StatisticsForPred.lock);
RetriesCounter--; LOCAL_RetriesCounter--;
if (RetriesCounter == 0 && RetriesCounterOn) { if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
saveregs(); saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
JMPNext(); JMPNext();
} }
PredEntriesCounter--; LOCAL_PredEntriesCounter--;
if (PredEntriesCounter == 0 && PredEntriesCounterOn) { if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs(); saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
@ -1292,15 +1292,15 @@ Yap_absmi(int inp)
} }
SET_BB(B_YREG); SET_BB(B_YREG);
ENDCACHE_Y(); ENDCACHE_Y();
RetriesCounter--; LOCAL_RetriesCounter--;
if (RetriesCounter == 0) { if (LOCAL_RetriesCounter == 0) {
saveregs(); saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
JMPNext(); JMPNext();
} }
PredEntriesCounter--; LOCAL_PredEntriesCounter--;
if (PredEntriesCounter == 0) { if (LOCAL_PredEntriesCounter == 0) {
saveregs(); saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
@ -1327,15 +1327,15 @@ Yap_absmi(int inp)
} }
restore_yaam_regs(PREG->u.OtaLl.n); restore_yaam_regs(PREG->u.OtaLl.n);
restore_args(PREG->u.OtaLl.s); restore_args(PREG->u.OtaLl.s);
RetriesCounter--; LOCAL_RetriesCounter--;
if (RetriesCounter == 0) { if (LOCAL_RetriesCounter == 0) {
saveregs(); saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
JMPNext(); JMPNext();
} }
PredEntriesCounter--; LOCAL_PredEntriesCounter--;
if (PredEntriesCounter == 0) { if (LOCAL_PredEntriesCounter == 0) {
saveregs(); saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
@ -1372,15 +1372,15 @@ Yap_absmi(int inp)
/* jump to next alternative */ /* jump to next alternative */
PREG = FAILCODE; PREG = FAILCODE;
} else { } else {
RetriesCounter--; LOCAL_RetriesCounter--;
if (RetriesCounter == 0) { if (LOCAL_RetriesCounter == 0) {
saveregs(); saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
JMPNext(); JMPNext();
} }
PredEntriesCounter--; LOCAL_PredEntriesCounter--;
if (PredEntriesCounter == 0) { if (LOCAL_PredEntriesCounter == 0) {
saveregs(); saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
@ -1778,15 +1778,15 @@ Yap_absmi(int inp)
ENDBOp(); ENDBOp();
BOp(count_retry_and_mark, Otapl); BOp(count_retry_and_mark, Otapl);
RetriesCounter--; LOCAL_RetriesCounter--;
if (RetriesCounter == 0) { if (LOCAL_RetriesCounter == 0) {
saveregs(); saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
JMPNext(); JMPNext();
} }
PredEntriesCounter--; LOCAL_PredEntriesCounter--;
if (PredEntriesCounter == 0) { if (LOCAL_PredEntriesCounter == 0) {
saveregs(); saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
@ -2444,12 +2444,12 @@ Yap_absmi(int inp)
NoStackExecute: NoStackExecute:
SREG = (CELL *) PREG->u.pp.p; SREG = (CELL *) PREG->u.pp.p;
PP = PREG->u.pp.p0; PP = PREG->u.pp.p0;
if (ActiveSignals & YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
SET_ASP(YREG, E_CB*sizeof(CELL)); SET_ASP(YREG, E_CB*sizeof(CELL));
SREG = YENV; SREG = YENV;
goto noheapleft; goto noheapleft;
} }
if (ActiveSignals) if (LOCAL_ActiveSignals)
goto creep; goto creep;
else else
goto NoStackExec; goto NoStackExec;
@ -2586,24 +2586,24 @@ Yap_absmi(int inp)
NoStackCall: NoStackCall:
PP = PREG->u.Osbpp.p0; PP = PREG->u.Osbpp.p0;
/* on X86 machines S will not actually be holding the pointer to pred */ /* on X86 machines S will not actually be holding the pointer to pred */
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
goto fail; goto fail;
} }
if (ActiveSignals & YAP_CREEP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
PredEntry *ap = PREG->u.Osbpp.p; PredEntry *ap = PREG->u.Osbpp.p;
SREG = (CELL *) ap; SREG = (CELL *) ap;
goto creepc; goto creepc;
} }
SREG = (CELL *) PREG->u.Osbpp.p; SREG = (CELL *) PREG->u.Osbpp.p;
if (ActiveSignals & YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
SET_ASP(YREG, PREG->u.Osbpp.s); SET_ASP(YREG, PREG->u.Osbpp.s);
SREG = YENV; SREG = YENV;
goto noheapleft; goto noheapleft;
} }
if (ActiveSignals) { if (LOCAL_ActiveSignals) {
goto creepc; goto creepc;
} }
SET_ASP(YREG, PREG->u.Osbpp.s); SET_ASP(YREG, PREG->u.Osbpp.s);
@ -2624,18 +2624,18 @@ Yap_absmi(int inp)
{ {
CELL cut_b = LCL0-(CELL *)(SREG[E_CB]); CELL cut_b = LCL0-(CELL *)(SREG[E_CB]);
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
goto fail; goto fail;
} }
/* /*
don't do a creep here; also, if our instruction is followed by don't do a creep here; also, if our instruction is followed by
a execute_c, just wait a bit more */ 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 */ /* 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(_procceed) &&
PREG->opc != Yap_opcode(_cut_e))) { PREG->opc != Yap_opcode(_cut_e))) {
GONext(); GONext();
@ -2648,10 +2648,10 @@ Yap_absmi(int inp)
} }
if (ASP > (CELL *)PROTECT_FROZEN_B(B)) if (ASP > (CELL *)PROTECT_FROZEN_B(B))
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; goto noheapleft;
} }
if (ActiveSignals) { if (LOCAL_ActiveSignals) {
if (Yap_op_from_opcode(PREG->opc) == _cut_e) { if (Yap_op_from_opcode(PREG->opc) == _cut_e) {
/* followed by a cut */ /* followed by a cut */
ARG1 = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]); 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 */ /* This is easier: I know there is an environment so I cannot do allocate */
NoStackCut: NoStackCut:
/* find something to fool S */ /* find something to fool S */
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) { if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
goto do_cut; goto do_cut;
} }
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
FAIL(); FAIL();
} }
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) { if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
SREG = (CELL *)PredRestoreRegs; SREG = (CELL *)PredRestoreRegs;
XREGS[0] = MkIntegerTerm(LCL0-(CELL *)YREG[E_CB]); XREGS[0] = MkIntegerTerm(LCL0-(CELL *)YREG[E_CB]);
PREG = NEXTOP(PREG,e); PREG = NEXTOP(PREG,e);
@ -2696,16 +2696,16 @@ Yap_absmi(int inp)
NoStackCutT: NoStackCutT:
/* find something to fool S */ /* find something to fool S */
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) { if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
goto do_cut_t; goto do_cut_t;
} }
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
FAIL(); FAIL();
} }
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) { if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
SREG = (CELL *)PredRestoreRegs; SREG = (CELL *)PredRestoreRegs;
XREGS[0] = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]); XREGS[0] = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]);
PREG = NEXTOP(PREG,e); PREG = NEXTOP(PREG,e);
@ -2715,16 +2715,16 @@ Yap_absmi(int inp)
goto do_cut_t; goto do_cut_t;
NoStackCutE: NoStackCutE:
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) { if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
goto do_cut_t; goto do_cut_t;
} }
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
FAIL(); FAIL();
} }
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) { if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
SREG = (CELL *)PredRestoreRegs; SREG = (CELL *)PredRestoreRegs;
XREGS[0] = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]); XREGS[0] = MkIntegerTerm(LCL0-(CELL *)SREG[E_CB]);
PREG = NEXTOP(PREG,e); PREG = NEXTOP(PREG,e);
@ -2737,16 +2737,16 @@ Yap_absmi(int inp)
NoStackCommitY: NoStackCommitY:
PP = PREG->u.yps.p0; PP = PREG->u.yps.p0;
/* find something to fool S */ /* find something to fool S */
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) { if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
goto do_commit_b_y; goto do_commit_b_y;
} }
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
FAIL(); FAIL();
} }
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) { if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
SREG = (CELL *)PredRestoreRegs; SREG = (CELL *)PredRestoreRegs;
XREGS[0] = YREG[PREG->u.yps.y]; XREGS[0] = YREG[PREG->u.yps.y];
PREG = NEXTOP(PREG,yps); PREG = NEXTOP(PREG,yps);
@ -2759,16 +2759,16 @@ Yap_absmi(int inp)
NoStackCommitX: NoStackCommitX:
PP = PREG->u.xps.p0; PP = PREG->u.xps.p0;
/* find something to fool S */ /* find something to fool S */
if (!ActiveSignals || ActiveSignals & YAP_CDOVF_SIGNAL) { if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
goto do_commit_b_x; goto do_commit_b_x;
} }
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
FAIL(); FAIL();
} }
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) { if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
SREG = (CELL *)PredRestoreRegs; SREG = (CELL *)PredRestoreRegs;
#if USE_THREADED_CODE #if USE_THREADED_CODE
if (PREG->opc == (OPCODE)OpAddress[_fcall]) if (PREG->opc == (OPCODE)OpAddress[_fcall])
@ -2794,18 +2794,18 @@ Yap_absmi(int inp)
/* Problem: have I got an environment or not? */ /* Problem: have I got an environment or not? */
NoStackFail: NoStackFail:
if (ActiveSignals && ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals && LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
/* we're happy */ /* we're happy */
goto fail; goto fail;
} }
/* find something to fool S */ /* find something to fool S */
if (!ActiveSignals || ActiveSignals & (YAP_CDOVF_SIGNAL)) { if (!LOCAL_ActiveSignals || LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL)) {
goto fail; goto fail;
} }
if (!(ActiveSignals & YAP_CREEP_SIGNAL)) { if (!(LOCAL_ActiveSignals & YAP_CREEP_SIGNAL)) {
SREG = (CELL *)RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)); SREG = (CELL *)RepPredProp(Yap_GetPredPropByAtom(AtomFail,0));
/* make sure we have the correct environment for continuation */ /* make sure we have the correct environment for continuation */
ENV = B->cp_env; ENV = B->cp_env;
@ -2817,24 +2817,24 @@ Yap_absmi(int inp)
/* don't forget I cannot creep at ; */ /* don't forget I cannot creep at ; */
NoStackEither: NoStackEither:
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
goto fail; goto fail;
} }
PP = PREG->u.Osblp.p0; PP = PREG->u.Osblp.p0;
if (ActiveSignals & YAP_CREEP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
goto either_notest; goto either_notest;
} }
/* find something to fool S */ /* find something to fool S */
SREG = (CELL *)RepPredProp(Yap_GetPredPropByFunc(FunctorRestoreRegs1,0)); 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); SET_ASP(YREG, PREG->u.Osbpp.s);
SREG = YENV; SREG = YENV;
goto noheapleft; goto noheapleft;
} }
if (ActiveSignals) { if (LOCAL_ActiveSignals) {
goto creep_either; goto creep_either;
} }
ASP = (CELL *) (((char *) YREG) + PREG->u.Osbpp.s); ASP = (CELL *) (((char *) YREG) + PREG->u.Osbpp.s);
@ -2899,14 +2899,14 @@ Yap_absmi(int inp)
goto creep; goto creep;
NoStackDExecute: NoStackDExecute:
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
goto fail; goto fail;
} }
PP = PREG->u.pp.p0; PP = PREG->u.pp.p0;
if (ActiveSignals & YAP_CREEP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
PredEntry *ap = PREG->u.pp.p; PredEntry *ap = PREG->u.pp.p;
if (ap->PredFlags & HiddenPredFlag) { if (ap->PredFlags & HiddenPredFlag) {
@ -2951,14 +2951,14 @@ Yap_absmi(int inp)
} }
/* set SREG for next instructions */ /* set SREG for next instructions */
SREG = (CELL *) PREG->u.p.p; SREG = (CELL *) PREG->u.p.p;
if (ActiveSignals & YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
ASP = YREG+E_CB; ASP = YREG+E_CB;
if (ASP > (CELL *)PROTECT_FROZEN_B(B)) if (ASP > (CELL *)PROTECT_FROZEN_B(B))
ASP = (CELL *)PROTECT_FROZEN_B(B); ASP = (CELL *)PROTECT_FROZEN_B(B);
SREG = YENV; SREG = YENV;
goto noheapleft; goto noheapleft;
} }
if (ActiveSignals) if (LOCAL_ActiveSignals)
goto creepde; goto creepde;
/* try performing garbage collection */ /* try performing garbage collection */
@ -2978,9 +2978,9 @@ Yap_absmi(int inp)
/* try performing garbage collection */ /* try performing garbage collection */
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
goto fail; goto fail;
} }
@ -3027,19 +3027,19 @@ Yap_absmi(int inp)
/* and now CREEP */ /* and now CREEP */
creep: creep:
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
goto fail; goto fail;
} }
#if defined(_MSC_VER) || defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW32__)
/* I need this for Windows and other systems where SIGINT /* I need this for Windows and other systems where SIGINT
is not proceesed by same thread as absmi */ is not proceesed by same thread as absmi */
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (Yap_PrologMode & (AbortMode|InterruptMode)) { if (Yap_PrologMode & (AbortMode|InterruptMode)) {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
/* same instruction */ /* same instruction */
if (Yap_PrologMode & InterruptMode) { if (Yap_PrologMode & InterruptMode) {
Yap_PrologMode &= ~InterruptMode; Yap_PrologMode &= ~InterruptMode;
@ -3050,7 +3050,7 @@ Yap_absmi(int inp)
} }
JMPNext(); JMPNext();
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
#endif #endif
#ifdef SHADOW_S #ifdef SHADOW_S
S = SREG; S = SREG;
@ -3105,22 +3105,22 @@ Yap_absmi(int inp)
ARG1 = (Term) AbsPair(H); ARG1 = (Term) AbsPair(H);
H += 2; H += 2;
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
#ifdef COROUTINING #ifdef COROUTINING
if (ActiveSignals & YAP_WAKEUP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_WAKEUP_SIGNAL) {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
ActiveSignals &= ~YAP_WAKEUP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_WAKEUP_SIGNAL;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
ARG2 = Yap_ListOfWokenGoals(); ARG2 = Yap_ListOfWokenGoals();
SREG = (CELL *) (WakeUpCode); SREG = (CELL *) (WakeUpCode);
/* no more goals to wake up */ /* no more goals to wake up */
Yap_UpdateTimedVar(WokenGoals, TermNil); Yap_UpdateTimedVar(LOCAL_WokenGoals, TermNil);
} else } else
#endif #endif
{ {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
SREG = (CELL *) CreepCode; SREG = (CELL *) CreepCode;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
} }
PREG = ((PredEntry *)SREG)->CodeOfPred; PREG = ((PredEntry *)SREG)->CodeOfPred;
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
@ -7625,16 +7625,16 @@ Yap_absmi(int inp)
LOCK(pe->StatisticsForPred.lock); LOCK(pe->StatisticsForPred.lock);
pe->StatisticsForPred.NOfEntries++; pe->StatisticsForPred.NOfEntries++;
UNLOCK(pe->StatisticsForPred.lock); UNLOCK(pe->StatisticsForPred.lock);
ReductionsCounter--; LOCAL_ReductionsCounter--;
if (ReductionsCounter == 0 && ReductionsCounterOn) { if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
UNLOCKPE(20,pe); UNLOCKPE(20,pe);
saveregs(); saveregs();
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
JMPNext(); JMPNext();
} }
PredEntriesCounter--; LOCAL_PredEntriesCounter--;
if (PredEntriesCounter == 0 && PredEntriesCounterOn) { if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
UNLOCKPE(21,pe); UNLOCKPE(21,pe);
saveregs(); saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
@ -7659,7 +7659,7 @@ Yap_absmi(int inp)
JMPNext(); JMPNext();
} }
} }
if (!DebugOn) { if (!LOCAL_DebugOn) {
PREG = pe->cs.p_code.TrueCodeOfPred; PREG = pe->cs.p_code.TrueCodeOfPred;
UNLOCKPE(24,pe); UNLOCKPE(24,pe);
JMPNext(); JMPNext();
@ -11285,9 +11285,9 @@ Yap_absmi(int inp)
* We may wake up goals during our attempt to unify the * We may wake up goals during our attempt to unify the
* two terms. If we are adding to the tail of a list of * two terms. If we are adding to the tail of a list of
* woken goals that should be ok, but otherwise we need * 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 #endif
/* We will have to look inside compound terms */ /* We will have to look inside compound terms */
@ -11307,7 +11307,7 @@ Yap_absmi(int inp)
opresult = Yap_IUnify(d0, d1); opresult = Yap_IUnify(d0, d1);
#ifdef COROUTINING #ifdef COROUTINING
/* now restore Woken Goals to its old value */ /* now restore Woken Goals to its old value */
Yap_UpdateTimedVar(WokenGoals, OldWokenGoals); Yap_UpdateTimedVar(LOCAL_WokenGoals, OldWokenGoals);
if (OldWokenGoals == TermNil) { if (OldWokenGoals == TermNil) {
Yap_undo_signal(YAP_WAKEUP_SIGNAL); Yap_undo_signal(YAP_WAKEUP_SIGNAL);
} }
@ -13234,9 +13234,9 @@ Yap_absmi(int inp)
ENDD(d0); ENDD(d0);
NoStackPExecute2: NoStackPExecute2:
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
goto fail; goto fail;
} }
@ -13248,7 +13248,7 @@ Yap_absmi(int inp)
/* setup GB */ /* setup GB */
WRITEBACK_Y_AS_ENV(); WRITEBACK_Y_AS_ENV();
YREG[E_CB] = (CELL) B; YREG[E_CB] = (CELL) B;
if (ActiveSignals) { if (LOCAL_ActiveSignals) {
goto creep_pe; goto creep_pe;
} }
saveregs_and_ycache(); saveregs_and_ycache();
@ -13439,9 +13439,9 @@ Yap_absmi(int inp)
ENDD(d0); ENDD(d0);
NoStackPExecute: NoStackPExecute:
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
goto fail; goto fail;
} }
@ -13453,7 +13453,7 @@ Yap_absmi(int inp)
/* setup GB */ /* setup GB */
WRITEBACK_Y_AS_ENV(); WRITEBACK_Y_AS_ENV();
YREG[E_CB] = (CELL) B; YREG[E_CB] = (CELL) B;
if (ActiveSignals) { if (LOCAL_ActiveSignals) {
goto creep_pe; goto creep_pe;
} }
saveregs_and_ycache(); saveregs_and_ycache();
@ -13671,9 +13671,9 @@ Yap_absmi(int inp)
ENDD(d0); ENDD(d0);
ENDP(pt0); ENDP(pt0);
NoStackPTExecute: NoStackPTExecute:
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
goto fail; goto fail;
} }
@ -13683,9 +13683,9 @@ Yap_absmi(int inp)
ASP = ENV_YREG; ASP = ENV_YREG;
if (ASP > (CELL *)PROTECT_FROZEN_B(B)) if (ASP > (CELL *)PROTECT_FROZEN_B(B))
ASP = (CELL *)PROTECT_FROZEN_B(B); ASP = (CELL *)PROTECT_FROZEN_B(B);
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (ActiveSignals & YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
saveregs_and_ycache(); saveregs_and_ycache();
if (!Yap_growheap(FALSE, 0, NULL)) { if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
@ -13693,16 +13693,16 @@ Yap_absmi(int inp)
FAIL(); FAIL();
} }
setregs_and_ycache(); setregs_and_ycache();
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
ActiveSignals &= ~YAP_CDOVF_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
if (!ActiveSignals) { if (!LOCAL_ActiveSignals) {
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
goto execute_after_comma; goto execute_after_comma;
} }
} }
if (ActiveSignals & YAP_TROVF_SIGNAL) { if (LOCAL_ActiveSignals & YAP_TROVF_SIGNAL) {
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
#ifdef SHADOW_S #ifdef SHADOW_S
S = SREG; S = SREG;
#endif #endif
@ -13713,23 +13713,23 @@ Yap_absmi(int inp)
FAIL(); FAIL();
} }
setregs_and_ycache(); setregs_and_ycache();
ActiveSignals &= ~YAP_TROVF_SIGNAL; LOCAL_ActiveSignals &= ~YAP_TROVF_SIGNAL;
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
if (!ActiveSignals) { if (!LOCAL_ActiveSignals) {
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
goto execute_after_comma; goto execute_after_comma;
} }
} }
if (ActiveSignals) { if (LOCAL_ActiveSignals) {
if (ActiveSignals & YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
SREG = YENV; SREG = YENV;
goto noheapleft; goto noheapleft;
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
goto creep; goto creep;
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
saveregs_and_ycache(); saveregs_and_ycache();
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, Osbpp))) { if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage); 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) static void init_reg_copies(USES_REGS1)
{ {
OldASP = ASP; LOCAL_OldASP = ASP;
OldLCL0 = LCL0; LOCAL_OldLCL0 = LCL0;
OldTR = TR; LOCAL_OldTR = TR;
OldGlobalBase = (CELL *)Yap_GlobalBase; LOCAL_OldGlobalBase = (CELL *)Yap_GlobalBase;
OldH = H; LOCAL_OldH = H;
OldH0 = H0; LOCAL_OldH0 = H0;
OldTrailBase = Yap_TrailBase; LOCAL_OldTrailBase = Yap_TrailBase;
OldTrailTop = Yap_TrailTop; LOCAL_OldTrailTop = Yap_TrailTop;
OldHeapBase = Yap_HeapBase; LOCAL_OldHeapBase = Yap_HeapBase;
OldHeapTop = HeapTop; LOCAL_OldHeapTop = HeapTop;
} }

View File

@ -245,8 +245,8 @@ Yap_InitPreAllocCodeSpace(void)
{ {
CACHE_REGS CACHE_REGS
char *ptr; char *ptr;
UInt sz = ScratchPad.msz; UInt sz = LOCAL_ScratchPad.msz;
if (ScratchPad.ptr == NULL) { if (LOCAL_ScratchPad.ptr == NULL) {
#if USE_DL_MALLOC #if USE_DL_MALLOC
LOCK(DLMallocLock); LOCK(DLMallocLock);
#endif #endif
@ -279,12 +279,12 @@ Yap_InitPreAllocCodeSpace(void)
#if USE_DL_MALLOC #if USE_DL_MALLOC
UNLOCK(DLMallocLock); UNLOCK(DLMallocLock);
#endif #endif
ScratchPad.ptr = ptr; LOCAL_ScratchPad.ptr = ptr;
} else { } else {
ptr = ScratchPad.ptr; ptr = LOCAL_ScratchPad.ptr;
} }
AuxBase = (ADDR)(ptr); AuxBase = (ADDR)(ptr);
AuxSp = (CELL *)(AuxTop = AuxBase+ScratchPad.sz); AuxSp = (CELL *)(AuxTop = AuxBase+LOCAL_ScratchPad.sz);
return ptr; return ptr;
} }
@ -293,11 +293,11 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0, void *cip, int safe)
{ {
CACHE_REGS CACHE_REGS
char *ptr; char *ptr;
UInt sz = ScratchPad.msz; UInt sz = LOCAL_ScratchPad.msz;
if (sz0 < SCRATCH_INC_SIZE) if (sz0 < SCRATCH_INC_SIZE)
sz0 = SCRATCH_INC_SIZE; sz0 = SCRATCH_INC_SIZE;
if (sz0 < ScratchPad.sz) if (sz0 < LOCAL_ScratchPad.sz)
sz = ScratchPad.sz+sz0; sz = LOCAL_ScratchPad.sz+sz0;
else else
sz = sz0; sz = sz0;
sz = AdjustLargePageSize(sz+sz/4); sz = AdjustLargePageSize(sz+sz/4);
@ -308,10 +308,10 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0, void *cip, int safe)
Yap_PrologMode |= MallocMode; Yap_PrologMode |= MallocMode;
#if INSTRUMENT_MALLOC #if INSTRUMENT_MALLOC
reallocs++; reallocs++;
tmalloc -= ScratchPad.sz; tmalloc -= LOCAL_ScratchPad.sz;
tmalloc += sz; tmalloc += sz;
#endif #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; Yap_PrologMode &= ~MallocMode;
#if USE_DL_MALLOC #if USE_DL_MALLOC
UNLOCK(DLMallocLock); UNLOCK(DLMallocLock);
@ -322,8 +322,8 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0, void *cip, int safe)
#if USE_DL_MALLOC #if USE_DL_MALLOC
UNLOCK(DLMallocLock); UNLOCK(DLMallocLock);
#endif #endif
ScratchPad.sz = ScratchPad.msz = sz; LOCAL_ScratchPad.sz = LOCAL_ScratchPad.msz = sz;
ScratchPad.ptr = ptr; LOCAL_ScratchPad.ptr = ptr;
AuxBase = ptr; AuxBase = ptr;
AuxSp = (CELL *)(AuxTop = ptr+sz); AuxSp = (CELL *)(AuxTop = ptr+sz);
return ptr; return ptr;
@ -374,8 +374,8 @@ InitExStacks(int Trail, int Stack)
Yap_LocalBase = Yap_GlobalBase + sa; Yap_LocalBase = Yap_GlobalBase + sa;
Yap_TrailBase = Yap_LocalBase + sizeof(CELL); Yap_TrailBase = Yap_LocalBase + sizeof(CELL);
ScratchPad.ptr = NULL; LOCAL_ScratchPad.ptr = NULL;
ScratchPad.sz = ScratchPad.msz = SCRATCH_START_SIZE; LOCAL_ScratchPad.sz = LOCAL_ScratchPad.msz = SCRATCH_START_SIZE;
AuxSp = NULL; AuxSp = NULL;
#ifdef DEBUG #ifdef DEBUG
@ -1554,8 +1554,8 @@ void
Yap_InitExStacks(int Trail, int Stack) Yap_InitExStacks(int Trail, int Stack)
{ {
#if USE_DL_MALLOC #if USE_DL_MALLOC
ScratchPad.ptr = NULL; LOCAL_ScratchPad.ptr = NULL;
ScratchPad.sz = ScratchPad.msz = SCRATCH_START_SIZE; LOCAL_ScratchPad.sz = LOCAL_ScratchPad.msz = SCRATCH_START_SIZE;
AuxSp = NULL; AuxSp = NULL;
#endif #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) a_gl(op_numbers opcode, yamop *code_p, int pass_no, struct PSEUDO *cpc, struct intermediates *cip USES_REGS)
{ {
#ifdef YAPOR #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 #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 */ #endif /* YAPOR */
} }
@ -2981,11 +2981,11 @@ a_special_label(yamop *code_p, int pass_no, struct intermediates *cip)
#ifdef YAPOR #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 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), 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 #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 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), 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 */ #endif /* YAPOR */
static yamop * 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; 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; *entry_codep = code_p;
if (tabled) { if (tabled) {
#if TABLING #if TABLING
#ifdef YAPOR #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 #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
#endif #endif
} }
if (dynamic) { if (dynamic) {
#ifdef YAPOR #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 #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 */ #endif /* YAPOR */
} }
} else { } else {
@ -3864,16 +3864,16 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
#if USE_SYSTEM_MALLOC #if USE_SYSTEM_MALLOC
if (!cip->label_offset) { if (!cip->label_offset) {
if (!Yap_LabelFirstArray && max_label <= DEFAULT_NLABELS) { if (!LOCAL_LabelFirstArray && max_label <= DEFAULT_NLABELS) {
Yap_LabelFirstArray = (Int *)Yap_AllocCodeSpace(sizeof(Int)*DEFAULT_NLABELS); LOCAL_LabelFirstArray = (Int *)Yap_AllocCodeSpace(sizeof(Int)*DEFAULT_NLABELS);
Yap_LabelFirstArraySz = DEFAULT_NLABELS; LOCAL_LabelFirstArraySz = DEFAULT_NLABELS;
if (!Yap_LabelFirstArray) { if (!LOCAL_LabelFirstArray) {
save_machine_regs(); save_machine_regs();
siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
} }
} }
if (Yap_LabelFirstArray && max_label <= Yap_LabelFirstArraySz) { if (LOCAL_LabelFirstArray && max_label <= LOCAL_LabelFirstArraySz) {
cip->label_offset = Yap_LabelFirstArray; cip->label_offset = LOCAL_LabelFirstArray;
} else { } else {
cip->label_offset = (Int *)Yap_AllocCodeSpace(sizeof(Int)*max_label); cip->label_offset = (Int *)Yap_AllocCodeSpace(sizeof(Int)*max_label);
if (!cip->label_offset) { 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 */ /* make sure we copy after second pass */
cl->usc.ClSource = x; cl->usc.ClSource = x;
cl->ClSize = osize; cl->ClSize = osize;
ProfEnd=code_p; LOCAL_ProfEnd=code_p;
return entry_code; return entry_code;
} else { } else {
while ((cip->code_addr = (yamop *) Yap_AllocCodeSpace(size)) == NULL) { 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); 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 #ifdef LOW_PROF
if (ProfilerOn && if (ProfilerOn &&
Yap_OffLineProfiler) { 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 */ #endif /* LOW_PROF */
return entry_code; return entry_code;

View File

@ -573,8 +573,8 @@ CreateNamedArray(PropEntry * pp, Int dim, AtomEntry *ae USES_REGS)
#if THREADS #if THREADS
p->owner_id = worker_id; p->owner_id = worker_id;
#endif #endif
p->NextAE = DynamicArrays; p->NextAE = LOCAL_DynamicArrays;
DynamicArrays = p; LOCAL_DynamicArrays = p;
InitNamedArray(p, dim PASS_REGS); InitNamedArray(p, dim PASS_REGS);
} }
@ -632,8 +632,8 @@ CreateStaticArray(AtomEntry *ae, Int dim, static_array_types type, CODEADDR star
p->KindOfPE = ArrayProperty; p->KindOfPE = ArrayProperty;
p->NextOfPE = ae->PropsOfAE; p->NextOfPE = ae->PropsOfAE;
INIT_RWLOCK(p->ArRWLock); INIT_RWLOCK(p->ArRWLock);
p->NextAE = StaticArrays; p->NextAE = LOCAL_StaticArrays;
StaticArrays = p; LOCAL_StaticArrays = p;
} }
WRITE_LOCK(p->ArRWLock); WRITE_LOCK(p->ArRWLock);
p->ArrayEArity = -dim; p->ArrayEArity = -dim;

View File

@ -41,10 +41,10 @@ AddToQueue(attvar_record *attv USES_REGS)
t[0] = (CELL)&(attv->Done); t[0] = (CELL)&(attv->Done);
t[1] = attv->Value; t[1] = attv->Value;
/* follow the chain */ /* follow the chain */
WGs = Yap_ReadTimedVar(WokenGoals); WGs = Yap_ReadTimedVar(LOCAL_WokenGoals);
ng = Yap_MkApplTerm(FunctorAttGoal, 2, t); ng = Yap_MkApplTerm(FunctorAttGoal, 2, t);
Yap_UpdateTimedVar(WokenGoals, MkPairTerm(ng, WGs)); Yap_UpdateTimedVar(LOCAL_WokenGoals, MkPairTerm(ng, WGs));
if ((Term)WGs == TermNil) { if ((Term)WGs == TermNil) {
/* from now on, we have to start waking up goals */ /* from now on, we have to start waking up goals */
Yap_signal(YAP_WAKEUP_SIGNAL); Yap_signal(YAP_WAKEUP_SIGNAL);
@ -58,9 +58,9 @@ AddFailToQueue( USES_REGS1 )
Term WGs; Term WGs;
/* follow the chain */ /* 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) { if ((Term)WGs == TermNil) {
/* from now on, we have to start waking up goals */ /* from now on, we have to start waking up goals */
Yap_signal(YAP_WAKEUP_SIGNAL); Yap_signal(YAP_WAKEUP_SIGNAL);

View File

@ -855,7 +855,7 @@ YAP_LookupAtom(char *c)
while (TRUE) { while (TRUE) {
a = Yap_LookupAtom(c); 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)) { if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage); 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) { while (TRUE) {
a = Yap_LookupWideAtom(c); 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)) { if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage); 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) { while (TRUE) {
at = Yap_FullLookupAtom(c); 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)) { if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage); 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) { if (!ret) {
Term t; Term t;
BallTerm = EX; LOCAL_BallTerm = EX;
EX = NULL; EX = NULL;
if ((t = Yap_GetException())) { if ((t = Yap_GetException())) {
Yap_JumpToEnv(t); Yap_JumpToEnv(t);
@ -1586,7 +1586,7 @@ YAP_ExecuteFirst(PredEntry *pe, CPredicate exec_code)
Int val; Int val;
CPredicateV codev = (CPredicateV)exec_code; CPredicateV codev = (CPredicateV)exec_code;
struct foreign_context *ctx = (struct foreign_context *)(&EXTRA_CBACK_ARG(pe->ArityOfPE,1)); 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 *); extern void PL_close_foreign_frame(struct open_query_struct *);
PP = pe; PP = pe;
@ -1599,13 +1599,13 @@ YAP_ExecuteFirst(PredEntry *pe, CPredicate exec_code)
val = ((codev)(B->cp_args-LCL0,0,ctx)); val = ((codev)(B->cp_args-LCL0,0,ctx));
} }
/* make sure we clean up the frames left by the user */ /* make sure we clean up the frames left by the user */
while (execution != oexec) while (LOCAL_execution != oexec)
PL_close_foreign_frame(execution); PL_close_foreign_frame(LOCAL_execution);
PP = NULL; PP = NULL;
if (val == 0) { if (val == 0) {
Term t; Term t;
BallTerm = EX; LOCAL_BallTerm = EX;
EX = NULL; EX = NULL;
if ((t = Yap_GetException())) { if ((t = Yap_GetException())) {
cut_c_pop(); cut_c_pop();
@ -1628,7 +1628,7 @@ YAP_ExecuteFirst(PredEntry *pe, CPredicate exec_code)
if (!ret) { if (!ret) {
Term t; Term t;
BallTerm = EX; LOCAL_BallTerm = EX;
EX = NULL; EX = NULL;
if ((t = Yap_GetException())) { if ((t = Yap_GetException())) {
Yap_JumpToEnv(t); Yap_JumpToEnv(t);
@ -1651,7 +1651,7 @@ YAP_ExecuteOnCut(PredEntry *pe, CPredicate exec_code, struct cut_c_str *top)
Int val; Int val;
CPredicateV codev = (CPredicateV)exec_code; CPredicateV codev = (CPredicateV)exec_code;
struct foreign_context *ctx = (struct foreign_context *)(&EXTRA_CBACK_ARG(pe->ArityOfPE,1)); 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 *); extern void PL_close_foreign_frame(struct open_query_struct *);
CELL *args = B->cp_args; 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)); val = ((codev)(args-LCL0,0,ctx));
} }
/* make sure we clean up the frames left by the user */ /* make sure we clean up the frames left by the user */
while (execution != oexec) while (LOCAL_execution != oexec)
PL_close_foreign_frame(execution); PL_close_foreign_frame(LOCAL_execution);
PP = NULL; PP = NULL;
// B = LCL0-(CELL*)oB; // B = LCL0-(CELL*)oB;
if (val == 0) { if (val == 0) {
Term t; Term t;
BallTerm = EX; LOCAL_BallTerm = EX;
EX = NULL; EX = NULL;
if ((t = Yap_GetException())) { if ((t = Yap_GetException())) {
cut_c_pop(); cut_c_pop();
@ -1693,7 +1693,7 @@ YAP_ExecuteOnCut(PredEntry *pe, CPredicate exec_code, struct cut_c_str *top)
if (!ret) { if (!ret) {
Term t; Term t;
BallTerm = EX; LOCAL_BallTerm = EX;
EX = NULL; EX = NULL;
if ((t = Yap_GetException())) { if ((t = Yap_GetException())) {
Yap_JumpToEnv(t); Yap_JumpToEnv(t);
@ -1713,7 +1713,7 @@ YAP_ExecuteNext(PredEntry *pe, CPredicate exec_code)
Int val; Int val;
CPredicateV codev = (CPredicateV)exec_code; CPredicateV codev = (CPredicateV)exec_code;
struct foreign_context *ctx = (struct foreign_context *)(&EXTRA_CBACK_ARG(pe->ArityOfPE,1)); 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 *); extern void PL_close_foreign_frame(struct open_query_struct *);
PP = pe; PP = pe;
@ -1724,13 +1724,13 @@ YAP_ExecuteNext(PredEntry *pe, CPredicate exec_code)
val = ((codev)(B->cp_args-LCL0,0,ctx)); val = ((codev)(B->cp_args-LCL0,0,ctx));
} }
/* make sure we clean up the frames left by the user */ /* make sure we clean up the frames left by the user */
while (execution != oexec) while (LOCAL_execution != oexec)
PL_close_foreign_frame(execution); PL_close_foreign_frame(LOCAL_execution);
PP = NULL; PP = NULL;
if (val == 0) { if (val == 0) {
Term t; Term t;
BallTerm = EX; LOCAL_BallTerm = EX;
EX = NULL; EX = NULL;
if ((t = Yap_GetException())) { if ((t = Yap_GetException())) {
cut_c_pop(); cut_c_pop();
@ -1754,7 +1754,7 @@ YAP_ExecuteNext(PredEntry *pe, CPredicate exec_code)
if (!ret) { if (!ret) {
Term t; Term t;
BallTerm = EX; LOCAL_BallTerm = EX;
EX = NULL; EX = NULL;
if ((t = Yap_GetException())) { if ((t = Yap_GetException())) {
Yap_JumpToEnv(t); Yap_JumpToEnv(t);
@ -2196,9 +2196,6 @@ YAP_EnterGoal(PredEntry *pe, Term *ptr, YAP_dogoalinfo *dgi)
CP = YESCODE; CP = YESCODE;
B = myB; B = myB;
HB = H; HB = H;
#if defined(YAPOR) || defined(THREADS)
WPP = NULL;
#endif
ASP = YENV = (CELL *)B; ASP = YENV = (CELL *)B;
YENV[E_CB] = Unsigned (B); YENV[E_CB] = Unsigned (B);
out = run_emulator(dgi); out = run_emulator(dgi);
@ -2276,7 +2273,7 @@ YAP_RunGoal(Term t)
yamop *old_CP = CP; yamop *old_CP = CP;
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
Yap_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
Yap_PrologMode = UserMode; Yap_PrologMode = UserMode;
out = Yap_RunTopGoal(t); out = Yap_RunTopGoal(t);
Yap_PrologMode = UserCCallMode; Yap_PrologMode = UserCCallMode;
@ -2284,11 +2281,11 @@ YAP_RunGoal(Term t)
P = (yamop *)ENV[E_CP]; P = (yamop *)ENV[E_CP];
ENV = (CELL *)ENV[E_E]; ENV = (CELL *)ENV[E_E];
CP = old_CP; CP = old_CP;
Yap_AllowRestart = TRUE; LOCAL_AllowRestart = TRUE;
} else { } else {
ENV = B->cp_env; ENV = B->cp_env;
B = B->cp_b; B = B->cp_b;
Yap_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
} }
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
@ -2327,7 +2324,7 @@ YAP_RunGoalOnce(Term t)
#endif #endif
P = (yamop *)ASP[E_CP]; P = (yamop *)ASP[E_CP];
CP = old_CP; CP = old_CP;
Yap_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
return(out); return(out);
} }
@ -2338,7 +2335,7 @@ YAP_RestartGoal(void)
CACHE_REGS CACHE_REGS
int out; int out;
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
if (Yap_AllowRestart) { if (LOCAL_AllowRestart) {
P = (yamop *)FAILCODE; P = (yamop *)FAILCODE;
do_putcf = myputc; do_putcf = myputc;
Yap_PrologMode = UserMode; Yap_PrologMode = UserMode;
@ -2348,7 +2345,7 @@ YAP_RestartGoal(void)
/* cleanup */ /* cleanup */
Yap_CloseSlots( PASS_REGS1 ); Yap_CloseSlots( PASS_REGS1 );
Yap_trust_last(); Yap_trust_last();
Yap_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
} }
} else { } else {
out = FALSE; out = FALSE;
@ -2363,7 +2360,7 @@ YAP_ShutdownGoal(int backtrack)
CACHE_REGS CACHE_REGS
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
if (Yap_AllowRestart) { if (LOCAL_AllowRestart) {
choiceptr cut_pt; choiceptr cut_pt;
cut_pt = B; cut_pt = B;
@ -2390,7 +2387,7 @@ YAP_ShutdownGoal(int backtrack)
#ifdef DEPTH_LIMIT #ifdef DEPTH_LIMIT
DEPTH = ASP[E_DEPTH]; DEPTH = ASP[E_DEPTH];
#endif #endif
Yap_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
} }
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
return TRUE; return TRUE;
@ -2468,11 +2465,11 @@ YAP_ClearExceptions(void)
CACHE_REGS CACHE_REGS
Yap_ResetExceptionTerm(); Yap_ResetExceptionTerm();
if (EX) { if (EX) {
BallTerm = EX; LOCAL_BallTerm = EX;
} }
EX = NULL; EX = NULL;
Yap_ResetExceptionTerm(); Yap_ResetExceptionTerm();
UncaughtThrow = FALSE; LOCAL_UncaughtThrow = FALSE;
} }
X_API IOSTREAM * X_API IOSTREAM *
@ -2588,7 +2585,7 @@ YAP_CompileClause(Term t)
} }
YAPLeaveCriticalSection(); YAPLeaveCriticalSection();
if (ActiveSignals & YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
if (!Yap_growheap(FALSE, 0, NULL)) { if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
} }

154
C/cdmgr.c
View File

@ -635,26 +635,26 @@ static void
InitConsultStack( void ) InitConsultStack( void )
{ {
CACHE_REGS CACHE_REGS
ConsultLow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity); LOCAL_ConsultLow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
if (ConsultLow == NULL) { if (LOCAL_ConsultLow == NULL) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCodes"); Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCodes");
return; return;
} }
ConsultCapacity = InitialConsultCapacity; LOCAL_ConsultCapacity = InitialConsultCapacity;
ConsultBase = ConsultSp = LOCAL_ConsultBase = LOCAL_ConsultSp =
ConsultLow + ConsultCapacity; LOCAL_ConsultLow + LOCAL_ConsultCapacity;
} }
void void
Yap_ResetConsultStack( void ) Yap_ResetConsultStack( void )
{ {
CACHE_REGS CACHE_REGS
Yap_FreeCodeSpace((char *)ConsultLow); Yap_FreeCodeSpace((char *)LOCAL_ConsultLow);
ConsultBase = LOCAL_ConsultBase =
ConsultSp = LOCAL_ConsultSp =
ConsultLow = LOCAL_ConsultLow =
NULL; NULL;
ConsultCapacity = InitialConsultCapacity; LOCAL_ConsultCapacity = InitialConsultCapacity;
} }
@ -780,9 +780,9 @@ static Term BlobTermInCodeAdjust(Term t)
{ {
CACHE_REGS CACHE_REGS
#if TAGS_FAST_OPS #if TAGS_FAST_OPS
return t-ClDiff; return t-LOCAL_ClDiff;
#else #else
return t+ClDiff; return t+LOCAL_ClDiff;
#endif #endif
} }
@ -863,7 +863,7 @@ Yap_BuildMegaClause(PredEntry *ap)
while (TRUE) { while (TRUE) {
memcpy((void *)ptr, (void *)cl->ClCode, sz); memcpy((void *)ptr, (void *)cl->ClCode, sz);
if (has_blobs) { if (has_blobs) {
ClDiff = (char *)(ptr)-(char *)cl->ClCode; LOCAL_ClDiff = (char *)(ptr)-(char *)cl->ClCode;
restore_opcodes(ptr, NULL PASS_REGS); restore_opcodes(ptr, NULL PASS_REGS);
} }
ptr = (yamop *)((char *)ptr + sz); ptr = (yamop *)((char *)ptr + sz);
@ -965,9 +965,9 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc)
Term tmod = ap->ModuleOfPred; Term tmod = ap->ModuleOfPred;
if (!tmod) if (!tmod)
tmod = TermProlog; tmod = TermProlog;
Yap_DebugPutc(Yap_c_error_stream,'\t'); Yap_DebugPutc(LOCAL_c_error_stream,'\t');
Yap_DebugPlWrite(tmod); Yap_DebugPlWrite(tmod);
Yap_DebugPutc(Yap_c_error_stream,':'); Yap_DebugPutc(LOCAL_c_error_stream,':');
if (ap->ModuleOfPred == IDB_MODULE) { if (ap->ModuleOfPred == IDB_MODULE) {
Term t = Deref(ARG1); Term t = Deref(ARG1);
if (IsAtomTerm(t)) { if (IsAtomTerm(t)) {
@ -978,7 +978,7 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc)
Functor f = FunctorOfTerm(t); Functor f = FunctorOfTerm(t);
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At)); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(LOCAL_c_error_stream,'/');
Yap_DebugPlWrite(MkIntTerm(ArityOfFunctor(f))); Yap_DebugPlWrite(MkIntTerm(ArityOfFunctor(f)));
} }
} else { } else {
@ -989,11 +989,11 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc)
Functor f = ap->FunctorOfPred; Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At)); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(LOCAL_c_error_stream,'/');
Yap_DebugPlWrite(MkIntTerm(ArityOfFunctor(f))); Yap_DebugPlWrite(MkIntTerm(ArityOfFunctor(f)));
} }
} }
Yap_DebugPutc(Yap_c_error_stream,'\n'); Yap_DebugPutc(LOCAL_c_error_stream,'\n');
} }
#endif #endif
/* Do not try to index a dynamic predicate or one whithout args */ /* 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 #ifdef DEBUG
if (Yap_Option['i' - 'a' + 1]) if (Yap_Option['i' - 'a' + 1])
Yap_DebugPutc(Yap_c_error_stream,'\n'); Yap_DebugPutc(LOCAL_c_error_stream,'\n');
#endif #endif
} }
@ -1954,30 +1954,30 @@ static void expand_consult( void )
{ {
CACHE_REGS CACHE_REGS
consult_obj *new_cl, *new_cs; consult_obj *new_cl, *new_cs;
UInt OldConsultCapacity = ConsultCapacity; UInt OldConsultCapacity = LOCAL_ConsultCapacity;
/* now double consult capacity */ /* now double consult capacity */
ConsultCapacity += InitialConsultCapacity; LOCAL_ConsultCapacity += InitialConsultCapacity;
/* I assume it always works ;-) */ /* I assume it always works ;-) */
while ((new_cl = (consult_obj *)Yap_AllocCodeSpace(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)*ConsultCapacity, NULL)) { if (!Yap_growheap(FALSE, sizeof(consult_obj)*LOCAL_ConsultCapacity, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR,TermNil,Yap_ErrorMessage);
return; return;
} }
} }
new_cs = new_cl + InitialConsultCapacity; new_cs = new_cl + InitialConsultCapacity;
/* start copying */ /* 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 */ /* copying done, release old space */
Yap_FreeCodeSpace((char *)ConsultLow); Yap_FreeCodeSpace((char *)LOCAL_ConsultLow);
/* next, set up pointers correctly */ /* next, set up pointers correctly */
new_cs += (ConsultSp-ConsultLow); new_cs += (LOCAL_ConsultSp-LOCAL_ConsultLow);
/* put ConsultBase at same offset as before move */ /* put LOCAL_ConsultBase at same offset as before move */
ConsultBase = ConsultBase+(new_cs-ConsultSp); LOCAL_ConsultBase = LOCAL_ConsultBase+(new_cs-LOCAL_ConsultSp);
/* new consult pointer */ /* new consult pointer */
ConsultSp = new_cs; LOCAL_ConsultSp = new_cs;
/* new end of memory */ /* new end of memory */
ConsultLow = new_cl; LOCAL_ConsultLow = new_cl;
} }
/* p was already locked */ /* p was already locked */
@ -1988,28 +1988,28 @@ not_was_reconsulted(PredEntry *p, Term t, int mode)
register consult_obj *fp; register consult_obj *fp;
Prop p0 = AbsProp((PropEntry *)p); Prop p0 = AbsProp((PropEntry *)p);
if (p == LastAssertedPred) if (p == LOCAL_LastAssertedPred)
return FALSE; return FALSE;
LastAssertedPred = p; LOCAL_LastAssertedPred = p;
if (!ConsultSp) { if (!LOCAL_ConsultSp) {
InitConsultStack(); InitConsultStack();
} }
if (p->cs.p_code.NOfClauses) { if (p->cs.p_code.NOfClauses) {
for (fp = ConsultSp; fp < ConsultBase; ++fp) for (fp = LOCAL_ConsultSp; fp < LOCAL_ConsultBase; ++fp)
if (fp->p == p0) if (fp->p == p0)
break; break;
} else { } else {
fp = ConsultBase; fp = LOCAL_ConsultBase;
} }
if (fp != ConsultBase) if (fp != LOCAL_ConsultBase)
return FALSE; return FALSE;
if (mode) { if (mode) {
if (ConsultSp == ConsultLow+1) { if (LOCAL_ConsultSp == LOCAL_ConsultLow+1) {
expand_consult(); expand_consult();
} }
--ConsultSp; --LOCAL_ConsultSp;
ConsultSp->p = p0; LOCAL_ConsultSp->p = p0;
if (ConsultBase[1].mode && if (LOCAL_ConsultBase[1].mode &&
!(p->PredFlags & MultiFileFlag)) /* we are in reconsult mode */ { !(p->PredFlags & MultiFileFlag)) /* we are in reconsult mode */ {
retract_all(p, static_in_use(p,TRUE)); retract_all(p, static_in_use(p,TRUE));
} }
@ -2508,7 +2508,7 @@ p_compile_dynamic( USES_REGS1 )
else mode = assertz; else mode = assertz;
} else mode = IntegerOfTerm(t1); } else mode = IntegerOfTerm(t1);
/* separate assert in current file from reconsult /* separate assert in current file from reconsult
if (mode == assertz && consult_level && mod == CurrentModule) if (mode == assertz && LOCAL_consult_level && mod == CurrentModule)
mode = consult; mode = consult;
*/ */
old_optimize = optimizer_on; old_optimize = optimizer_on;
@ -2537,10 +2537,10 @@ p_compile_dynamic( USES_REGS1 )
static Atom static Atom
YapConsultingFile ( USES_REGS1 ) YapConsultingFile ( USES_REGS1 )
{ {
if (consult_level == 0) { if (LOCAL_consult_level == 0) {
return(AtomUser); return(AtomUser);
} else { } 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) init_consult(int mode, char *file)
{ {
CACHE_REGS CACHE_REGS
if (!ConsultSp) { if (!LOCAL_ConsultSp) {
InitConsultStack(); InitConsultStack();
} }
ConsultSp--; LOCAL_ConsultSp--;
ConsultSp->filename = file; LOCAL_ConsultSp->filename = file;
ConsultSp--; LOCAL_ConsultSp--;
ConsultSp->mode = mode; LOCAL_ConsultSp->mode = mode;
ConsultSp--; LOCAL_ConsultSp--;
ConsultSp->c = (ConsultBase-ConsultSp); LOCAL_ConsultSp->c = (LOCAL_ConsultBase-LOCAL_ConsultSp);
ConsultBase = ConsultSp; LOCAL_ConsultBase = LOCAL_ConsultSp;
#if !defined(YAPOR) && !defined(YAPOR_SBA) #if !defined(YAPOR) && !defined(YAPOR_SBA)
/* if (consult_level == 0) /* if (LOCAL_consult_level == 0)
do_toggle_static_predicates_in_use(TRUE); */ do_toggle_static_predicates_in_use(TRUE); */
#endif #endif
consult_level++; LOCAL_consult_level++;
LastAssertedPred = NULL; LOCAL_LastAssertedPred = NULL;
} }
void void
@ -2589,7 +2589,7 @@ p_startconsult( USES_REGS1 )
mode = strcmp("consult",smode); mode = strcmp("consult",smode);
init_consult(mode, RepAtom(AtomOfTerm(Deref(ARG2)))->StrOfAE); init_consult(mode, RepAtom(AtomOfTerm(Deref(ARG2)))->StrOfAE);
t = MkIntTerm(consult_level); t = MkIntTerm(LOCAL_consult_level);
return (Yap_unify_constant(ARG3, t)); return (Yap_unify_constant(ARG3, t));
} }
@ -2598,20 +2598,20 @@ p_showconslultlev( USES_REGS1 )
{ {
Term t; Term t;
t = MkIntTerm(consult_level); t = MkIntTerm(LOCAL_consult_level);
return (Yap_unify_constant(ARG1, t)); return (Yap_unify_constant(ARG1, t));
} }
static void static void
end_consult( USES_REGS1 ) end_consult( USES_REGS1 )
{ {
ConsultSp = ConsultBase; LOCAL_ConsultSp = LOCAL_ConsultBase;
ConsultBase = ConsultSp+ConsultSp->c; LOCAL_ConsultBase = LOCAL_ConsultSp+LOCAL_ConsultSp->c;
ConsultSp += 3; LOCAL_ConsultSp += 3;
consult_level--; LOCAL_consult_level--;
LastAssertedPred = NULL; LOCAL_LastAssertedPred = NULL;
#if !defined(YAPOR) && !defined(YAPOR_SBA) #if !defined(YAPOR) && !defined(YAPOR_SBA)
/* if (consult_level == 0) /* if (LOCAL_consult_level == 0)
do_toggle_static_predicates_in_use(FALSE);*/ do_toggle_static_predicates_in_use(FALSE);*/
#endif #endif
} }
@ -4143,20 +4143,20 @@ p_is_call_counted( USES_REGS1 )
static Int static Int
p_call_count_info( USES_REGS1 ) p_call_count_info( USES_REGS1 )
{ {
return(Yap_unify(MkIntegerTerm(ReductionsCounter),ARG1) && return(Yap_unify(MkIntegerTerm(LOCAL_ReductionsCounter),ARG1) &&
Yap_unify(MkIntegerTerm(PredEntriesCounter),ARG2) && Yap_unify(MkIntegerTerm(LOCAL_PredEntriesCounter),ARG2) &&
Yap_unify(MkIntegerTerm(PredEntriesCounter),ARG3)); Yap_unify(MkIntegerTerm(LOCAL_PredEntriesCounter),ARG3));
} }
static Int static Int
p_call_count_reset( USES_REGS1 ) p_call_count_reset( USES_REGS1 )
{ {
ReductionsCounter = 0; LOCAL_ReductionsCounter = 0;
ReductionsCounterOn = FALSE; LOCAL_ReductionsCounterOn = FALSE;
PredEntriesCounter = 0; LOCAL_PredEntriesCounter = 0;
PredEntriesCounterOn = FALSE; LOCAL_PredEntriesCounterOn = FALSE;
RetriesCounter = 0; LOCAL_RetriesCounter = 0;
RetriesCounterOn = FALSE; LOCAL_RetriesCounterOn = FALSE;
return(TRUE); return(TRUE);
} }
@ -4168,14 +4168,14 @@ p_call_count_set( USES_REGS1 )
int do_entries = IntOfTerm(ARG6); int do_entries = IntOfTerm(ARG6);
if (do_calls) if (do_calls)
ReductionsCounter = IntegerOfTerm(Deref(ARG1)); LOCAL_ReductionsCounter = IntegerOfTerm(Deref(ARG1));
ReductionsCounterOn = do_calls; LOCAL_ReductionsCounterOn = do_calls;
if (do_retries) if (do_retries)
RetriesCounter = IntegerOfTerm(Deref(ARG3)); LOCAL_RetriesCounter = IntegerOfTerm(Deref(ARG3));
RetriesCounterOn = do_retries; LOCAL_RetriesCounterOn = do_retries;
if (do_entries) if (do_entries)
PredEntriesCounter = IntegerOfTerm(Deref(ARG5)); LOCAL_PredEntriesCounter = IntegerOfTerm(Deref(ARG5));
PredEntriesCounterOn = do_entries; LOCAL_PredEntriesCounterOn = do_entries;
return(TRUE); return(TRUE);
} }

View File

@ -481,14 +481,14 @@ flt_cmp(Float dif)
static inline Int static inline Int
a_cmp(Term t1, Term t2 USES_REGS) a_cmp(Term t1, Term t2 USES_REGS)
{ {
ArithError = FALSE; LOCAL_ArithError = FALSE;
if (IsVarTerm(t1)) { if (IsVarTerm(t1)) {
ArithError = TRUE; LOCAL_ArithError = TRUE;
Yap_Error(INSTANTIATION_ERROR, t1, "=:=/2"); Yap_Error(INSTANTIATION_ERROR, t1, "=:=/2");
return FALSE; return FALSE;
} }
if (IsVarTerm(t2)) { if (IsVarTerm(t2)) {
ArithError = TRUE; LOCAL_ArithError = TRUE;
Yap_Error(INSTANTIATION_ERROR, t2, "=:=/2"); Yap_Error(INSTANTIATION_ERROR, t2, "=:=/2");
return FALSE; return FALSE;
} }
@ -516,7 +516,7 @@ a_cmp(Term t1, Term t2 USES_REGS)
Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED; Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
Yap_Error_Term = t2; Yap_Error_Term = t2;
Yap_ErrorMessage = "trying to evaluate nan"; Yap_ErrorMessage = "trying to evaluate nan";
ArithError = TRUE; LOCAL_ArithError = TRUE;
} }
#endif #endif
return flt_cmp(i1-f2); 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_TYPE = EVALUATION_ERROR_UNDEFINED;
Yap_Error_Term = t1; Yap_Error_Term = t1;
Yap_ErrorMessage = "trying to evaluate nan"; Yap_ErrorMessage = "trying to evaluate nan";
ArithError = TRUE; LOCAL_ArithError = TRUE;
} }
#endif #endif
t2 = Yap_Eval(t2); t2 = Yap_Eval(t2);
@ -553,7 +553,7 @@ a_cmp(Term t1, Term t2 USES_REGS)
Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED; Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED;
Yap_Error_Term = t2; Yap_Error_Term = t2;
Yap_ErrorMessage = "trying to evaluate nan"; Yap_ErrorMessage = "trying to evaluate nan";
ArithError = TRUE; LOCAL_ArithError = TRUE;
} }
#endif #endif
return flt_cmp(f1-f2); 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_TYPE = EVALUATION_ERROR_UNDEFINED;
Yap_Error_Term = t2; Yap_Error_Term = t2;
Yap_ErrorMessage = "trying to evaluate nan"; Yap_ErrorMessage = "trying to evaluate nan";
ArithError = TRUE; LOCAL_ArithError = TRUE;
} }
#endif #endif
return Yap_gmp_cmp_big_float(t1, f2); return Yap_gmp_cmp_big_float(t1, f2);
@ -603,7 +603,7 @@ p_acomp( USES_REGS1 )
Int out; Int out;
out = a_cmp(t1, t2 PASS_REGS); 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; return out;
} }
@ -637,7 +637,7 @@ a_eq(Term t1, Term t2)
} }
} }
out = a_cmp(t1,t2 PASS_REGS); 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; return out == 0;
} }
@ -646,7 +646,7 @@ a_dif(Term t1, Term t2)
{ {
CACHE_REGS CACHE_REGS
Int out = a_cmp(Deref(t1),Deref(t2) PASS_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; return out != 0;
} }
@ -655,7 +655,7 @@ a_gt(Term t1, Term t2)
{ /* A > B */ { /* A > B */
CACHE_REGS CACHE_REGS
Int out = a_cmp(Deref(t1),Deref(t2) PASS_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; return out > 0;
} }
@ -664,7 +664,7 @@ a_ge(Term t1, Term t2)
{ /* A >= B */ { /* A >= B */
CACHE_REGS CACHE_REGS
Int out = a_cmp(Deref(t1),Deref(t2) PASS_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; return out >= 0;
} }
@ -673,7 +673,7 @@ a_lt(Term t1, Term t2)
{ /* A < B */ { /* A < B */
CACHE_REGS CACHE_REGS
Int out = a_cmp(Deref(t1),Deref(t2) PASS_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; return out < 0;
} }
@ -682,7 +682,7 @@ a_le(Term t1, Term t2)
{ /* A <= B */ { /* A <= B */
CACHE_REGS CACHE_REGS
Int out = a_cmp(Deref(t1),Deref(t2) PASS_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; return out <= 0;
} }

View File

@ -3618,7 +3618,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
#ifdef LOW_PROF #ifdef LOW_PROF
if (ProfilerOn && if (ProfilerOn &&
Yap_OffLineProfiler) { 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 */ #endif /* LOW_PROF */
return(acode); return(acode);

View File

@ -112,9 +112,9 @@ AllocCMem (UInt size, struct intermediates *cip)
blksz = CMEM_BLK_SIZE; blksz = CMEM_BLK_SIZE;
if (!cip->blks) { if (!cip->blks) {
CACHE_REGS CACHE_REGS
if (Yap_CMemFirstBlock) { if (LOCAL_CMemFirstBlock) {
p = Yap_CMemFirstBlock; p = LOCAL_CMemFirstBlock;
blksz = Yap_CMemFirstBlockSz; blksz = LOCAL_CMemFirstBlockSz;
p->u.next = NULL; p->u.next = NULL;
} else { } else {
if (blksz < FIRST_CMEM_BLK_SIZE) if (blksz < FIRST_CMEM_BLK_SIZE)
@ -125,8 +125,8 @@ AllocCMem (UInt size, struct intermediates *cip)
save_machine_regs(); save_machine_regs();
siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH);
} }
Yap_CMemFirstBlock = p; LOCAL_CMemFirstBlock = p;
Yap_CMemFirstBlockSz = blksz; LOCAL_CMemFirstBlockSz = blksz;
} }
} else { } else {
p = (struct mem_blk *)Yap_AllocCodeSpace(blksz); p = (struct mem_blk *)Yap_AllocCodeSpace(blksz);
@ -169,13 +169,13 @@ Yap_ReleaseCMem (struct intermediates *cip)
struct mem_blk *p = cip->blks; struct mem_blk *p = cip->blks;
while (p) { while (p) {
struct mem_blk *nextp = p->u.next; struct mem_blk *nextp = p->u.next;
if (p != Yap_CMemFirstBlock) if (p != LOCAL_CMemFirstBlock)
Yap_FreeCodeSpace((ADDR)p); Yap_FreeCodeSpace((ADDR)p);
p = nextp; p = nextp;
} }
cip->blks = NULL; cip->blks = NULL;
if (cip->label_offset && if (cip->label_offset &&
cip->label_offset != Yap_LabelFirstArray) { cip->label_offset != LOCAL_LabelFirstArray) {
Yap_FreeCodeSpace((ADDR)cip->label_offset); Yap_FreeCodeSpace((ADDR)cip->label_offset);
} }
#endif #endif

View File

@ -505,7 +505,7 @@ static Int p_coroutining( USES_REGS1 )
#if COROUTINING #if COROUTINING
static Term static Term
ListOfWokenGoals( USES_REGS1 ) { ListOfWokenGoals( USES_REGS1 ) {
return Yap_ReadTimedVar(WokenGoals); return Yap_ReadTimedVar(LOCAL_WokenGoals);
} }
Term Term
@ -519,12 +519,12 @@ Yap_ListOfWokenGoals(void) {
static Int p_awoken_goals( USES_REGS1 ) static Int p_awoken_goals( USES_REGS1 )
{ {
#ifdef COROUTINING #ifdef COROUTINING
Term WGs = Yap_ReadTimedVar(WokenGoals); Term WGs = Yap_ReadTimedVar(LOCAL_WokenGoals);
if (WGs == TermNil) { if (WGs == TermNil) {
return(FALSE); return(FALSE);
} }
WGs = ListOfWokenGoals( PASS_REGS1 ); WGs = ListOfWokenGoals( PASS_REGS1 );
Yap_UpdateTimedVar(WokenGoals, TermNil); Yap_UpdateTimedVar(LOCAL_WokenGoals, TermNil);
return(Yap_unify(ARG1,WGs)); return(Yap_unify(ARG1,WGs));
#else #else
return(FALSE); return(FALSE);

View File

@ -12,7 +12,7 @@
static struct malloc_chunk * static struct malloc_chunk *
ChunkPtrAdjust (struct malloc_chunk *ptr) ChunkPtrAdjust (struct malloc_chunk *ptr)
{ {
return (struct malloc_chunk *) ((char *) (ptr) + HDiff); return (struct malloc_chunk *) ((char *) (ptr) + LOCAL_HDiff);
} }

View File

@ -118,15 +118,15 @@ DumpActiveGoals ( USES_REGS1 )
fprintf(stderr,"Active ancestors:\n"); fprintf(stderr,"Active ancestors:\n");
if (pe->ModuleOfPred) mod = pe->ModuleOfPred; if (pe->ModuleOfPred) mod = pe->ModuleOfPred;
Yap_DebugPlWrite (mod); Yap_DebugPlWrite (mod);
Yap_DebugPutc (Yap_c_error_stream,':'); Yap_DebugPutc (LOCAL_c_error_stream,':');
if (pe->ArityOfPE == 0) { if (pe->ArityOfPE == 0) {
Yap_DebugPlWrite (MkAtomTerm ((Atom)f)); Yap_DebugPlWrite (MkAtomTerm ((Atom)f));
} else { } else {
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f))); Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
Yap_DebugPutc (Yap_c_error_stream,'/'); Yap_DebugPutc (LOCAL_c_error_stream,'/');
Yap_DebugPlWrite (MkIntTerm (ArityOfFunctor (f))); Yap_DebugPlWrite (MkIntTerm (ArityOfFunctor (f)));
} }
Yap_DebugPutc (Yap_c_error_stream,'\n'); Yap_DebugPutc (LOCAL_c_error_stream,'\n');
} else { } else {
UNLOCK(pe->PELock); UNLOCK(pe->PELock);
} }
@ -152,21 +152,21 @@ DumpActiveGoals ( USES_REGS1 )
mod = pe->ModuleOfPred; mod = pe->ModuleOfPred;
else mod = TermProlog; else mod = TermProlog;
Yap_DebugPlWrite (mod); Yap_DebugPlWrite (mod);
Yap_DebugPutc (Yap_c_error_stream,':'); Yap_DebugPutc (LOCAL_c_error_stream,':');
if (pe->ArityOfPE == 0) { if (pe->ArityOfPE == 0) {
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor(f))); Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor(f)));
} else { } else {
Int i = 0, arity = pe->ArityOfPE; Int i = 0, arity = pe->ArityOfPE;
Term *args = &(b_ptr->cp_a1); Term *args = &(b_ptr->cp_a1);
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f))); Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
Yap_DebugPutc (Yap_c_error_stream,'('); Yap_DebugPutc (LOCAL_c_error_stream,'(');
for (i= 0; i < arity; i++) { 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_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); UNLOCK(pe->PELock);
b_ptr = b_ptr->cp_b; 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 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 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,"%% %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 #if LOW_LEVEL_TRACER
{ {
extern long long vsc_count; extern long long vsc_count;
@ -396,7 +396,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
where = TermNil; where = TermNil;
#if DEBUG_STRICT #if DEBUG_STRICT
if (Yap_heap_regs && !(Yap_PrologMode & BootMode)) 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 else
fprintf(stderr,"***** Processing Error %d (%x) %s***\n", type,Yap_PrologMode,format); fprintf(stderr,"***** Processing Error %d (%x) %s***\n", type,Yap_PrologMode,format);
#endif #endif
@ -530,27 +530,27 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
break; break;
case CALL_COUNTER_UNDERFLOW: case CALL_COUNTER_UNDERFLOW:
/* Do a long jump */ /* Do a long jump */
ReductionsCounterOn = FALSE; LOCAL_ReductionsCounterOn = FALSE;
PredEntriesCounterOn = FALSE; LOCAL_PredEntriesCounterOn = FALSE;
RetriesCounterOn = FALSE; LOCAL_RetriesCounterOn = FALSE;
Yap_JumpToEnv(MkAtomTerm(AtomCallCounter)); Yap_JumpToEnv(MkAtomTerm(AtomCallCounter));
P = (yamop *)FAILCODE; P = (yamop *)FAILCODE;
Yap_PrologMode &= ~InErrorMode; Yap_PrologMode &= ~InErrorMode;
return(P); return(P);
case PRED_ENTRY_COUNTER_UNDERFLOW: case PRED_ENTRY_COUNTER_UNDERFLOW:
/* Do a long jump */ /* Do a long jump */
ReductionsCounterOn = FALSE; LOCAL_ReductionsCounterOn = FALSE;
PredEntriesCounterOn = FALSE; LOCAL_PredEntriesCounterOn = FALSE;
RetriesCounterOn = FALSE; LOCAL_RetriesCounterOn = FALSE;
Yap_JumpToEnv(MkAtomTerm(AtomCallAndRetryCounter)); Yap_JumpToEnv(MkAtomTerm(AtomCallAndRetryCounter));
P = (yamop *)FAILCODE; P = (yamop *)FAILCODE;
Yap_PrologMode &= ~InErrorMode; Yap_PrologMode &= ~InErrorMode;
return(P); return(P);
case RETRY_COUNTER_UNDERFLOW: case RETRY_COUNTER_UNDERFLOW:
/* Do a long jump */ /* Do a long jump */
ReductionsCounterOn = FALSE; LOCAL_ReductionsCounterOn = FALSE;
PredEntriesCounterOn = FALSE; LOCAL_PredEntriesCounterOn = FALSE;
RetriesCounterOn = FALSE; LOCAL_RetriesCounterOn = FALSE;
Yap_JumpToEnv(MkAtomTerm(AtomRetryCounter)); Yap_JumpToEnv(MkAtomTerm(AtomRetryCounter));
P = (yamop *)FAILCODE; P = (yamop *)FAILCODE;
Yap_PrologMode &= ~InErrorMode; Yap_PrologMode &= ~InErrorMode;
@ -1859,21 +1859,21 @@ E);
} }
if (serious) { if (serious) {
/* disable active signals at this point */ /* disable active signals at this point */
ActiveSignals = 0; LOCAL_ActiveSignals = 0;
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
Yap_PrologMode &= ~InErrorMode; Yap_PrologMode &= ~InErrorMode;
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
/* we might be in the middle of a critical region */ /* we might be in the middle of a critical region */
if (Yap_InterruptsDisabled) { if (LOCAL_InterruptsDisabled) {
Yap_InterruptsDisabled = 0; LOCAL_InterruptsDisabled = 0;
UncaughtThrow = TRUE; LOCAL_UncaughtThrow = TRUE;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
#if PUSH_REGS #if PUSH_REGS
restore_absmi_regs(&Yap_standard_regs); restore_absmi_regs(&Yap_standard_regs);
#endif #endif
siglongjmp(Yap_RestartEnv,1); siglongjmp(Yap_RestartEnv,1);
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
/* wait if we we are in user code, /* wait if we we are in user code,
it's up to her to decide */ it's up to her to decide */

View File

@ -40,7 +40,7 @@ static Term
Eval(Term t USES_REGS) Eval(Term t USES_REGS)
{ {
if (IsVarTerm(t)) { if (IsVarTerm(t)) {
ArithError = TRUE; LOCAL_ArithError = TRUE;
return Yap_ArithError(INSTANTIATION_ERROR,t,"in arithmetic"); return Yap_ArithError(INSTANTIATION_ERROR,t,"in arithmetic");
} else if (IsNumTerm(t)) { } else if (IsNumTerm(t)) {
return t; return t;
@ -151,7 +151,7 @@ Yap_ArithError(yap_error_number type, Term where, char *format,...)
CACHE_REGS CACHE_REGS
va_list ap; va_list ap;
ArithError = TRUE; LOCAL_ArithError = TRUE;
Yap_Error_TYPE = type; Yap_Error_TYPE = type;
Yap_Error_Term = where; Yap_Error_Term = where;
if (!Yap_ErrorMessage) if (!Yap_ErrorMessage)

112
C/exec.c
View File

@ -160,15 +160,15 @@ do_execute(Term t, Term mod USES_REGS)
/* first do predicate expansion, even before you process signals. /* first do predicate expansion, even before you process signals.
This way you don't get to spy goal_expansion(). */ This way you don't get to spy goal_expansion(). */
if (PRED_GOAL_EXPANSION_ALL) { if (PRED_GOAL_EXPANSION_ALL) {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
/* disable creeping when we do goal expansion */ /* disable creeping when we do goal expansion */
if (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) {
ActiveSignals &= ~YAP_CREEP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return CallMetaCall(mod PASS_REGS); return CallMetaCall(mod PASS_REGS);
} else if (ActiveSignals && !Yap_InterruptsDisabled) { } else if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) {
return EnterCreepMode(t, mod PASS_REGS); return EnterCreepMode(t, mod PASS_REGS);
} }
restart_exec: 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); return CallError(TYPE_ERROR_CALLABLE, mod PASS_REGS);
} }
if (PRED_GOAL_EXPANSION_ALL) { if (PRED_GOAL_EXPANSION_ALL) {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
/* disable creeping when we do goal expansion */ /* disable creeping when we do goal expansion */
if (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) {
ActiveSignals &= ~YAP_CREEP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
ARG1 = copy_execn_to_heap(f, pt, n, arity, mod PASS_REGS); ARG1 = copy_execn_to_heap(f, pt, n, arity, mod PASS_REGS);
return CallMetaCall(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); return EnterCreepMode(copy_execn_to_heap(f, pt, n, arity, CurrentModule PASS_REGS), mod PASS_REGS);
} }
if (arity > MaxTemps) { if (arity > MaxTemps) {
@ -378,12 +378,12 @@ static Int
EnterCreepMode(Term t, Term mod USES_REGS) { EnterCreepMode(Term t, Term mod USES_REGS) {
PredEntry *PredCreep; PredEntry *PredCreep;
if (ActiveSignals & YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) {
ARG1 = t; ARG1 = t;
if (!Yap_growheap(FALSE, 0, NULL)) { if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap at meta-call"); 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); return do_execute(ARG1, mod PASS_REGS);
} }
} }
@ -394,9 +394,9 @@ EnterCreepMode(Term t, Term mod USES_REGS) {
} else { } else {
ARG1 = MkPairTerm(TermProlog,t); ARG1 = MkPairTerm(TermProlog,t);
} }
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
P_before_spy = P; P_before_spy = P;
return CallPredicate(PredCreep, B, PredCreep->CodeOfPred PASS_REGS); return CallPredicate(PredCreep, B, PredCreep->CodeOfPred PASS_REGS);
} }
@ -631,7 +631,7 @@ p_execute_clause( USES_REGS1 )
} else { } else {
code = Yap_ClauseFromTerm(clt)->ClCode; code = Yap_ClauseFromTerm(clt)->ClCode;
} }
if (ActiveSignals & YAP_CREEP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
Yap_signal(YAP_CREEP_SIGNAL); Yap_signal(YAP_CREEP_SIGNAL);
} }
return CallPredicate(RepPredProp(pe), cut_cp, code PASS_REGS); return CallPredicate(RepPredProp(pe), cut_cp, code PASS_REGS);
@ -651,7 +651,7 @@ p_execute0( USES_REGS1 )
unsigned int arity; unsigned int arity;
Prop pe; Prop pe;
if (ActiveSignals && !Yap_InterruptsDisabled) { if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) {
return EnterCreepMode(t, mod PASS_REGS); return EnterCreepMode(t, mod PASS_REGS);
} }
restart_exec: restart_exec:
@ -781,7 +781,7 @@ p_execute_nonstop( USES_REGS1 )
/* N = arity; */ /* N = arity; */
/* call may not define new system predicates!! */ /* call may not define new system predicates!! */
if (RepPredProp(pe)->PredFlags & SpiedPredFlag) { 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); Yap_signal(YAP_CREEP_SIGNAL);
} }
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
@ -791,8 +791,8 @@ p_execute_nonstop( USES_REGS1 )
} }
#endif #endif
return CallPredicate(RepPredProp(pe), B, RepPredProp(pe)->cs.p_code.TrueCodeOfPred PASS_REGS); return CallPredicate(RepPredProp(pe), B, RepPredProp(pe)->cs.p_code.TrueCodeOfPred PASS_REGS);
} else { if (ActiveSignals & YAP_CREEP_SIGNAL && } else { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL &&
!Yap_InterruptsDisabled && !LOCAL_InterruptsDisabled &&
(!(RepPredProp(pe)->PredFlags & (AsmPredFlag|CPredFlag)) || (!(RepPredProp(pe)->PredFlags & (AsmPredFlag|CPredFlag)) ||
RepPredProp(pe)->OpcodeOfPred == Yap_opcode(_call_bfunc_xx))) { RepPredProp(pe)->OpcodeOfPred == Yap_opcode(_call_bfunc_xx))) {
Yap_signal(YAP_CREEP_SIGNAL); Yap_signal(YAP_CREEP_SIGNAL);
@ -962,12 +962,12 @@ exec_absmi(int top USES_REGS)
/* set stack */ /* set stack */
ASP = (CELL *)PROTECT_FROZEN_B(B); ASP = (CELL *)PROTECT_FROZEN_B(B);
Yap_StartSlots( PASS_REGS1 ); Yap_StartSlots( PASS_REGS1 );
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
/* forget any signals active, we're reborne */ /* forget any signals active, we're reborne */
ActiveSignals = 0; LOCAL_ActiveSignals = 0;
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
Yap_PrologMode = UserMode; Yap_PrologMode = UserMode;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
P = (yamop *)FAILCODE; P = (yamop *)FAILCODE;
} }
break; break;
@ -999,8 +999,8 @@ exec_absmi(int top USES_REGS)
out = Yap_absmi(0); out = Yap_absmi(0);
Yap_StartSlots( PASS_REGS1 ); Yap_StartSlots( PASS_REGS1 );
/* make sure we don't leave a FAIL signal hanging around */ /* make sure we don't leave a FAIL signal hanging around */
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
return out; return out;
} }
@ -1048,9 +1048,6 @@ init_stack(int arity, CELL *pt, int top, choiceptr saved_b USES_REGS)
#endif /* DEPTH_LIMIT */ #endif /* DEPTH_LIMIT */
YENV = ASP = (CELL *)B; YENV = ASP = (CELL *)B;
HB = H; HB = H;
#if defined(YAPOR) || defined(THREADS)
WPP = NULL;
#endif
/* start with some slots so that we can use them */ /* start with some slots so that we can use them */
Yap_StartSlots( PASS_REGS1 ); Yap_StartSlots( PASS_REGS1 );
CP = YESCODE; CP = YESCODE;
@ -1475,7 +1472,7 @@ JumpToEnv(Term t USES_REGS) {
if (EX) if (EX)
return FALSE; return FALSE;
/* just keep the throwed object away, we don't need to care about it */ /* 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 */ /* fat chance */
siglongjmp(Yap_RestartEnv,1); siglongjmp(Yap_RestartEnv,1);
} }
@ -1509,13 +1506,13 @@ JumpToEnv(Term t USES_REGS) {
/* we reached C-Code */ /* we reached C-Code */
if (handler->cp_ap == NOCODE) { if (handler->cp_ap == NOCODE) {
/* up to the C-code to deal with this! */ /* up to the C-code to deal with this! */
UncaughtThrow = TRUE; LOCAL_UncaughtThrow = TRUE;
if (previous == NULL) if (previous == NULL)
B = handler; B = handler;
else else
previous->cp_b = handler; previous->cp_b = handler;
EX = BallTerm; EX = LOCAL_BallTerm;
BallTerm = NULL; LOCAL_BallTerm = NULL;
P = (yamop *)FAILCODE; P = (yamop *)FAILCODE;
/* make sure failure will be seen at next port */ /* make sure failure will be seen at next port */
if (Yap_PrologMode & AsyncIntMode) { if (Yap_PrologMode & AsyncIntMode) {
@ -1528,7 +1525,7 @@ JumpToEnv(Term t USES_REGS) {
} }
/* uncaught throw */ /* uncaught throw */
if (handler == NULL) { if (handler == NULL) {
UncaughtThrow = TRUE; LOCAL_UncaughtThrow = TRUE;
#if PUSH_REGS #if PUSH_REGS
restore_absmi_regs(&Yap_standard_regs); restore_absmi_regs(&Yap_standard_regs);
#endif #endif
@ -1643,26 +1640,25 @@ Yap_InitYaamRegs(void)
BBREG = B_FZ = (choiceptr) Yap_LocalBase; BBREG = B_FZ = (choiceptr) Yap_LocalBase;
TR = TR_FZ = (tr_fr_ptr) Yap_TrailBase; TR = TR_FZ = (tr_fr_ptr) Yap_TrailBase;
#endif /* FROZEN_STACKS */ #endif /* FROZEN_STACKS */
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
EX = NULL; EX = NULL;
init_stack(0, NULL, TRUE, NULL PASS_REGS); init_stack(0, NULL, TRUE, NULL PASS_REGS);
/* the first real choice-point will also have AP=FAIL */ /* the first real choice-point will also have AP=FAIL */
/* always have an empty slots for people to use */ /* always have an empty slots for people to use */
CurSlot = 0; CurSlot = 0;
GlobalArena = TermNil; LOCAL_GlobalArena = TermNil;
h0var = MkVarTerm(); h0var = MkVarTerm();
#if COROUTINING #if COROUTINING
WokenGoals = Yap_NewTimedVar(TermNil); LOCAL_WokenGoals = Yap_NewTimedVar(TermNil);
AttsMutableList = Yap_NewTimedVar(h0var); LOCAL_AttsMutableList = Yap_NewTimedVar(h0var);
#endif #endif
GcGeneration = Yap_NewTimedVar(h0var); LOCAL_GcGeneration = Yap_NewTimedVar(h0var);
GcCurrentPhase = 0L; LOCAL_GcCurrentPhase = 0L;
GcPhase = Yap_NewTimedVar(MkIntTerm(GcCurrentPhase)); LOCAL_GcPhase = Yap_NewTimedVar(MkIntTerm(LOCAL_GcCurrentPhase));
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
PP = NULL; PP = NULL;
WPP = NULL;
PREG_ADDR = NULL; PREG_ADDR = NULL;
#endif #endif
Yap_AllocateDefaultArena(128*1024, 2); Yap_AllocateDefaultArena(128*1024, 2);
@ -1678,8 +1674,8 @@ Yap_InitYaamRegs(void)
static Int static Int
p_uncaught_throw( USES_REGS1 ) p_uncaught_throw( USES_REGS1 )
{ {
Int out = UncaughtThrow; Int out = LOCAL_UncaughtThrow;
UncaughtThrow = FALSE; /* just caught it */ LOCAL_UncaughtThrow = FALSE; /* just caught it */
return out; return out;
} }
@ -1687,14 +1683,14 @@ static Int
p_creep_allowed( USES_REGS1 ) p_creep_allowed( USES_REGS1 )
{ {
if (PP != NULL) { if (PP != NULL) {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) {
ActiveSignals &= ~YAP_CREEP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
} else { } else {
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
} }
return TRUE; return TRUE;
} }
@ -1706,15 +1702,15 @@ p_debug_on( USES_REGS1 )
{ {
Term t = Deref(ARG1); Term t = Deref(ARG1);
if (IsVarTerm(t)) { if (IsVarTerm(t)) {
if (DebugOn) if (LOCAL_DebugOn)
return Yap_unify(MkAtomTerm(AtomTrue),ARG1); return Yap_unify(MkAtomTerm(AtomTrue),ARG1);
else else
return Yap_unify(MkAtomTerm(AtomFalse),ARG1); return Yap_unify(MkAtomTerm(AtomFalse),ARG1);
} }
if (t == MkAtomTerm(AtomTrue)) if (t == MkAtomTerm(AtomTrue))
DebugOn = TRUE; LOCAL_DebugOn = TRUE;
else else
DebugOn = FALSE; LOCAL_DebugOn = FALSE;
return TRUE; return TRUE;
} }
@ -1723,9 +1719,9 @@ Yap_GetException(void)
{ {
CACHE_REGS CACHE_REGS
Term t = 0L; Term t = 0L;
if (BallTerm) { if (LOCAL_BallTerm) {
do { do {
t = Yap_PopTermFromDB(BallTerm); t = Yap_PopTermFromDB(LOCAL_BallTerm);
if (t == 0) { if (t == 0) {
if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
Yap_Error_TYPE = YAP_NO_ERROR; Yap_Error_TYPE = YAP_NO_ERROR;
@ -1735,14 +1731,14 @@ Yap_GetException(void)
} }
} else { } else {
Yap_Error_TYPE = YAP_NO_ERROR; 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); Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
return FALSE; return FALSE;
} }
} }
} }
} while (t == 0); } while (t == 0);
BallTerm = NULL; LOCAL_BallTerm = NULL;
} }
return t; return t;
} }
@ -1762,8 +1758,8 @@ void
Yap_ResetExceptionTerm(void) Yap_ResetExceptionTerm(void)
{ {
CACHE_REGS CACHE_REGS
Yap_ReleaseTermFromDB(BallTerm); Yap_ReleaseTermFromDB(LOCAL_BallTerm);
BallTerm = NULL; LOCAL_BallTerm = NULL;
} }
static Int static Int

View File

@ -146,7 +146,7 @@ p_allocate_arena( USES_REGS1 )
static Int static Int
p_default_arena_size( USES_REGS1 ) 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) Yap_AllocateDefaultArena(Int gsize, Int attsize)
{ {
CACHE_REGS CACHE_REGS
GlobalArena = NewArena(gsize, 2, NULL PASS_REGS); LOCAL_GlobalArena = NewArena(gsize, 2, NULL PASS_REGS);
} }
static void static void
@ -172,7 +172,7 @@ adjust_cps(UInt size USES_REGS)
static int static int
GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity USES_REGS) GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity USES_REGS)
{ {
ArenaOverflows++; LOCAL_ArenaOverflows++;
if (size == 0) { if (size == 0) {
if (old_size < 128*1024) { if (old_size < 128*1024) {
size = old_size; size = old_size;
@ -201,7 +201,7 @@ GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity USES_REGS)
} else { } else {
XREGS[arity+1] = arena; XREGS[arity+1] = arena;
/* try to recover some room */ /* 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))) { if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage); Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
return FALSE; return FALSE;
@ -720,8 +720,8 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
HB = oldHB; HB = oldHB;
switch (res) { switch (res) {
case -1: case -1:
if (arena == GlobalArena) if (arena == LOCAL_GlobalArena)
GlobalArenaOverflows++; LOCAL_GlobalArenaOverflows++;
if (!GrowArena(arena, old_top, old_size, min_grow, arity+3 PASS_REGS)) { if (!GrowArena(arena, old_top, old_size, min_grow, arity+3 PASS_REGS)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
return 0L; return 0L;
@ -774,8 +774,8 @@ CreateTermInArena(Term arena, Atom Na, UInt Nar, UInt arity, Term *newarena, Ter
ASP = oldASP; ASP = oldASP;
H = oldH; H = oldH;
HB = oldHB; HB = oldHB;
if (arena == GlobalArena) if (arena == LOCAL_GlobalArena)
GlobalArenaOverflows++; LOCAL_GlobalArenaOverflows++;
if (!GrowArena(arena, old_top, old_size, Nar*sizeof(CELL), arity+2 PASS_REGS)) { 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"); Yap_Error(OUT_OF_STACK_ERROR, TermNil, "while creating large global term");
return 0L; return 0L;
@ -855,8 +855,8 @@ GetGlobalEntry(Atom at USES_REGS)
#if THREADS #if THREADS
new->owner_id = worker_id; new->owner_id = worker_id;
#endif #endif
new->NextGE = GlobalVariables; new->NextGE = LOCAL_GlobalVariables;
GlobalVariables = new; LOCAL_GlobalVariables = new;
new->AtomOfGE = ae; new->AtomOfGE = ae;
new->NextOfPE = ae->PropsOfAE; new->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsGlobalProp(new); ae->PropsOfAE = AbsGlobalProp(new);
@ -869,8 +869,8 @@ static UInt
garena_overflow_size(CELL *arena USES_REGS) garena_overflow_size(CELL *arena USES_REGS)
{ {
UInt dup = (((CELL *)arena-H0)*sizeof(CELL))>>3; UInt dup = (((CELL *)arena-H0)*sizeof(CELL))>>3;
if (dup < 64*1024*GlobalArenaOverflows) if (dup < 64*1024*LOCAL_GlobalArenaOverflows)
dup = 64*1024*GlobalArenaOverflows; dup = 64*1024*LOCAL_GlobalArenaOverflows;
if (dup > 1024*1024) if (dup > 1024*1024)
return 1024*1024; return 1024*1024;
return dup; return dup;
@ -911,7 +911,7 @@ p_nb_setarg( USES_REGS1 )
return FALSE; return FALSE;
to = Deref(ARG3); 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) if (to == 0L)
return FALSE; return FALSE;
@ -958,7 +958,7 @@ p_nb_set_shared_arg( USES_REGS1 )
} }
if (pos < 1 || pos > arity) if (pos < 1 || pos > arity)
return FALSE; 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) if (to == 0L)
return FALSE; return FALSE;
destp[pos] = to; destp[pos] = to;
@ -1041,7 +1041,7 @@ p_nb_create_accumulator( USES_REGS1 )
if (!Yap_unify(ARG2, acct)) { if (!Yap_unify(ARG2, acct)) {
return FALSE; 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) if (to == 0L)
return FALSE; return FALSE;
destp = RepAppl(Deref(ARG2)); destp = RepAppl(Deref(ARG2));
@ -1091,7 +1091,7 @@ p_nb_add_to_accumulator( USES_REGS1 )
target[1] = source[1]; target[1] = source[1];
} else { } else {
/* we need to create a new long int */ /* 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 = RepAppl(Deref(ARG1));
destp[1] = new; destp[1] = new;
} }
@ -1118,7 +1118,7 @@ p_nb_add_to_accumulator( USES_REGS1 )
new = Yap_MkApplTerm(FunctorPlus, 2, t2); new = Yap_MkApplTerm(FunctorPlus, 2, t2);
new = Yap_Eval(new); 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 = RepAppl(Deref(ARG1));
destp[1] = new; destp[1] = new;
@ -1158,7 +1158,7 @@ Yap_SetGlobalVal(Atom at, Term t0)
Term to; Term to;
GlobalEntry *ge; GlobalEntry *ge;
ge = GetGlobalEntry(at PASS_REGS); 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) if (to == 0L)
return to; return to;
WRITE_LOCK(ge->GRWLock); WRITE_LOCK(ge->GRWLock);
@ -1172,7 +1172,7 @@ Yap_SaveTerm(Term t0)
{ {
CACHE_REGS CACHE_REGS
Term to; 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) if (to == 0L)
return to; return to;
return to; return to;
@ -1205,7 +1205,7 @@ p_nb_set_shared_val( USES_REGS1 )
return (FALSE); return (FALSE);
} }
ge = GetGlobalEntry(AtomOfTerm(t) PASS_REGS); 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) if (to == 0L)
return FALSE; return FALSE;
WRITE_LOCK(ge->GRWLock); WRITE_LOCK(ge->GRWLock);
@ -1295,10 +1295,10 @@ nbdelete(Atom at USES_REGS)
} }
WRITE_LOCK(ge->GRWLock); WRITE_LOCK(ge->GRWLock);
ae = ge->AtomOfGE; ae = ge->AtomOfGE;
if (GlobalVariables == ge) { if (LOCAL_GlobalVariables == ge) {
GlobalVariables = ge->NextGE; LOCAL_GlobalVariables = ge->NextGE;
} else { } else {
g = GlobalVariables; g = LOCAL_GlobalVariables;
while (g->NextGE != ge) while (g->NextGE != ge)
g = g->NextGE; g = g->NextGE;
g->NextGE = ge->NextGE; g->NextGE = ge->NextGE;
@ -1376,7 +1376,7 @@ p_nb_create( USES_REGS1 )
Yap_Error(TYPE_ERROR_ATOM,tname,"nb_create"); Yap_Error(TYPE_ERROR_ATOM,tname,"nb_create");
return FALSE; 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) if (!to)
return FALSE; return FALSE;
WRITE_LOCK(ge->GRWLock); WRITE_LOCK(ge->GRWLock);
@ -1428,7 +1428,7 @@ p_nb_create2( USES_REGS1 )
Yap_Error(TYPE_ERROR_ATOM,tname,"nb_create"); Yap_Error(TYPE_ERROR_ATOM,tname,"nb_create");
return FALSE; 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) if (!to)
return FALSE; return FALSE;
WRITE_LOCK(ge->GRWLock); 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 queue_arena, queue, ar[QUEUE_FUNCTOR_ARITY], *nar;
Term t = Deref(ARG1); Term t = Deref(ARG1);
DepthArenas++; LOCAL_DepthArenas++;
if (!IsVarTerm(t)) { if (!IsVarTerm(t)) {
if (!IsApplTerm(t)) { if (!IsApplTerm(t)) {
return FALSE; return FALSE;
@ -1475,8 +1475,8 @@ static Int
p_nb_queue( USES_REGS1 ) p_nb_queue( USES_REGS1 )
{ {
UInt arena_sz = (ASP-H)/16; UInt arena_sz = (ASP-H)/16;
if (DepthArenas > 1) if (LOCAL_DepthArenas > 1)
arena_sz /= DepthArenas; arena_sz /= LOCAL_DepthArenas;
if (arena_sz < MIN_ARENA_SIZE) if (arena_sz < MIN_ARENA_SIZE)
arena_sz = MIN_ARENA_SIZE; arena_sz = MIN_ARENA_SIZE;
if (arena_sz > MAX_ARENA_SIZE) if (arena_sz > MAX_ARENA_SIZE)
@ -1556,7 +1556,7 @@ p_nb_queue_close( USES_REGS1 )
Term t = Deref(ARG1); Term t = Deref(ARG1);
Int out; Int out;
DepthArenas--; LOCAL_DepthArenas--;
if (!IsVarTerm(t)) { if (!IsVarTerm(t)) {
CELL *qp; CELL *qp;
@ -2531,7 +2531,7 @@ init_current_nb( USES_REGS1 )
} }
} }
READ_LOCK(HashChain[0].AERWLock); 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 ); return cont_current_nb( PASS_REGS1 );
} }

190
C/grow.c
View File

@ -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); 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 #endif
/* The old stack pointers */ /* The old stack pointers */
OldLCL0 = LCL0; LOCAL_OldLCL0 = LCL0;
OldASP = ASP; LOCAL_OldASP = ASP;
OldGlobalBase = (CELL *)Yap_GlobalBase; LOCAL_OldGlobalBase = (CELL *)Yap_GlobalBase;
OldH = H; LOCAL_OldH = H;
OldH0 = H0; LOCAL_OldH0 = H0;
OldTrailBase = Yap_TrailBase; LOCAL_OldTrailBase = Yap_TrailBase;
OldTrailTop = Yap_TrailTop; LOCAL_OldTrailTop = Yap_TrailTop;
OldTR = TR; LOCAL_OldTR = TR;
OldHeapBase = Yap_HeapBase; LOCAL_OldHeapBase = Yap_HeapBase;
OldHeapTop = HeapTop; LOCAL_OldHeapTop = HeapTop;
/* Adjust stack addresses */ /* Adjust stack addresses */
Yap_TrailBase = TrailAddrAdjust(Yap_TrailBase); Yap_TrailBase = TrailAddrAdjust(Yap_TrailBase);
Yap_TrailTop = TrailAddrAdjust(Yap_TrailTop); Yap_TrailTop = TrailAddrAdjust(Yap_TrailTop);
if (GDiff) { if (LOCAL_GDiff) {
/* make sure we are not just expanding the delay stack */ /* make sure we are not just expanding the delay stack */
Yap_GlobalBase = BaseAddrAdjust(Yap_GlobalBase); Yap_GlobalBase = BaseAddrAdjust(Yap_GlobalBase);
} }
@ -157,10 +157,10 @@ SetHeapRegs(int copying_threads USES_REGS)
ASP = PtoLocAdjust(ASP); ASP = PtoLocAdjust(ASP);
if (H0) if (H0)
H0 = PtoGloAdjust(H0); H0 = PtoGloAdjust(H0);
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (LCL0) if (LCL0)
LCL0 = PtoLocAdjust(LCL0); LCL0 = PtoLocAdjust(LCL0);
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
if (H) if (H)
H = PtoGloAdjust(H); H = PtoGloAdjust(H);
#ifdef CUT_C #ifdef CUT_C
@ -190,17 +190,17 @@ SetHeapRegs(int copying_threads USES_REGS)
else if (IsOldLocalPtr(S)) else if (IsOldLocalPtr(S))
S = PtoLocAdjust(S); S = PtoLocAdjust(S);
if (!copying_threads) { if (!copying_threads) {
if (GlobalArena) if (LOCAL_GlobalArena)
GlobalArena = AbsAppl(PtoGloAdjust(RepAppl(GlobalArena))); LOCAL_GlobalArena = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_GlobalArena)));
} }
#ifdef COROUTINING #ifdef COROUTINING
if (AttsMutableList) if (LOCAL_AttsMutableList)
AttsMutableList = AbsAppl(PtoGloAdjust(RepAppl(AttsMutableList))); LOCAL_AttsMutableList = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_AttsMutableList)));
if (WokenGoals) if (LOCAL_WokenGoals)
WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(WokenGoals))); LOCAL_WokenGoals = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_WokenGoals)));
#endif #endif
GcGeneration = AbsAppl(PtoGloAdjust(RepAppl(GcGeneration))); LOCAL_GcGeneration = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_GcGeneration)));
GcPhase = AbsAppl(PtoGloAdjust(RepAppl(GcPhase))); LOCAL_GcPhase = AbsAppl(PtoGloAdjust(RepAppl(LOCAL_GcPhase)));
} }
static void static void
@ -208,9 +208,9 @@ MoveLocalAndTrail( USES_REGS1 )
{ {
/* cpcellsd(To,From,NOfCells) - copy the cells downwards */ /* cpcellsd(To,From,NOfCells) - copy the cells downwards */
#if USE_SYSTEM_MALLOC #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 #else
cpcellsd(ASP, OldASP, (CELL *)OldTR - OldASP); cpcellsd(ASP, LOCAL_OldASP, (CELL *)LOCAL_OldTR - LOCAL_OldASP);
#endif #endif
} }
@ -221,7 +221,7 @@ CopyLocalAndTrail( USES_REGS1 )
{ {
/* cpcellsd(To,From,NOfCells) - copy the cells downwards */ /* cpcellsd(To,From,NOfCells) - copy the cells downwards */
#if USE_SYSTEM_MALLOC #if USE_SYSTEM_MALLOC
cpcellsd((void *)ASP, (void *)OldASP, (CELL *)OldTR - OldASP); cpcellsd((void *)ASP, (void *)LOCAL_OldASP, (CELL *)LOCAL_OldTR - LOCAL_OldASP);
#endif #endif
} }
@ -319,7 +319,7 @@ MoveGlobal( USES_REGS1 )
* cpcellsd(To,From,NOfCells) - copy the cells downwards - in * cpcellsd(To,From,NOfCells) - copy the cells downwards - in
* absmi.asm * 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 static void
@ -329,7 +329,7 @@ MoveExpandedGlobal( USES_REGS1 )
* cpcellsd(To,From,NOfCells) - copy the cells downwards - in * cpcellsd(To,From,NOfCells) - copy the cells downwards - in
* absmi.asm * 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 static void
@ -340,9 +340,9 @@ MoveGlobalWithHole( USES_REGS1 )
* absmi.asm * absmi.asm
*/ */
#if USE_SYSTEM_MALLOC #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 #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 #endif
} }
@ -353,9 +353,9 @@ MoveHalfGlobal(CELL *OldPt USES_REGS)
* cpcellsd(To,From,NOfCells) - copy the cells downwards - in * cpcellsd(To,From,NOfCells) - copy the cells downwards - in
* absmi.asm * absmi.asm
*/ */
UInt diff = OldH-OldPt; UInt diff = LOCAL_OldH-OldPt;
CELL *NewPt = (CELL *)((char*)OldPt+GDiff); CELL *NewPt = (CELL *)((char*)OldPt+LOCAL_GDiff);
CELL *IntPt = (CELL *)((char*)OldPt+GDiff0); CELL *IntPt = (CELL *)((char*)OldPt+LOCAL_GDiff0);
cpcellsd(NewPt, IntPt, diff); cpcellsd(NewPt, IntPt, diff);
} }
@ -518,9 +518,9 @@ static void
AdjustGlobal(long sz, int thread_copying USES_REGS) AdjustGlobal(long sz, int thread_copying USES_REGS)
{ {
CELL *pt, *pt_max; CELL *pt, *pt_max;
ArrayEntry *al = DynamicArrays; ArrayEntry *al = LOCAL_DynamicArrays;
StaticArrayEntry *sal = StaticArrays; StaticArrayEntry *sal = LOCAL_StaticArrays;
GlobalEntry *gl = GlobalVariables; GlobalEntry *gl = LOCAL_GlobalVariables;
while (al) { while (al) {
al->ValueOfVE = AdjustGlobTerm(al->ValueOfVE PASS_REGS); 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); fprintf(Yap_stderr, "%% growing the heap %ld bytes\n", size);
} }
/* CreepFlag is set to force heap expansion */ /* CreepFlag is set to force heap expansion */
if (ActiveSignals == YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
} }
ASP -= 256; ASP -= 256;
YAPEnterCriticalSection(); YAPEnterCriticalSection();
TrDiff = LDiff = GDiff = GDiff0 = DelayDiff = BaseDiff = size; LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff = size;
XDiff = HDiff = 0; LOCAL_XDiff = LOCAL_HDiff = 0;
GSplit = NULL; LOCAL_GSplit = NULL;
SetHeapRegs(FALSE PASS_REGS); SetHeapRegs(FALSE PASS_REGS);
MoveLocalAndTrail( PASS_REGS1 ); MoveLocalAndTrail( PASS_REGS1 );
if (fix_code) { if (fix_code) {
CELL *SaveOldH = OldH; CELL *SaveOldH = LOCAL_OldH;
OldH = (CELL *)cip->freep; LOCAL_OldH = (CELL *)cip->freep;
MoveGlobal( PASS_REGS1 ); MoveGlobal( PASS_REGS1 );
OldH = SaveOldH; LOCAL_OldH = SaveOldH;
} else { } else {
MoveGlobal( PASS_REGS1 ); MoveGlobal( PASS_REGS1 );
} }
@ -949,40 +949,40 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
/* we got over a hole */ /* we got over a hole */
if (minimal_request) { if (minimal_request) {
/* we went over a hole */ /* we went over a hole */
BaseDiff = size+((CELL)Yap_TrailTop-(CELL)Yap_GlobalBase)-minimal_request; LOCAL_BaseDiff = size+((CELL)Yap_TrailTop-(CELL)Yap_GlobalBase)-minimal_request;
LDiff = TrDiff = size; LOCAL_LDiff = LOCAL_TrDiff = size;
} else { } else {
/* we may still have an overflow */ /* 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 */ /* if we grow, we need to move the stacks */
LDiff = TrDiff = BaseDiff+size; LOCAL_LDiff = LOCAL_TrDiff = LOCAL_BaseDiff+size;
} }
} else { } else {
/* stay still */ /* stay still */
LDiff = TrDiff = 0; LOCAL_LDiff = LOCAL_TrDiff = 0;
BaseDiff = 0; LOCAL_BaseDiff = 0;
} }
/* now, remember we have delay -- global with a hole in delay or a /* now, remember we have delay -- global with a hole in delay or a
hole in global */ hole in global */
if (!hsplit) { if (!hsplit) {
if (!do_grow) { if (!do_grow) {
DelayDiff = GDiff = GDiff0 = size; LOCAL_DelayDiff = LOCAL_GDiff = LOCAL_GDiff0 = size;
request = 0L; request = 0L;
} else { } else {
/* expand delay stack */ /* expand delay stack */
DelayDiff = GDiff = GDiff0 = LDiff; LOCAL_DelayDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_LDiff;
} }
} else if (insert_in_delays) { } else if (insert_in_delays) {
/* we want to expand a hole for the delay stack */ /* we want to expand a hole for the delay stack */
DelayDiff = size-request; LOCAL_DelayDiff = size-request;
GDiff = GDiff0 = size; LOCAL_GDiff = LOCAL_GDiff0 = size;
} else { } else {
/* we want to expand a hole for the delay stack */ /* we want to expand a hole for the delay stack */
GDiff0 = DelayDiff = BaseDiff; LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff;
GDiff = BaseDiff+request; LOCAL_GDiff = LOCAL_BaseDiff+request;
} }
GSplit = hsplit; LOCAL_GSplit = hsplit;
XDiff = HDiff = 0; LOCAL_XDiff = LOCAL_HDiff = 0;
Yap_GlobalBase = old_GlobalBase; Yap_GlobalBase = old_GlobalBase;
SetHeapRegs(FALSE PASS_REGS); SetHeapRegs(FALSE PASS_REGS);
if (do_grow) { if (do_grow) {
@ -996,7 +996,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
MoveExpandedGlobal( PASS_REGS1 ); MoveExpandedGlobal( PASS_REGS1 );
} }
/* don't run through garbage */ /* don't run through garbage */
if (hsplit && (OldH != hsplit)) { if (hsplit && (LOCAL_OldH != hsplit)) {
AdjustStacksAndTrail(request, FALSE PASS_REGS); AdjustStacksAndTrail(request, FALSE PASS_REGS);
} else { } else {
AdjustStacksAndTrail(0, FALSE PASS_REGS); AdjustStacksAndTrail(0, FALSE PASS_REGS);
@ -1008,7 +1008,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
if (hsplit) { if (hsplit) {
if (insert_in_delays) { if (insert_in_delays) {
/* we have things not quite where we want to have them */ /* 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 { } else {
MoveHalfGlobal(hsplit PASS_REGS); MoveHalfGlobal(hsplit PASS_REGS);
} }
@ -1028,7 +1028,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
if (hsplit) { if (hsplit) {
return request; return request;
} else } else
return GDiff-BaseDiff; return LOCAL_GDiff-LOCAL_BaseDiff;
} }
static void 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 ); fix_tabling_info( PASS_REGS1 );
#endif /* TABLING */ #endif /* TABLING */
if (sz >= sizeof(CELL) * K16) { if (sz >= sizeof(CELL) * K16) {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
ActiveSignals &= ~YAP_CDOVF_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return TRUE; return TRUE;
} }
/* failed */ /* failed */
@ -1342,12 +1342,12 @@ growatomtable( USES_REGS1 )
UInt start_growth_time = Yap_cputime(), growth_time; UInt start_growth_time = Yap_cputime(), growth_time;
int gc_verbose = Yap_is_gc_verbose(); int gc_verbose = Yap_is_gc_verbose();
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (ActiveSignals == YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
} }
ActiveSignals &= ~YAP_CDOVF_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
while ((ntb = (AtomHashEntry *)Yap_AllocCodeSpace(nsize*sizeof(AtomHashEntry))) == NULL) { while ((ntb = (AtomHashEntry *)Yap_AllocCodeSpace(nsize*sizeof(AtomHashEntry))) == NULL) {
/* leave for next time */ /* leave for next time */
#if !USE_SYSTEM_MALLOC #if !USE_SYSTEM_MALLOC
@ -1408,12 +1408,12 @@ Yap_growheap(int fix_code, UInt in_size, void *cip)
NOfAtoms > 2*AtomHashTableSize) { NOfAtoms > 2*AtomHashTableSize) {
res = growatomtable( PASS_REGS1 ); res = growatomtable( PASS_REGS1 );
} else { } else {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (ActiveSignals == YAP_CDOVF_SIGNAL) { if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
} }
ActiveSignals &= ~YAP_CDOVF_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return TRUE; return TRUE;
} }
LeaveGrowMode(GrowHeapMode); LeaveGrowMode(GrowHeapMode);
@ -1509,29 +1509,29 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
return FALSE; return FALSE;
} }
YAPEnterCriticalSection(); YAPEnterCriticalSection();
GDiff = DelayDiff = BaseDiff = size-size0; LOCAL_GDiff = LOCAL_DelayDiff = LOCAL_BaseDiff = size-size0;
} else { } else {
YAPEnterCriticalSection(); YAPEnterCriticalSection();
if (Yap_GlobalBase != old_Yap_GlobalBase) { 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; Yap_GlobalBase=old_Yap_GlobalBase;
} else { } else {
GDiff = BaseDiff = DelayDiff = 0; LOCAL_GDiff = LOCAL_BaseDiff = LOCAL_DelayDiff = 0;
} }
} }
XDiff = HDiff = 0; LOCAL_XDiff = LOCAL_HDiff = 0;
GDiff0=GDiff; LOCAL_GDiff0=LOCAL_GDiff;
#if USE_SYSTEM_MALLOC #if USE_SYSTEM_MALLOC
if (from_trail) { if (from_trail) {
TrDiff = LDiff = GDiff; LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff;
} else { } else {
TrDiff = LDiff = size+GDiff; LOCAL_TrDiff = LOCAL_LDiff = size+LOCAL_GDiff;
} }
#else #else
if (from_trail) { if (from_trail) {
TrDiff = LDiff = size-size0; LOCAL_TrDiff = LOCAL_LDiff = size-size0;
} else { } else {
TrDiff = LDiff = size; LOCAL_TrDiff = LOCAL_LDiff = size;
} }
#endif #endif
ASP -= 256; ASP -= 256;
@ -1539,10 +1539,10 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
if (from_trail) { if (from_trail) {
Yap_TrailTop += size0; Yap_TrailTop += size0;
} }
if (LDiff) { if (LOCAL_LDiff) {
MoveLocalAndTrail( PASS_REGS1 ); MoveLocalAndTrail( PASS_REGS1 );
} }
if (GDiff) { if (LOCAL_GDiff) {
#if !USE_SYSTEM_MALLOC #if !USE_SYSTEM_MALLOC
/* That is done by realloc */ /* That is done by realloc */
MoveGlobal( PASS_REGS1 ); MoveGlobal( PASS_REGS1 );
@ -1563,7 +1563,7 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
#ifdef TABLING #ifdef TABLING
fix_tabling_info( PASS_REGS1 ); fix_tabling_info( PASS_REGS1 );
#endif /* TABLING */ #endif /* TABLING */
} else if (LDiff) { } else if (LOCAL_LDiff) {
if (in_parser) { if (in_parser) {
tr_fr_ptr nTR; tr_fr_ptr nTR;
@ -1721,7 +1721,7 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
} else { } else {
YAPEnterCriticalSection(); YAPEnterCriticalSection();
if (in_parser) { 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); AdjustScannerStacks(tksp, vep PASS_REGS);
} }
Yap_TrailTop += size; 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, "%% took %g sec\n", (double)growth_time/1000);
fprintf(Yap_stderr, "%% Total of %g sec expanding trail \n", (double)total_trail_overflow_time/1000); fprintf(Yap_stderr, "%% Total of %g sec expanding trail \n", (double)total_trail_overflow_time/1000);
} }
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (ActiveSignals == YAP_TROVF_SIGNAL) { if (LOCAL_ActiveSignals == YAP_TROVF_SIGNAL) {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
} }
ActiveSignals &= ~YAP_TROVF_SIGNAL; LOCAL_ActiveSignals &= ~YAP_TROVF_SIGNAL;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return TRUE; 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_TrailBase = Yap_thread_gl[worker_p].trail_base;
Yap_TrailTop = Yap_thread_gl[worker_p].trail_top; Yap_TrailTop = Yap_thread_gl[worker_p].trail_top;
size = FOREIGN_ThreadHandle(worker_q).stack_address-FOREIGN_ThreadHandle(worker_p).stack_address; size = FOREIGN_ThreadHandle(worker_q).stack_address-FOREIGN_ThreadHandle(worker_p).stack_address;
TrDiff = LDiff = GDiff = GDiff0 = DelayDiff = BaseDiff = size; LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff = size;
XDiff = HDiff = 0; LOCAL_XDiff = LOCAL_HDiff = 0;
GSplit = NULL; LOCAL_GSplit = NULL;
H = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->H_; H = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->H_;
H0 = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->H0_; H0 = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->H0_;
B = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->B_; 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 #ifdef CUT_C
Yap_REGS.CUT_C_TOP = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->CUT_C_TOP; Yap_REGS.CUT_C_TOP = FOREIGN_ThreadHandle(worker_p).current_yaam_regs->CUT_C_TOP;
#endif #endif
DynamicArrays = NULL; LOCAL_DynamicArrays = NULL;
StaticArrays = NULL; LOCAL_StaticArrays = NULL;
GlobalVariables = NULL; LOCAL_GlobalVariables = NULL;
SetHeapRegs(TRUE PASS_REGS); SetHeapRegs(TRUE PASS_REGS);
if (incremental) { if (incremental) {
IncrementalCopyStacksFromWorker( PASS_REGS1 ); IncrementalCopyStacksFromWorker( PASS_REGS1 );

File diff suppressed because it is too large Load Diff

View File

@ -3454,7 +3454,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
} }
#endif #endif
/* globals for assembler */ /* globals for assembler */
IPredArity = ap->ArityOfPE; LOCAL_IPredArity = ap->ArityOfPE;
if (cint.CodeStart) { if (cint.CodeStart) {
if ((indx_out = Yap_assemble(ASSEMBLING_INDEX, TermNil, ap, FALSE, &cint, cint.i_labelno+1)) == NULL) { if ((indx_out = Yap_assemble(ASSEMBLING_INDEX, TermNil, ap, FALSE, &cint, cint.i_labelno+1)) == NULL) {
if (!Yap_growheap(FALSE, Yap_Error_Size, 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 (!tmod) tmod = TermProlog;
#if THREADS #if THREADS
Yap_DebugPlWrite(MkIntegerTerm(worker_id)); Yap_DebugPlWrite(MkIntegerTerm(worker_id));
Yap_DebugPutc(Yap_c_error_stream,' '); Yap_DebugPutc(LOCAL_c_error_stream,' ');
#endif #endif
Yap_DebugPutc(Yap_c_error_stream,'>'); Yap_DebugPutc(LOCAL_c_error_stream,'>');
Yap_DebugPutc(Yap_c_error_stream,'\t'); Yap_DebugPutc(LOCAL_c_error_stream,'\t');
Yap_DebugPlWrite(tmod); Yap_DebugPlWrite(tmod);
Yap_DebugPutc(Yap_c_error_stream,':'); Yap_DebugPutc(LOCAL_c_error_stream,':');
if (ap->ModuleOfPred == IDB_MODULE) { if (ap->ModuleOfPred == IDB_MODULE) {
Term t = Deref(ARG1); Term t = Deref(ARG1);
if (IsAtomTerm(t)) { if (IsAtomTerm(t)) {
@ -4593,7 +4593,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
Functor f = FunctorOfTerm(t); Functor f = FunctorOfTerm(t);
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At)); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(LOCAL_c_error_stream,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f))); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} else { } else {
@ -4604,14 +4604,14 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
Functor f = ap->FunctorOfPred; Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At)); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(LOCAL_c_error_stream,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f))); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} }
Yap_DebugPutc(Yap_c_error_stream,'\n'); Yap_DebugPutc(LOCAL_c_error_stream,'\n');
#if THREADS #if THREADS
Yap_DebugPlWrite(MkIntegerTerm(worker_id)); Yap_DebugPlWrite(MkIntegerTerm(worker_id));
Yap_DebugPutc(Yap_c_error_stream,' '); Yap_DebugPutc(LOCAL_c_error_stream,' ');
#endif #endif
} }
#endif #endif
@ -4639,7 +4639,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
} }
#endif #endif
/* globals for assembler */ /* globals for assembler */
IPredArity = ap->ArityOfPE; LOCAL_IPredArity = ap->ArityOfPE;
if (cint.CodeStart) { if (cint.CodeStart) {
if ((indx_out = Yap_assemble(ASSEMBLING_EINDEX, TermNil, ap, FALSE, &cint, cint.i_labelno+1)) == NULL) { if ((indx_out = Yap_assemble(ASSEMBLING_EINDEX, TermNil, ap, FALSE, &cint, cint.i_labelno+1)) == NULL) {
if (!Yap_growheap(FALSE, Yap_Error_Size, 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]) { if (Yap_Option['i' - 'a' + 1]) {
Term tmod = ap->ModuleOfPred; Term tmod = ap->ModuleOfPred;
if (!tmod) tmod = TermProlog; if (!tmod) tmod = TermProlog;
Yap_DebugPutc(Yap_c_error_stream,'+'); Yap_DebugPutc(LOCAL_c_error_stream,'+');
Yap_DebugPutc(Yap_c_error_stream,'\t'); Yap_DebugPutc(LOCAL_c_error_stream,'\t');
Yap_DebugPlWrite(tmod); Yap_DebugPlWrite(tmod);
Yap_DebugPutc(Yap_c_error_stream,':'); Yap_DebugPutc(LOCAL_c_error_stream,':');
if (ap->ModuleOfPred == IDB_MODULE) { if (ap->ModuleOfPred == IDB_MODULE) {
Term t = Deref(ARG1); Term t = Deref(ARG1);
if (IsAtomTerm(t)) { if (IsAtomTerm(t)) {
@ -6063,7 +6063,7 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
Functor f = FunctorOfTerm(t); Functor f = FunctorOfTerm(t);
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At)); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(LOCAL_c_error_stream,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f))); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} else { } else {
@ -6074,11 +6074,11 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
Functor f = ap->FunctorOfPred; Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At)); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(LOCAL_c_error_stream,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f))); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} }
Yap_DebugPutc(Yap_c_error_stream,'\n'); Yap_DebugPutc(LOCAL_c_error_stream,'\n');
} }
#endif #endif
stack = (path_stack_entry *)TR; stack = (path_stack_entry *)TR;
@ -6534,10 +6534,10 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
Term tmod = ap->ModuleOfPred; Term tmod = ap->ModuleOfPred;
if (!tmod) tmod = TermProlog; if (!tmod) tmod = TermProlog;
Yap_DebugPutc(Yap_c_error_stream,'-'); Yap_DebugPutc(LOCAL_c_error_stream,'-');
Yap_DebugPutc(Yap_c_error_stream,'\t'); Yap_DebugPutc(LOCAL_c_error_stream,'\t');
Yap_DebugPlWrite(tmod); Yap_DebugPlWrite(tmod);
Yap_DebugPutc(Yap_c_error_stream,':'); Yap_DebugPutc(LOCAL_c_error_stream,':');
if (ap->ModuleOfPred != IDB_MODULE) { if (ap->ModuleOfPred != IDB_MODULE) {
if (ap->ArityOfPE == 0) { if (ap->ArityOfPE == 0) {
Atom At = (Atom)ap->FunctorOfPred; Atom At = (Atom)ap->FunctorOfPred;
@ -6546,7 +6546,7 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
Functor f = ap->FunctorOfPred; Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At)); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(LOCAL_c_error_stream,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f))); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} else { } else {
@ -6560,11 +6560,11 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
Functor f = ap->FunctorOfPred; Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At)); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(LOCAL_c_error_stream,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f))); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} }
Yap_DebugPutc(Yap_c_error_stream,'\n'); Yap_DebugPutc(LOCAL_c_error_stream,'\n');
} }
#endif #endif
stack = (path_stack_entry *)TR; stack = (path_stack_entry *)TR;

View File

@ -1201,14 +1201,14 @@ InitFirstWorkerThreadHandle(void)
{ {
#ifdef THREADS #ifdef THREADS
CACHE_REGS CACHE_REGS
ThreadHandle.id = 0; LOCAL_ThreadHandle.id = 0;
ThreadHandle.in_use = TRUE; LOCAL_ThreadHandle.in_use = TRUE;
ThreadHandle.default_yaam_regs = LOCAL_ThreadHandle.default_yaam_regs =
&Yap_standard_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, NULL);
pthread_mutex_init(&FOREIGN_ThreadHandle(0).tlock_status, NULL); pthread_mutex_init(&FOREIGN_ThreadHandle(0).tlock_status, NULL);
ThreadHandle.tdetach = MkAtomTerm(AtomFalse); LOCAL_ThreadHandle.tdetach = MkAtomTerm(AtomFalse);
#endif #endif
} }
@ -1224,9 +1224,9 @@ void
Yap_CloseScratchPad(void) Yap_CloseScratchPad(void)
{ {
CACHE_REGS CACHE_REGS
Yap_FreeCodeSpace(ScratchPad.ptr); Yap_FreeCodeSpace(LOCAL_ScratchPad.ptr);
ScratchPad.sz = SCRATCH_START_SIZE; LOCAL_ScratchPad.sz = SCRATCH_START_SIZE;
ScratchPad.msz = SCRATCH_START_SIZE; LOCAL_ScratchPad.msz = SCRATCH_START_SIZE;
} }
#include "iglobals.h" #include "iglobals.h"

View File

@ -405,9 +405,9 @@ p_dif( USES_REGS1 )
* We may wake up goals during our attempt to unify the * We may wake up goals during our attempt to unify the
* two terms. If we are adding to the tail of a list of * two terms. If we are adding to the tail of a list of
* woken goals that should be ok, but otherwise we need * 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 #endif
register tr_fr_ptr pt0; register tr_fr_ptr pt0;
/* store the old value of TR for clearing bindings */ /* store the old value of TR for clearing bindings */
@ -425,7 +425,7 @@ p_dif( USES_REGS1 )
d0 = Yap_IUnify(d0, d1); d0 = Yap_IUnify(d0, d1);
#ifdef COROUTINING #ifdef COROUTINING
/* now restore Woken Goals to its old value */ /* now restore Woken Goals to its old value */
Yap_UpdateTimedVar(WokenGoals, OldWokenGoals); Yap_UpdateTimedVar(LOCAL_WokenGoals, OldWokenGoals);
if (OldWokenGoals == TermNil) { if (OldWokenGoals == TermNil) {
Yap_undo_signal(YAP_WAKEUP_SIGNAL); Yap_undo_signal(YAP_WAKEUP_SIGNAL);
} }

View File

@ -206,7 +206,7 @@ void
Yap_DebugErrorPutc(int c) Yap_DebugErrorPutc(int c)
{ {
CACHE_REGS CACHE_REGS
Yap_DebugPutc (Yap_c_error_stream, c); Yap_DebugPutc (LOCAL_c_error_stream, c);
} }
#endif #endif
@ -238,7 +238,7 @@ typedef struct stream_ref
int beam_write (void) int beam_write (void)
{ {
Yap_StartSlots(); 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(); Yap_CloseSlots();
if (EX != 0L) { if (EX != 0L) {
Term ball = Yap_PopTermFromDB(EX); Term ball = Yap_PopTermFromDB(EX);
@ -436,13 +436,13 @@ Int
Yap_FirstLineInParse (void) Yap_FirstLineInParse (void)
{ {
CACHE_REGS CACHE_REGS
return StartLine; return LOCAL_StartLine;
} }
static Int static Int
p_startline ( USES_REGS1 ) p_startline ( USES_REGS1 )
{ {
return (Yap_unify_constant (ARG1, MkIntegerTerm (StartLine))); return (Yap_unify_constant (ARG1, MkIntegerTerm (LOCAL_StartLine)));
} }
/* control the parser error handler */ /* control the parser error handler */
@ -652,7 +652,7 @@ static Int
H = old_H; H = old_H;
TR = (tr_fr_ptr)ScannerStack; TR = (tr_fr_ptr)LOCAL_ScannerStack;
if (!strcmp(Yap_ErrorMessage,"Stack Overflow")) if (!strcmp(Yap_ErrorMessage,"Stack Overflow"))
res = Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable); res = Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable);
@ -661,14 +661,14 @@ static Int
else else
res = Yap_growtrail_in_parser(&old_TR, &tokstart, &Yap_VarTable); res = Yap_growtrail_in_parser(&old_TR, &tokstart, &Yap_VarTable);
if (res) { if (res) {
ScannerStack = (char *)TR; LOCAL_ScannerStack = (char *)TR;
TR = old_TR; TR = old_TR;
old_H = H; old_H = H;
Yap_tokptr = Yap_toktide = tokstart; Yap_tokptr = Yap_toktide = tokstart;
Yap_ErrorMessage = NULL; Yap_ErrorMessage = NULL;
goto repeat_cycle; goto repeat_cycle;
} }
ScannerStack = (char *)TR; LOCAL_ScannerStack = (char *)TR;
TR = old_TR; TR = old_TR;
} }
} }
@ -722,9 +722,9 @@ static Int
old_TR = TR; old_TR = TR;
/* restart global */ /* restart global */
H = old_H; H = old_H;
TR = (tr_fr_ptr)ScannerStack; TR = (tr_fr_ptr)LOCAL_ScannerStack;
Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable); Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable);
ScannerStack = (char *)TR; LOCAL_ScannerStack = (char *)TR;
TR = old_TR; TR = old_TR;
} }
} }

View File

@ -696,10 +696,10 @@ ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS)
} }
#ifdef DEBUG #ifdef DEBUG
if (Yap_Option['p' - 'a' + 1]) { if (Yap_Option['p' - 'a' + 1]) {
Yap_DebugPutc(Yap_c_error_stream,'['); Yap_DebugPutc(LOCAL_c_error_stream,'[');
Yap_DebugPlWrite(t); Yap_DebugPlWrite(t);
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');
} }
#endif #endif
return t; return t;

View File

@ -422,18 +422,18 @@ save_regs(int mode USES_REGS)
return -1; return -1;
if (mode == DO_EVERYTHING) { if (mode == DO_EVERYTHING) {
#ifdef COROUTINING #ifdef COROUTINING
if (putout(WokenGoals) < 0) if (putout(LOCAL_WokenGoals) < 0)
return -1; return -1;
#endif #endif
#ifdef DEPTH_LIMIT #ifdef DEPTH_LIMIT
if (putout(DEPTH) < 0) if (putout(DEPTH) < 0)
return -1; return -1;
#endif #endif
if (putout(GcGeneration) < 0) if (putout(LOCAL_GcGeneration) < 0)
return -1; return -1;
if (putout(GcPhase) < 0) if (putout(LOCAL_GcPhase) < 0)
return -1; return -1;
if (putout(GcCurrentPhase) < 0) if (putout(LOCAL_GcCurrentPhase) < 0)
return -1; return -1;
} }
/* The operand base */ /* The operand base */
@ -459,11 +459,11 @@ save_regs(int mode USES_REGS)
return -1; return -1;
if (putcellptr(CellPtr(AuxTop)) < 0) if (putcellptr(CellPtr(AuxTop)) < 0)
return -1; return -1;
if (putcellptr(CellPtr(ScratchPad.ptr)) < 0) if (putcellptr(CellPtr(LOCAL_ScratchPad.ptr)) < 0)
return -1; return -1;
if (putout(ScratchPad.sz) < 0) if (putout(LOCAL_ScratchPad.sz) < 0)
return -1; return -1;
if (putout(ScratchPad.msz) < 0) if (putout(LOCAL_ScratchPad.msz) < 0)
return -1; return -1;
if (mode == DO_EVERYTHING) { if (mode == DO_EVERYTHING) {
/* put the old trail base, just in case it moves again */ /* 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 static int
get_heap_info(USES_REGS1) get_heap_info(USES_REGS1)
{ {
OldHeapBase = (ADDR) get_cellptr(); LOCAL_OldHeapBase = (ADDR) get_cellptr();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
OldHeapTop = (ADDR) get_cellptr(); LOCAL_OldHeapTop = (ADDR) get_cellptr();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
@ -783,16 +783,16 @@ get_heap_info(USES_REGS1)
AuxTop = (ADDR)get_cellptr(); AuxTop = (ADDR)get_cellptr();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
ScratchPad.ptr = (ADDR)get_cellptr(); LOCAL_ScratchPad.ptr = (ADDR)get_cellptr();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
ScratchPad.sz = get_cell(); LOCAL_ScratchPad.sz = get_cell();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
ScratchPad.msz = get_cell(); LOCAL_ScratchPad.msz = get_cell();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
HDiff = Unsigned(Yap_HeapBase) - Unsigned(OldHeapBase); LOCAL_HDiff = Unsigned(Yap_HeapBase) - Unsigned(LOCAL_OldHeapBase);
return 1; return 1;
} }
@ -871,7 +871,7 @@ get_regs(int flag USES_REGS)
return -1; return -1;
if (flag == DO_EVERYTHING) { if (flag == DO_EVERYTHING) {
#ifdef COROUTINING #ifdef COROUTINING
WokenGoals = get_cell(); LOCAL_WokenGoals = get_cell();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
#endif #endif
@ -880,13 +880,13 @@ get_regs(int flag USES_REGS)
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
#endif #endif
GcGeneration = get_cell(); LOCAL_GcGeneration = get_cell();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
GcPhase = get_cell(); LOCAL_GcPhase = get_cell();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
GcCurrentPhase = get_cell(); LOCAL_GcCurrentPhase = get_cell();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
} }
@ -897,7 +897,7 @@ get_regs(int flag USES_REGS)
which_save = get_cell(); which_save = get_cell();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
XDiff = (CELL)XREGS - (CELL)OldXREGS; LOCAL_XDiff = (CELL)XREGS - (CELL)OldXREGS;
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
if (get_heap_info( PASS_REGS1 ) < 0) if (get_heap_info( PASS_REGS1 ) < 0)
@ -912,19 +912,19 @@ get_regs(int flag USES_REGS)
return -1; return -1;
} }
/* get old trail base */ /* get old trail base */
OldTrailBase = (ADDR)get_cellptr(); LOCAL_OldTrailBase = (ADDR)get_cellptr();
if (Yap_ErrorMessage) if (Yap_ErrorMessage)
return -1; return -1;
/* Save the old register where we can easily access them */ /* Save the old register where we can easily access them */
OldASP = ASP; LOCAL_OldASP = ASP;
OldLCL0 = LCL0; LOCAL_OldLCL0 = LCL0;
OldGlobalBase = (CELL *)Yap_GlobalBase; LOCAL_OldGlobalBase = (CELL *)Yap_GlobalBase;
OldH = H; LOCAL_OldH = H;
OldTR = TR; LOCAL_OldTR = TR;
GDiff = Unsigned(NewGlobalBase) - Unsigned(Yap_GlobalBase); LOCAL_GDiff = Unsigned(NewGlobalBase) - Unsigned(Yap_GlobalBase);
GDiff0 = 0; LOCAL_GDiff0 = 0;
LDiff = Unsigned(NewLCL0) - Unsigned(LCL0); LOCAL_LDiff = Unsigned(NewLCL0) - Unsigned(LCL0);
TrDiff = LDiff; LOCAL_TrDiff = LOCAL_LDiff;
Yap_GlobalBase = (ADDR)NewGlobalBase; Yap_GlobalBase = (ADDR)NewGlobalBase;
LCL0 = NewLCL0; LCL0 = NewLCL0;
} }
@ -949,7 +949,7 @@ get_hash(void)
static int static int
CopyCode( USES_REGS1 ) 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;
} }
return 1; return 1;
@ -963,14 +963,14 @@ CopyStacks( USES_REGS1 )
Int j; Int j;
char *NewASP; char *NewASP;
j = Unsigned(OldLCL0) - Unsigned(ASP); j = Unsigned(LOCAL_OldLCL0) - Unsigned(ASP);
NewASP = (char *) (Unsigned(ASP) + (Unsigned(LCL0) - Unsigned(OldLCL0))); NewASP = (char *) (Unsigned(ASP) + (Unsigned(LCL0) - Unsigned(LOCAL_OldLCL0)));
if (myread(splfild, (char *) NewASP, j) < 0) if (myread(splfild, (char *) NewASP, j) < 0)
return -1; return -1;
j = Unsigned(H) - Unsigned(OldGlobalBase); j = Unsigned(H) - Unsigned(LOCAL_OldGlobalBase);
if (myread(splfild, (char *) Yap_GlobalBase, j) < 0) if (myread(splfild, (char *) Yap_GlobalBase, j) < 0)
return -1; return -1;
j = Unsigned(TR) - Unsigned(OldTrailBase); j = Unsigned(TR) - Unsigned(LOCAL_OldTrailBase);
if (myread(splfild, Yap_TrailBase, j)) if (myread(splfild, Yap_TrailBase, j))
return -1; return -1;
return 1; return 1;
@ -1061,7 +1061,7 @@ restore_regs(int flag USES_REGS)
EX = DBTermAdjust(EX); EX = DBTermAdjust(EX);
RestoreDBTerm(EX, TRUE PASS_REGS); 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 WorkTerm, failplace = 0;
CELL *Base = oldcode; CELL *Base = oldcode;
if (HDiff == 0) if (LOCAL_HDiff == 0)
return; return;
basep = H; basep = H;
if (H + (NOfE*2) > ASP) { if (H + (NOfE*2) > ASP) {
@ -1216,7 +1216,7 @@ RestoreFreeSpace( USES_REGS1 )
Yap_av = (struct malloc_state *)AddrAdjust((ADDR)Yap_av); Yap_av = (struct malloc_state *)AddrAdjust((ADDR)Yap_av);
Yap_RestoreDLMalloc(); Yap_RestoreDLMalloc();
if (AuxSp != NULL) { if (AuxSp != NULL) {
if (AuxBase < OldHeapBase || AuxBase > OldHeapTop) { if (AuxBase < LOCAL_OldHeapBase || AuxBase > LOCAL_OldHeapTop) {
AuxSp = NULL; AuxSp = NULL;
AuxBase = NULL; AuxBase = NULL;
AuxTop = NULL; AuxTop = NULL;
@ -1224,7 +1224,7 @@ RestoreFreeSpace( USES_REGS1 )
AuxSp = PtoHeapCellAdjust(AuxSp); AuxSp = PtoHeapCellAdjust(AuxSp);
AuxBase = AddrAdjust(AuxBase); AuxBase = AddrAdjust(AuxBase);
AuxTop = AddrAdjust(AuxTop); AuxTop = AddrAdjust(AuxTop);
ScratchPad.ptr = AddrAdjust(ScratchPad.ptr); LOCAL_ScratchPad.ptr = AddrAdjust(LOCAL_ScratchPad.ptr);
} }
} }
#else #else
@ -1590,8 +1590,8 @@ check_opcodes(OPCODE old_ops[])
static void static void
RestoreHeap(OPCODE old_ops[] USES_REGS) RestoreHeap(OPCODE old_ops[] USES_REGS)
{ {
int heap_moved = (OldHeapBase != Yap_HeapBase || int heap_moved = (LOCAL_OldHeapBase != Yap_HeapBase ||
XDiff), opcodes_moved; LOCAL_XDiff), opcodes_moved;
Term mod = CurrentModule; Term mod = CurrentModule;
CurrentModule = PROLOG_MODULE; CurrentModule = PROLOG_MODULE;
@ -1740,10 +1740,10 @@ Restore(char *s, char *lib_dir USES_REGS)
RestoreHeap(old_ops PASS_REGS); RestoreHeap(old_ops PASS_REGS);
switch(restore_mode) { switch(restore_mode) {
case DO_EVERYTHING: case DO_EVERYTHING:
if (OldHeapBase != Yap_HeapBase || if (LOCAL_OldHeapBase != Yap_HeapBase ||
OldLCL0 != LCL0 || LOCAL_OldLCL0 != LCL0 ||
OldGlobalBase != (CELL *)Yap_GlobalBase || LOCAL_OldGlobalBase != (CELL *)Yap_GlobalBase ||
OldTrailBase != Yap_TrailBase) { LOCAL_OldTrailBase != Yap_TrailBase) {
Yap_AdjustStacksAndTrail(); Yap_AdjustStacksAndTrail();
if (which_save == 2) { if (which_save == 2) {
Yap_AdjustRegs(2); Yap_AdjustRegs(2);

View File

@ -173,16 +173,16 @@ AllocScannerMemory(unsigned int size)
CACHE_REGS CACHE_REGS
char *AuxSpScan; char *AuxSpScan;
AuxSpScan = ScannerStack; AuxSpScan = LOCAL_ScannerStack;
size = AdjustSize(size); size = AdjustSize(size);
if (ScannerExtraBlocks) { if (LOCAL_ScannerExtraBlocks) {
struct scanner_extra_alloc *ptr; struct scanner_extra_alloc *ptr;
if (!(ptr = (struct scanner_extra_alloc *)malloc(size+sizeof(ScannerExtraBlock)))) { if (!(ptr = (struct scanner_extra_alloc *)malloc(size+sizeof(ScannerExtraBlock)))) {
return NULL; return NULL;
} }
ptr->next = ScannerExtraBlocks; ptr->next = LOCAL_ScannerExtraBlocks;
ScannerExtraBlocks = ptr; LOCAL_ScannerExtraBlocks = ptr;
return (char *)(ptr+1); return (char *)(ptr+1);
} else if (Yap_TrailTop <= AuxSpScan+size) { } else if (Yap_TrailTop <= AuxSpScan+size) {
UInt alloc_size = sizeof(CELL) * K16; UInt alloc_size = sizeof(CELL) * K16;
@ -195,12 +195,12 @@ AllocScannerMemory(unsigned int size)
if (!(ptr = (struct scanner_extra_alloc *)malloc(size+sizeof(ScannerExtraBlock)))) { if (!(ptr = (struct scanner_extra_alloc *)malloc(size+sizeof(ScannerExtraBlock)))) {
return NULL; return NULL;
} }
ptr->next = ScannerExtraBlocks; ptr->next = LOCAL_ScannerExtraBlocks;
ScannerExtraBlocks = ptr; LOCAL_ScannerExtraBlocks = ptr;
return (char *)(ptr+1); return (char *)(ptr+1);
} }
} }
ScannerStack = AuxSpScan+size; LOCAL_ScannerStack = AuxSpScan+size;
return AuxSpScan; return AuxSpScan;
} }
@ -208,12 +208,12 @@ static void
PopScannerMemory(char *block, unsigned int size) PopScannerMemory(char *block, unsigned int size)
{ {
CACHE_REGS CACHE_REGS
if (block == ScannerStack-size) { if (block == LOCAL_ScannerStack-size) {
ScannerStack -= size; LOCAL_ScannerStack -= size;
} else if (block == (char *)(ScannerExtraBlocks+1)) { } else if (block == (char *)(LOCAL_ScannerExtraBlocks+1)) {
struct scanner_extra_alloc *ptr = ScannerExtraBlocks; struct scanner_extra_alloc *ptr = LOCAL_ScannerExtraBlocks;
ScannerExtraBlocks = ptr->next; LOCAL_ScannerExtraBlocks = ptr->next;
free(ptr); free(ptr);
} }
} }
@ -728,8 +728,8 @@ Yap_scan_num(IOSTREAM *inp)
char *ptr; char *ptr;
Yap_ErrorMessage = NULL; Yap_ErrorMessage = NULL;
ScannerStack = (char *)TR; LOCAL_ScannerStack = (char *)TR;
ScannerExtraBlocks = NULL; LOCAL_ScannerExtraBlocks = NULL;
if (!(ptr = AllocScannerMemory(4096))) { if (!(ptr = AllocScannerMemory(4096))) {
Yap_ErrorMessage = "Trail Overflow"; Yap_ErrorMessage = "Trail Overflow";
Yap_Error_TYPE = OUT_OF_TRAIL_ERROR; Yap_Error_TYPE = OUT_OF_TRAIL_ERROR;
@ -805,8 +805,8 @@ Yap_tokenizer(IOSTREAM *inp_stream, Term *tposp)
Yap_VarTable = NULL; Yap_VarTable = NULL;
Yap_AnonVarTable = NULL; Yap_AnonVarTable = NULL;
Yap_eot_before_eof = FALSE; Yap_eot_before_eof = FALSE;
ScannerStack = (char *)TR; LOCAL_ScannerStack = (char *)TR;
ScannerExtraBlocks = NULL; LOCAL_ScannerExtraBlocks = NULL;
l = NULL; l = NULL;
p = NULL; /* Just to make lint happy */ p = NULL; /* Just to make lint happy */
ch = getchr(inp_stream); ch = getchr(inp_stream);
@ -814,7 +814,7 @@ Yap_tokenizer(IOSTREAM *inp_stream, Term *tposp)
ch = getchr(inp_stream); ch = getchr(inp_stream);
} }
*tposp = Yap_StreamPosition(inp_stream); *tposp = Yap_StreamPosition(inp_stream);
StartLine = inp_stream->posbuf.lineno; LOCAL_StartLine = inp_stream->posbuf.lineno;
do { do {
wchar_t och; wchar_t och;
int quote, isvar; int quote, isvar;
@ -1280,7 +1280,7 @@ void
Yap_clean_tokenizer(TokEntry *tokstart, VarEntry *vartable, VarEntry *anonvartable) Yap_clean_tokenizer(TokEntry *tokstart, VarEntry *vartable, VarEntry *anonvartable)
{ {
CACHE_REGS CACHE_REGS
struct scanner_extra_alloc *ptr = ScannerExtraBlocks; struct scanner_extra_alloc *ptr = LOCAL_ScannerExtraBlocks;
while (ptr) { while (ptr) {
struct scanner_extra_alloc *next = ptr->next; struct scanner_extra_alloc *next = ptr->next;
free(ptr); free(ptr);

View File

@ -477,22 +477,22 @@ p_values( USES_REGS1 )
inline static void inline static void
do_signal(yap_signals sig USES_REGS) do_signal(yap_signals sig USES_REGS)
{ {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (!Yap_InterruptsDisabled) if (!LOCAL_InterruptsDisabled)
CreepFlag = Unsigned(LCL0); CreepFlag = Unsigned(LCL0);
ActiveSignals |= sig; LOCAL_ActiveSignals |= sig;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
} }
inline static void inline static void
undo_signal(yap_signals sig USES_REGS) undo_signal(yap_signals sig USES_REGS)
{ {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (ActiveSignals == sig) { if (LOCAL_ActiveSignals == sig) {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
} }
ActiveSignals &= ~sig; LOCAL_ActiveSignals &= ~sig;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
} }
@ -518,24 +518,24 @@ p_signal_creep( USES_REGS1 )
at = AtomCreep; at = AtomCreep;
pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 1),0)); pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 1),0));
CreepCode = pred; CreepCode = pred;
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
ActiveSignals |= YAP_CREEP_SIGNAL; LOCAL_ActiveSignals |= YAP_CREEP_SIGNAL;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return TRUE; return TRUE;
} }
static Int static Int
p_disable_creep( USES_REGS1 ) p_disable_creep( USES_REGS1 )
{ {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (ActiveSignals & YAP_CREEP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
ActiveSignals &= ~YAP_CREEP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return TRUE; return TRUE;
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return FALSE; return FALSE;
} }
@ -543,14 +543,14 @@ p_disable_creep( USES_REGS1 )
static Int static Int
p_disable_docreep( USES_REGS1 ) p_disable_docreep( USES_REGS1 )
{ {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (ActiveSignals & YAP_CREEP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
ActiveSignals &= ~YAP_CREEP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
if (!ActiveSignals) if (!LOCAL_ActiveSignals)
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
} else { } else {
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
} }
return TRUE; return TRUE;
} }
@ -558,12 +558,12 @@ p_disable_docreep( USES_REGS1 )
static Int static Int
p_stop_creep( USES_REGS1 ) p_stop_creep( USES_REGS1 )
{ {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
ActiveSignals &= ~YAP_CREEP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
if (!ActiveSignals) { if (!LOCAL_ActiveSignals) {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return TRUE; return TRUE;
} }
@ -797,9 +797,9 @@ p_runtime( USES_REGS1 )
now -= gc_time; now -= gc_time;
ss_time = Yap_total_stack_shift_time(); ss_time = Yap_total_stack_shift_time();
now -= ss_time; now -= ss_time;
interval -= (gc_time-LastGcTime)+(ss_time-LastSSTime); interval -= (gc_time-LOCAL_LastGcTime)+(ss_time-LOCAL_LastSSTime);
LastGcTime = gc_time; LOCAL_LastGcTime = gc_time;
LastSSTime = ss_time; LOCAL_LastSSTime = ss_time;
tnow = MkIntegerTerm(now); tnow = MkIntegerTerm(now);
tinterval = MkIntegerTerm(interval); tinterval = MkIntegerTerm(interval);
return( Yap_unify_constant(ARG1, tnow) && return( Yap_unify_constant(ARG1, tnow) &&
@ -3927,18 +3927,18 @@ p_unlock_system( USES_REGS1 )
static Int static Int
p_enterundefp( USES_REGS1 ) p_enterundefp( USES_REGS1 )
{ {
if (DoingUndefp) { if (LOCAL_DoingUndefp) {
return FALSE; return FALSE;
} }
DoingUndefp = TRUE; LOCAL_DoingUndefp = TRUE;
return TRUE; return TRUE;
} }
static Int static Int
p_exitundefp( USES_REGS1 ) p_exitundefp( USES_REGS1 )
{ {
if (DoingUndefp) { if (LOCAL_DoingUndefp) {
DoingUndefp = FALSE; LOCAL_DoingUndefp = FALSE;
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

View File

@ -1671,7 +1671,7 @@ HandleSIGINT (int sig)
return; return;
} }
#endif #endif
if (Yap_InterruptsDisabled) { if (LOCAL_InterruptsDisabled) {
return; return;
} }
if (Yap_PrologMode & (CritMode|ConsoleGetcMode)) { if (Yap_PrologMode & (CritMode|ConsoleGetcMode)) {
@ -1786,7 +1786,7 @@ ReceiveSignal (int s)
#if (_MSC_VER || defined(__MINGW32__)) #if (_MSC_VER || defined(__MINGW32__))
static BOOL WINAPI static BOOL WINAPI
MSCHandleSignal(DWORD dwCtrlType) { MSCHandleSignal(DWORD dwCtrlType) {
if (Yap_InterruptsDisabled) { if (LOCAL_InterruptsDisabled) {
return FALSE; return FALSE;
} }
switch(dwCtrlType) { switch(dwCtrlType) {
@ -2478,14 +2478,14 @@ p_alarm( USES_REGS1 )
i1 = IntegerOfTerm(t); i1 = IntegerOfTerm(t);
i2 = IntegerOfTerm(t2); i2 = IntegerOfTerm(t2);
if (i1 == 0 && i2 == 0) { if (i1 == 0 && i2 == 0) {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
if (ActiveSignals & YAP_ALARM_SIGNAL) { if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) {
ActiveSignals &= ~YAP_ALARM_SIGNAL; LOCAL_ActiveSignals &= ~YAP_ALARM_SIGNAL;
if (!ActiveSignals) { if (!LOCAL_ActiveSignals) {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
} }
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
} }
#if _MSC_VER || defined(__MINGW32__) #if _MSC_VER || defined(__MINGW32__)
{ {
@ -2758,146 +2758,146 @@ Yap_ReInitWallTime (void)
static Int static Int
p_first_signal( USES_REGS1 ) p_first_signal( USES_REGS1 )
{ {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
#ifdef THREADS #ifdef THREADS
pthread_mutex_lock(&(MY_ThreadHandle.tlock)); pthread_mutex_lock(&(MY_ThreadHandle.tlock));
#endif #endif
/* always do wakeups first, because you don't want to keep the /* always do wakeups first, because you don't want to keep the
non-backtrackable variable bad */ non-backtrackable variable bad */
if (ActiveSignals & YAP_WAKEUP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_WAKEUP_SIGNAL) {
ActiveSignals &= ~YAP_WAKEUP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_WAKEUP_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigWakeUp)); return Yap_unify(ARG1, MkAtomTerm(AtomSigWakeUp));
} }
if (ActiveSignals & YAP_ITI_SIGNAL) { if (LOCAL_ActiveSignals & YAP_ITI_SIGNAL) {
ActiveSignals &= ~YAP_ITI_SIGNAL; LOCAL_ActiveSignals &= ~YAP_ITI_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigIti)); return Yap_unify(ARG1, MkAtomTerm(AtomSigIti));
} }
if (ActiveSignals & YAP_INT_SIGNAL) { if (LOCAL_ActiveSignals & YAP_INT_SIGNAL) {
ActiveSignals &= ~YAP_INT_SIGNAL; LOCAL_ActiveSignals &= ~YAP_INT_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigInt)); return Yap_unify(ARG1, MkAtomTerm(AtomSigInt));
} }
if (ActiveSignals & YAP_USR2_SIGNAL) { if (LOCAL_ActiveSignals & YAP_USR2_SIGNAL) {
ActiveSignals &= ~YAP_USR2_SIGNAL; LOCAL_ActiveSignals &= ~YAP_USR2_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigUsr2)); return Yap_unify(ARG1, MkAtomTerm(AtomSigUsr2));
} }
if (ActiveSignals & YAP_USR1_SIGNAL) { if (LOCAL_ActiveSignals & YAP_USR1_SIGNAL) {
ActiveSignals &= ~YAP_USR1_SIGNAL; LOCAL_ActiveSignals &= ~YAP_USR1_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigUsr1)); return Yap_unify(ARG1, MkAtomTerm(AtomSigUsr1));
} }
if (ActiveSignals & YAP_PIPE_SIGNAL) { if (LOCAL_ActiveSignals & YAP_PIPE_SIGNAL) {
ActiveSignals &= ~YAP_PIPE_SIGNAL; LOCAL_ActiveSignals &= ~YAP_PIPE_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigPipe)); return Yap_unify(ARG1, MkAtomTerm(AtomSigPipe));
} }
if (ActiveSignals & YAP_HUP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_HUP_SIGNAL) {
ActiveSignals &= ~YAP_HUP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_HUP_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigHup)); return Yap_unify(ARG1, MkAtomTerm(AtomSigHup));
} }
if (ActiveSignals & YAP_ALARM_SIGNAL) { if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) {
ActiveSignals &= ~YAP_ALARM_SIGNAL; LOCAL_ActiveSignals &= ~YAP_ALARM_SIGNAL;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigAlarm)); return Yap_unify(ARG1, MkAtomTerm(AtomSigAlarm));
} }
if (ActiveSignals & YAP_VTALARM_SIGNAL) { if (LOCAL_ActiveSignals & YAP_VTALARM_SIGNAL) {
ActiveSignals &= ~YAP_VTALARM_SIGNAL; LOCAL_ActiveSignals &= ~YAP_VTALARM_SIGNAL;
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigVTAlarm)); return Yap_unify(ARG1, MkAtomTerm(AtomSigVTAlarm));
} }
if (ActiveSignals & YAP_DELAY_CREEP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_DELAY_CREEP_SIGNAL) {
ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL); LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL|YAP_DELAY_CREEP_SIGNAL);
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigDelayCreep)); return Yap_unify(ARG1, MkAtomTerm(AtomSigDelayCreep));
} }
if (ActiveSignals & YAP_CREEP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
ActiveSignals &= ~YAP_CREEP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigCreep)); return Yap_unify(ARG1, MkAtomTerm(AtomSigCreep));
} }
if (ActiveSignals & YAP_TRACE_SIGNAL) { if (LOCAL_ActiveSignals & YAP_TRACE_SIGNAL) {
ActiveSignals &= ~YAP_TRACE_SIGNAL; LOCAL_ActiveSignals &= ~YAP_TRACE_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigTrace)); return Yap_unify(ARG1, MkAtomTerm(AtomSigTrace));
} }
if (ActiveSignals & YAP_DEBUG_SIGNAL) { if (LOCAL_ActiveSignals & YAP_DEBUG_SIGNAL) {
ActiveSignals &= ~YAP_DEBUG_SIGNAL; LOCAL_ActiveSignals &= ~YAP_DEBUG_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigDebug)); return Yap_unify(ARG1, MkAtomTerm(AtomSigDebug));
} }
if (ActiveSignals & YAP_BREAK_SIGNAL) { if (LOCAL_ActiveSignals & YAP_BREAK_SIGNAL) {
ActiveSignals &= ~YAP_BREAK_SIGNAL; LOCAL_ActiveSignals &= ~YAP_BREAK_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigBreak)); return Yap_unify(ARG1, MkAtomTerm(AtomSigBreak));
} }
if (ActiveSignals & YAP_STACK_DUMP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_STACK_DUMP_SIGNAL) {
ActiveSignals &= ~YAP_STACK_DUMP_SIGNAL; LOCAL_ActiveSignals &= ~YAP_STACK_DUMP_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigStackDump)); return Yap_unify(ARG1, MkAtomTerm(AtomSigStackDump));
} }
if (ActiveSignals & YAP_STATISTICS_SIGNAL) { if (LOCAL_ActiveSignals & YAP_STATISTICS_SIGNAL) {
ActiveSignals &= ~YAP_STATISTICS_SIGNAL; LOCAL_ActiveSignals &= ~YAP_STATISTICS_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomSigStatistics)); return Yap_unify(ARG1, MkAtomTerm(AtomSigStatistics));
} }
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
ActiveSignals &= ~YAP_FAIL_SIGNAL; LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL;
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return Yap_unify(ARG1, MkAtomTerm(AtomFail)); return Yap_unify(ARG1, MkAtomTerm(AtomFail));
} }
#ifdef THREADS #ifdef THREADS
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
#endif #endif
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return FALSE; return FALSE;
} }
@ -2905,49 +2905,49 @@ static Int
p_continue_signals( USES_REGS1 ) p_continue_signals( USES_REGS1 )
{ {
/* hack to force the signal anew */ /* hack to force the signal anew */
if (ActiveSignals & YAP_ITI_SIGNAL) { if (LOCAL_ActiveSignals & YAP_ITI_SIGNAL) {
Yap_signal(YAP_ITI_SIGNAL); Yap_signal(YAP_ITI_SIGNAL);
} }
if (ActiveSignals & YAP_INT_SIGNAL) { if (LOCAL_ActiveSignals & YAP_INT_SIGNAL) {
Yap_signal(YAP_INT_SIGNAL); Yap_signal(YAP_INT_SIGNAL);
} }
if (ActiveSignals & YAP_USR2_SIGNAL) { if (LOCAL_ActiveSignals & YAP_USR2_SIGNAL) {
Yap_signal(YAP_USR2_SIGNAL); Yap_signal(YAP_USR2_SIGNAL);
} }
if (ActiveSignals & YAP_USR1_SIGNAL) { if (LOCAL_ActiveSignals & YAP_USR1_SIGNAL) {
Yap_signal(YAP_USR1_SIGNAL); Yap_signal(YAP_USR1_SIGNAL);
} }
if (ActiveSignals & YAP_HUP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_HUP_SIGNAL) {
Yap_signal(YAP_HUP_SIGNAL); Yap_signal(YAP_HUP_SIGNAL);
} }
if (ActiveSignals & YAP_ALARM_SIGNAL) { if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) {
Yap_signal(YAP_ALARM_SIGNAL); Yap_signal(YAP_ALARM_SIGNAL);
} }
if (ActiveSignals & YAP_VTALARM_SIGNAL) { if (LOCAL_ActiveSignals & YAP_VTALARM_SIGNAL) {
Yap_signal(YAP_VTALARM_SIGNAL); Yap_signal(YAP_VTALARM_SIGNAL);
} }
if (ActiveSignals & YAP_CREEP_SIGNAL) { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) {
Yap_signal(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); 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); Yap_signal(YAP_TRACE_SIGNAL);
} }
if (ActiveSignals & YAP_DEBUG_SIGNAL) { if (LOCAL_ActiveSignals & YAP_DEBUG_SIGNAL) {
Yap_signal(YAP_DEBUG_SIGNAL); Yap_signal(YAP_DEBUG_SIGNAL);
} }
if (ActiveSignals & YAP_BREAK_SIGNAL) { if (LOCAL_ActiveSignals & YAP_BREAK_SIGNAL) {
Yap_signal(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); Yap_signal(YAP_STACK_DUMP_SIGNAL);
} }
if (ActiveSignals & YAP_STATISTICS_SIGNAL) { if (LOCAL_ActiveSignals & YAP_STATISTICS_SIGNAL) {
Yap_signal(YAP_STATISTICS_SIGNAL); Yap_signal(YAP_STATISTICS_SIGNAL);
} }
if (ActiveSignals & YAP_FAIL_SIGNAL) { if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) {
Yap_signal(YAP_FAIL_SIGNAL); Yap_signal(YAP_FAIL_SIGNAL);
} }
#ifdef THREADS #ifdef THREADS
@ -2992,24 +2992,24 @@ p_win32( USES_REGS1 )
static Int static Int
p_enable_interrupts( USES_REGS1 ) p_enable_interrupts( USES_REGS1 )
{ {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
Yap_InterruptsDisabled--; LOCAL_InterruptsDisabled--;
if (ActiveSignals && !Yap_InterruptsDisabled) { if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) {
CreepFlag = Unsigned(LCL0); CreepFlag = Unsigned(LCL0);
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return TRUE; return TRUE;
} }
static Int static Int
p_disable_interrupts( USES_REGS1 ) p_disable_interrupts( USES_REGS1 )
{ {
LOCK(SignalLock); LOCK(LOCAL_SignalLock);
Yap_InterruptsDisabled++; LOCAL_InterruptsDisabled++;
if (ActiveSignals) { if (LOCAL_ActiveSignals) {
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
} }
UNLOCK(SignalLock); UNLOCK(LOCAL_SignalLock);
return TRUE; return TRUE;
} }

View File

@ -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).ssize = ssize;
FOREIGN_ThreadHandle(new_worker_id).tsize = tsize; FOREIGN_ThreadHandle(new_worker_id).tsize = tsize;
FOREIGN_ThreadHandle(new_worker_id).sysize = sysize; FOREIGN_ThreadHandle(new_worker_id).sysize = sysize;
FOREIGN(new_worker_id)->c_input_stream = Yap_c_input_stream; FOREIGN(new_worker_id)->c_input_stream = LOCAL_c_input_stream;
FOREIGN(new_worker_id)->c_output_stream = Yap_c_output_stream; FOREIGN(new_worker_id)->c_output_stream = LOCAL_c_output_stream;
FOREIGN(new_worker_id)->c_error_stream = Yap_c_error_stream; FOREIGN(new_worker_id)->c_error_stream = LOCAL_c_error_stream;
pm = (ssize + tsize)*1024; pm = (ssize + tsize)*1024;
if (!(FOREIGN_ThreadHandle(new_worker_id).stack_address = malloc(pm))) { if (!(FOREIGN_ThreadHandle(new_worker_id).stack_address = malloc(pm))) {
return FALSE; return FALSE;
@ -124,10 +124,10 @@ kill_thread_engine (int wid, int always_die)
{ {
CACHE_REGS CACHE_REGS
Prop p0 = AbsPredProp(FOREIGN_ThreadHandle(wid).local_preds); Prop p0 = AbsPredProp(FOREIGN_ThreadHandle(wid).local_preds);
GlobalEntry *gl = GlobalVariables; GlobalEntry *gl = LOCAL_GlobalVariables;
FOREIGN_ThreadHandle(wid).local_preds = NIL; FOREIGN_ThreadHandle(wid).local_preds = NIL;
GlobalVariables = NULL; LOCAL_GlobalVariables = NULL;
/* kill all thread local preds */ /* kill all thread local preds */
while(p0) { while(p0) {
PredEntry *ap = RepPredProp(p0); PredEntry *ap = RepPredProp(p0);
@ -349,7 +349,7 @@ p_thread_zombie_self( USES_REGS1 )
return Yap_unify(MkIntegerTerm(-1), ARG1); return Yap_unify(MkIntegerTerm(-1), ARG1);
DEBUG_TLOCK_ACCESS(4, worker_id); DEBUG_TLOCK_ACCESS(4, worker_id);
pthread_mutex_lock(&(MY_ThreadHandle.tlock)); pthread_mutex_lock(&(MY_ThreadHandle.tlock));
if (ActiveSignals &= YAP_ITI_SIGNAL) { if (LOCAL_ActiveSignals &= YAP_ITI_SIGNAL) {
DEBUG_TLOCK_ACCESS(5, worker_id); DEBUG_TLOCK_ACCESS(5, worker_id);
pthread_mutex_unlock(&(MY_ThreadHandle.tlock)); pthread_mutex_unlock(&(MY_ThreadHandle.tlock));
return FALSE; return FALSE;

View File

@ -396,12 +396,12 @@ static Int p_start_low_level_trace( USES_REGS1 )
static Int p_total_choicepoints( 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 ) static Int p_reset_total_choicepoints( USES_REGS1 )
{ {
Yap_total_choicepoints = 0; LOCAL_total_choicepoints = 0;
return TRUE; return TRUE;
} }

View File

@ -85,7 +85,7 @@ STATIC_PROTO(wtype AtomIsSymbols, (unsigned char *));
STATIC_PROTO(void putAtom, (Atom, int, wrf)); STATIC_PROTO(void putAtom, (Atom, int, wrf));
STATIC_PROTO(void writeTerm, (Term, int, int, int, struct write_globs *, struct rewind_term *)); 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 static void
wrputn(Int n, wrf writewch) /* writes an integer */ wrputn(Int n, wrf writewch) /* writes an integer */

View File

@ -734,7 +734,7 @@ Macros to check the limits of stacks
ENDP(pt0) ENDP(pt0)
#if LOW_LEVEL_TRACER #if LOW_LEVEL_TRACER
#define COUNT_CPS() Yap_total_choicepoints++ #define COUNT_CPS() LOCAL_total_choicepoints++
#else #else
#define COUNT_CPS() #define COUNT_CPS()
#endif #endif

View File

@ -5,137 +5,131 @@
#define Yap_c_input_stream WL->c_input_stream #define LOCAL_c_input_stream WL->c_input_stream
#define Yap_c_output_stream WL->c_output_stream #define LOCAL_c_output_stream WL->c_output_stream
#define Yap_c_error_stream WL->c_error_stream #define LOCAL_c_error_stream WL->c_error_stream
#define OldASP WL->rinfo.old_ASP #define LOCAL_OldASP WL->rinfo.old_ASP
#define OldLCL0 WL->rinfo.old_LCL0 #define LOCAL_OldLCL0 WL->rinfo.old_LCL0
#define OldTR WL->rinfo.old_TR #define LOCAL_OldTR WL->rinfo.old_TR
#define OldGlobalBase WL->rinfo.old_GlobalBase #define LOCAL_OldGlobalBase WL->rinfo.old_GlobalBase
#define OldH WL->rinfo.old_H #define LOCAL_OldH WL->rinfo.old_H
#define OldH0 WL->rinfo.old_H0 #define LOCAL_OldH0 WL->rinfo.old_H0
#define OldTrailBase WL->rinfo.old_TrailBase #define LOCAL_OldTrailBase WL->rinfo.old_TrailBase
#define OldTrailTop WL->rinfo.old_TrailTop #define LOCAL_OldTrailTop WL->rinfo.old_TrailTop
#define OldHeapBase WL->rinfo.old_HeapBase #define LOCAL_OldHeapBase WL->rinfo.old_HeapBase
#define OldHeapTop WL->rinfo.old_HeapTop #define LOCAL_OldHeapTop WL->rinfo.old_HeapTop
#define ClDiff WL->rinfo.cl_diff #define LOCAL_ClDiff WL->rinfo.cl_diff
#define GDiff WL->rinfo.g_diff #define LOCAL_GDiff WL->rinfo.g_diff
#define HDiff WL->rinfo.h_diff #define LOCAL_HDiff WL->rinfo.h_diff
#define GDiff0 WL->rinfo.g_diff0 #define LOCAL_GDiff0 WL->rinfo.g_diff0
#define GSplit WL->rinfo.g_split #define LOCAL_GSplit WL->rinfo.g_split
#define LDiff WL->rinfo.l_diff #define LOCAL_LDiff WL->rinfo.l_diff
#define TrDiff WL->rinfo.tr_diff #define LOCAL_TrDiff WL->rinfo.tr_diff
#define XDiff WL->rinfo.x_diff #define LOCAL_XDiff WL->rinfo.x_diff
#define DelayDiff WL->rinfo.delay_diff #define LOCAL_DelayDiff WL->rinfo.delay_diff
#define BaseDiff WL->rinfo.base_diff #define LOCAL_BaseDiff WL->rinfo.base_diff
#define ReductionsCounter WL->call_counters.reductions #define LOCAL_ReductionsCounter WL->call_counters.reductions
#define PredEntriesCounter WL->call_counters.reductions_retries #define LOCAL_PredEntriesCounter WL->call_counters.reductions_retries
#define RetriesCounter WL->call_counters.retries #define LOCAL_RetriesCounter WL->call_counters.retries
#define ReductionsCounterOn WL->call_counters.reductions_on #define LOCAL_ReductionsCounterOn WL->call_counters.reductions_on
#define PredEntriesCounterOn WL->call_counters.reductions_retries_on #define LOCAL_PredEntriesCounterOn WL->call_counters.reductions_retries_on
#define RetriesCounterOn WL->call_counters.retries_on #define LOCAL_RetriesCounterOn WL->call_counters.retries_on
#define Yap_InterruptsDisabled WL->interrupts_disabled #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 LOCAL_GlobalArena WL->global_arena
#define GlobalArenaOverflows WL->global_arena_overflows #define LOCAL_GlobalArenaOverflows WL->global_arena_overflows
#define DelayArenaOverflows WL->delay_arena_overflows #define LOCAL_ArenaOverflows WL->arena_overflows
#define ArenaOverflows WL->arena_overflows #define LOCAL_DepthArenas WL->depth_arenas
#define DepthArenas WL->depth_arenas #define LOCAL_ArithError WL->arith_error
#define ArithError WL->arith_error #define LOCAL_LastAssertedPred WL->last_asserted_pred
#define LastAssertedPred WL->last_asserted_pred #define LOCAL_DebugOn WL->debug_on
#define DebugOn WL->debug_on #define LOCAL_ScannerStack WL->scanner_stack
#define FormatInfo WL->f_info #define LOCAL_ScannerExtraBlocks WL->scanner_extra_blocks
#define ScannerStack WL->scanner_stack #define LOCAL_BallTerm WL->ball_term
#define ScannerExtraBlocks WL->scanner_extra_blocks #define LOCAL_ActiveSignals WL->active_signals
#define BallTerm WL->ball_term #define LOCAL_IPredArity WL->i_pred_arity
#define ActiveSignals WL->active_signals #define LOCAL_ProfEnd WL->prof_end
#define IPredArity WL->i_pred_arity #define LOCAL_UncaughtThrow WL->uncaught_throw
#define ProfEnd WL->prof_end #define LOCAL_DoingUndefp WL->doing_undefp
#define UncaughtThrow WL->uncaught_throw #define LOCAL_StartLine WL->start_line
#define DoingUndefp WL->doing_undefp #define LOCAL_ScratchPad WL->scratchpad
#define StartLine WL->start_line
#define ScratchPad WL->scratchpad
#ifdef COROUTINING #ifdef COROUTINING
#define WokenGoals WL->woken_goals #define LOCAL_WokenGoals WL->woken_goals
#define AttsMutableList WL->atts_mutable_list #define LOCAL_AttsMutableList WL->atts_mutable_list
#endif #endif
#define GcGeneration WL->gc_generation #define LOCAL_GcGeneration WL->gc_generation
#define GcPhase WL->gc_phase #define LOCAL_GcPhase WL->gc_phase
#define GcCurrentPhase WL->gc_current_phase #define LOCAL_GcCurrentPhase WL->gc_current_phase
#define GcCalls WL->gc_calls #define LOCAL_GcCalls WL->gc_calls
#define TotGcTime WL->tot_gc_time #define LOCAL_TotGcTime WL->tot_gc_time
#define TotGcRecovered WL->tot_gc_recovered #define LOCAL_TotGcRecovered WL->tot_gc_recovered
#define LastGcTime WL->last_gc_time #define LOCAL_LastGcTime WL->last_gc_time
#define LastSSTime WL->last_ss_time #define LOCAL_LastSSTime WL->last_ss_time
#if LOW_LEVEL_TRACER #if LOW_LEVEL_TRACER
#define Yap_total_choicepoints WL->total_cps #define LOCAL_total_choicepoints WL->total_cps
#endif #endif
#define consult_level WL->consult_level_ #define LOCAL_consult_level WL->consult_level_
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
#define SignalLock WL->signal_lock #define LOCAL_SignalLock WL->signal_lock
#define WPP WL->wpp #endif
#define total_marked WL->tot_marked #define LOCAL_total_marked WL->tot_marked
#define total_oldies WL->tot_oldies #define LOCAL_total_oldies WL->tot_oldies
#if DEBUG && COROUTINING #define LOCAL_current_B WL->wl_current_B
#define total_smarked WL->tot_smarked #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 #endif
#define current_B WL->wl_current_B #if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
#define prev_HB WL->wl_prev_HB #define LOCAL_sTR WL->wl_sTR
#define HGEN WL->hgen #define LOCAL_sTR0 WL->wl_sTR0
#define iptop WL->ip_top #define LOCAL_new_TR WL->new_tr
#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
#else #else
#define sTR WL->wl_sTR #define LOCAL_sTR WL->wl_sTR
#define sTR0 WL->wl_sTR0 #define LOCAL_sTR0 WL->wl_sTR0
#define new_TR WL->new_tr #define LOCAL_new_TR WL->new_tr
#endif #endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
#define cont_top0 WL->conttop0 #define LOCAL_cont_top0 WL->conttop0
#define cont_top WL->conttop #define LOCAL_cont_top WL->conttop
#define discard_trail_entries WL->disc_trail_entries #define LOCAL_discard_trail_entries WL->disc_trail_entries
#define gc_ma_hash_table WL->Gc_ma_hash_table #define LOCAL_gc_ma_hash_table WL->Gc_ma_hash_table
#define gc_ma_h_top WL->Gc_ma_h_top #define LOCAL_gc_ma_h_top WL->Gc_ma_h_top
#define gc_ma_h_list WL->Gc_ma_h_list #define LOCAL_gc_ma_h_list WL->Gc_ma_h_list
#define gc_timestamp WL->Gc_timestamp #define LOCAL_gc_timestamp WL->Gc_timestamp
#define db_vec WL->DB_vec #define LOCAL_db_vec WL->DB_vec
#define db_vec0 WL->DB_vec0 #define LOCAL_db_vec0 WL->DB_vec0
#define db_root WL->DB_root #define LOCAL_db_root WL->DB_root
#define db_nil WL->DB_nil #define LOCAL_db_nil WL->DB_nil
#endif /* defined(YAPOR) || defined(THREADS) */ #define LOCAL_gc_restore WL->gc_restore
#define Yap_gc_restore WL->gc_restore #define LOCAL_DynamicArrays WL->dynamic_arrays
#define DynamicArrays WL->dynamic_arrays #define LOCAL_StaticArrays WL->static_arrays
#define StaticArrays WL->static_arrays #define LOCAL_GlobalVariables WL->global_variables
#define GlobalVariables WL->global_variables #define LOCAL_AllowRestart WL->allow_restart
#define Yap_AllowRestart WL->allow_restart
#define Yap_CMemFirstBlock WL->cmem_first_block #define LOCAL_CMemFirstBlock WL->cmem_first_block
#define Yap_CMemFirstBlockSz WL->cmem_first_block_sz #define LOCAL_CMemFirstBlockSz WL->cmem_first_block_sz
#define Yap_LabelFirstArray WL->label_first_array #define LOCAL_LabelFirstArray WL->label_first_array
#define Yap_LabelFirstArraySz WL->label_first_array_sz #define LOCAL_LabelFirstArraySz WL->label_first_array_sz
#define PL_local_data_p WL->Yap_ld_ #define LOCAL_PL_local_data_p WL->Yap_ld_
#define execution WL->_execution #define LOCAL_execution WL->_execution
#ifdef THREADS #ifdef THREADS
#define ThreadHandle WL->thread_handle #define LOCAL_ThreadHandle WL->thread_handle
#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle) #define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle) #define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle)
#endif #endif

View File

@ -77,14 +77,10 @@
(CellPtr(B) < CellPtr(val) && CellPtr(val) <= \ (CellPtr(B) < CellPtr(val) && CellPtr(val) <= \
LCL0 && HEAP_PTR(val)))) LCL0 && HEAP_PTR(val))))
#if !defined(YAPOR) && !defined(THREADS)
extern char *Yap_bp;
#endif
#define MARK_BIT ((char)1) #define MARK_BIT ((char)1)
#define RMARK_BIT ((char)2) #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 MARKED_PTR(P) MARKED_PTR__(P PASS_REGS)
#define UNMARKED_MARK(P, BP) UNMARKED_MARK__(P, BP PASS_REGS) #define UNMARKED_MARK(P, BP) UNMARKED_MARK__(P, BP PASS_REGS)

View File

@ -50,16 +50,14 @@ typedef struct worker_local {
Term global_arena; Term global_arena;
UInt global_arena_overflows; UInt global_arena_overflows;
Int delay_arena_overflows;
Int arena_overflows; Int arena_overflows;
Int depth_arenas; Int depth_arenas;
int arith_error; int arith_error;
struct pred_entry* last_asserted_pred; struct pred_entry* last_asserted_pred;
int debug_on; int debug_on;
struct format_status* f_info;
char* scanner_stack; char* scanner_stack;
struct scanner_extra_alloc* scanner_extra_blocks; struct scanner_extra_alloc* scanner_extra_blocks;
struct DB_TERM *ball_term; struct DB_TERM* ball_term;
UInt active_signals; UInt active_signals;
UInt i_pred_arity; UInt i_pred_arity;
yamop* prof_end; yamop* prof_end;
@ -84,32 +82,29 @@ typedef struct worker_local {
Int total_cps; Int total_cps;
#endif #endif
int consult_level_; int consult_level_;
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
lockvar signal_lock; lockvar signal_lock;
struct pred_entry* wpp; #endif
Int tot_marked; Int tot_marked;
Int tot_oldies; Int tot_oldies;
#if DEBUG && COROUTINING struct choicept* wl_current_B;
UInt tot_smarked;
#endif
struct choicept *wl_current_B;
CELL* wl_prev_HB; CELL* wl_prev_HB;
CELL* hgen; CELL* hgen;
CELL** ip_top; CELL** ip_top;
#if GC_NO_TAGS
#if defined(GC_NO_TAGS)
char* b_p; char* b_p;
#endif #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_sTR;
struct trail_frame* wl_sTR0; struct trail_frame* wl_sTR0;
struct trail_frame* new_tr; struct trail_frame* new_tr;
#else #endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
Term *wl_sTR;
Term *wl_sTR0;
Term *new_tr;
#endif
struct gc_mark_continuation* conttop0; struct gc_mark_continuation* conttop0;
struct gc_mark_continuation* conttop; struct gc_mark_continuation* conttop;
int disc_trail_entries; int disc_trail_entries;
@ -121,7 +116,6 @@ typedef struct worker_local {
ADDR DB_vec0; ADDR DB_vec0;
struct RB_red_blk_node* DB_root; struct RB_red_blk_node* DB_root;
struct RB_red_blk_node* DB_nil; struct RB_red_blk_node* DB_nil;
#endif /* defined(YAPOR) || defined(THREADS) */
sigjmp_buf gc_restore; sigjmp_buf gc_restore;
struct array_entry* dynamic_arrays; struct array_entry* dynamic_arrays;
struct static_array_entry* static_arrays; struct static_array_entry* static_arrays;
@ -134,7 +128,7 @@ typedef struct worker_local {
Int* label_first_array; Int* label_first_array;
UInt label_first_array_sz; UInt label_first_array_sz;
struct PL_local_data *Yap_ld_; struct PL_local_data* Yap_ld_;
struct open_query_struct* _execution; struct open_query_struct* _execution;
#ifdef THREADS #ifdef THREADS
struct thandle thread_handle; struct thandle thread_handle;

View File

@ -24,30 +24,30 @@ static void InitGlobal(void) {
#if THREADS #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 #endif
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
INIT_LOCK(Yap_global->bgl); INIT_LOCK(Yap_BGL);
#endif #endif
Yap_global->allow_local_expansion = TRUE; Yap_AllowLocalExpansion = TRUE;
Yap_global->allow_global_expansion = TRUE; Yap_AllowGlobalExpansion = TRUE;
Yap_global->allow_trail_expansion = TRUE; Yap_AllowTrailExpansion = TRUE;
Yap_global->size_of_overflow = 0; Yap_SizeOfOverflow = 0;
Yap_global->agc_last_call = 0; Yap_AGcLastCall = 0;
Yap_global->agc_threshold = 10000; Yap_AGcThreshold = 10000;
Yap_global->agc_hook = NULL; Yap_AGCHook = NULL;
#ifdef THREADS #ifdef THREADS
INIT_LOCK(Yap_global->thread_handles_lock); INIT_LOCK(Yap_ThreadHandlesLock);
#endif #endif
#if defined(YAPOR) || defined(TABLING) #if defined(YAPOR) || defined(TABLING)
@ -55,10 +55,10 @@ static void InitGlobal(void) {
#endif #endif
Yap_global->initialised = FALSE; Yap_Initialised = FALSE;
Yap_global->initialised_from_pl = FALSE; Yap_InitialisedFromPL = FALSE;
Yap_global->pl_argc = 0; Yap_PL_Argc = 0;
Yap_global->pl_argv = NULL; Yap_PL_Argv = NULL;
Yap_global->yap_halt_hook = NULL; Yap_HaltHooks = NULL;
} }

View File

@ -35,7 +35,7 @@
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
INIT_LOCK(Yap_heap_regs->dlmalloc_lock); INIT_LOCK(DLMallocLock);
#endif #endif
#endif #endif
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO) #if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
@ -51,10 +51,10 @@
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
INIT_LOCK(Yap_heap_regs->free_blocks_lock); INIT_LOCK(FreeBlocksLock);
INIT_LOCK(Yap_heap_regs->heap_used_lock); INIT_LOCK(HeapUsedLock);
INIT_LOCK(Yap_heap_regs->heap_top_lock); INIT_LOCK(HeapTopLock);
Yap_heap_regs->heap_top_owner = -1; HeapTopOwner = -1;
#endif #endif
@ -62,13 +62,13 @@
#endif #endif
Yap_heap_regs->execute_cpred_op_code = Yap_opcode(_execute_cpred); EXECUTE_CPRED_OP_CODE = Yap_opcode(_execute_cpred);
Yap_heap_regs->expand_op_code = Yap_opcode(_expand_index); EXPAND_OP_CODE = Yap_opcode(_expand_index);
Yap_heap_regs->fail_op = Yap_opcode(_op_fail); FAIL_OPCODE = Yap_opcode(_op_fail);
Yap_heap_regs->index_op = Yap_opcode(_index_pred); INDEX_OPCODE = Yap_opcode(_index_pred);
Yap_heap_regs->lockpred_op = Yap_opcode(_lock_pred); LOCKPRED_OPCODE = Yap_opcode(_lock_pred);
Yap_heap_regs->orlast_op = Yap_opcode(_or_last); ORLAST_OPCODE = Yap_opcode(_or_last);
Yap_heap_regs->undef_op = Yap_opcode(_undef_p); UNDEF_OPCODE = Yap_opcode(_undef_p);
@ -80,100 +80,100 @@
#include "iatoms.h" #include "iatoms.h"
#ifdef EUROTRA #ifdef EUROTRA
Yap_heap_regs->term_dollar_u = MkAtomTerm(AtomDollarU); TermDollarU = MkAtomTerm(AtomDollarU);
#endif #endif
Yap_heap_regs->term_prolog = MkAtomTerm(AtomProlog); TermProlog = MkAtomTerm(AtomProlog);
Yap_heap_regs->term_refound_var = MkAtomTerm(AtomRefoundVar); TermReFoundVar = MkAtomTerm(AtomRefoundVar);
Yap_heap_regs->user_module = MkAtomTerm(AtomUser); USER_MODULE = MkAtomTerm(AtomUser);
Yap_heap_regs->idb_module = MkAtomTerm(AtomIDB); IDB_MODULE = MkAtomTerm(AtomIDB);
Yap_heap_regs->attributes_module = MkAtomTerm(AtomAttributes); ATTRIBUTES_MODULE = MkAtomTerm(AtomAttributes);
Yap_heap_regs->charsio_module = MkAtomTerm(AtomCharsio); CHARSIO_MODULE = MkAtomTerm(AtomCharsio);
Yap_heap_regs->terms_module = MkAtomTerm(AtomTerms); TERMS_MODULE = MkAtomTerm(AtomTerms);
Yap_heap_regs->system_module = MkAtomTerm(AtomSystem); SYSTEM_MODULE = MkAtomTerm(AtomSystem);
Yap_heap_regs->operating_system_module = MkAtomTerm(AtomOperatingSystemSupport); OPERATING_SYSTEM_MODULE = MkAtomTerm(AtomOperatingSystemSupport);
Yap_heap_regs->readutil_module = MkAtomTerm(AtomReadutil); READUTIL_MODULE = MkAtomTerm(AtomReadutil);
Yap_heap_regs->hacks_module = MkAtomTerm(AtomYapHacks); HACKS_MODULE = MkAtomTerm(AtomYapHacks);
Yap_heap_regs->arg_module = MkAtomTerm(AtomArg); ARG_MODULE = MkAtomTerm(AtomArg);
Yap_heap_regs->globals_module = MkAtomTerm(AtomNb); GLOBALS_MODULE = MkAtomTerm(AtomNb);
Yap_heap_regs->swi_module = MkAtomTerm(AtomSwi); SWI_MODULE = MkAtomTerm(AtomSwi);
Yap_heap_regs->dbload_module = MkAtomTerm(AtomDBLoad); DBLOAD_MODULE = MkAtomTerm(AtomDBLoad);
Yap_heap_regs->current_modules = NULL; CurrentModules = NULL;
Yap_InitModules(); Yap_InitModules();
Yap_heap_regs->execution_mode = INTERPRETED; Yap_ExecutionMode = INTERPRETED;
InitPredHash(); InitPredHash();
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
#endif #endif
Yap_heap_regs->preds_in_hash_table = 0; PredsInHashTable = 0;
Yap_heap_regs->creep_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomCreep,1),PROLOG_MODULE)); CreepCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomCreep,1),PROLOG_MODULE));
Yap_heap_regs->undef_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomUndefp,1),PROLOG_MODULE)); UndefCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomUndefp,1),PROLOG_MODULE));
Yap_heap_regs->spy_code = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomSpy,1),PROLOG_MODULE)); SpyCode = RepPredProp(PredPropByFunc(Yap_MkFunctor(AtomSpy,1),PROLOG_MODULE));
Yap_heap_regs->pred_fail = RepPredProp(PredPropByAtom(AtomFail,PROLOG_MODULE)); PredFail = RepPredProp(PredPropByAtom(AtomFail,PROLOG_MODULE));
Yap_heap_regs->pred_true = RepPredProp(PredPropByAtom(AtomTrue,PROLOG_MODULE)); PredTrue = RepPredProp(PredPropByAtom(AtomTrue,PROLOG_MODULE));
#ifdef COROUTINING #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 #endif
Yap_heap_regs->pred_goal_expansion = RepPredProp(PredPropByFunc(FunctorGoalExpansion,USER_MODULE)); PredGoalExpansion = RepPredProp(PredPropByFunc(FunctorGoalExpansion,USER_MODULE));
Yap_heap_regs->pred_meta_call = RepPredProp(PredPropByFunc(FunctorMetaCall,PROLOG_MODULE)); PredMetaCall = RepPredProp(PredPropByFunc(FunctorMetaCall,PROLOG_MODULE));
Yap_heap_regs->pred_dollar_catch = RepPredProp(PredPropByFunc(FunctorCatch,PROLOG_MODULE)); PredDollarCatch = RepPredProp(PredPropByFunc(FunctorCatch,PROLOG_MODULE));
Yap_heap_regs->pred_recorded_with_key = RepPredProp(PredPropByFunc(FunctorRecordedWithKey,PROLOG_MODULE)); PredRecordedWithKey = RepPredProp(PredPropByFunc(FunctorRecordedWithKey,PROLOG_MODULE));
Yap_heap_regs->pred_log_upd_clause = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE)); PredLogUpdClause = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE));
Yap_heap_regs->pred_log_upd_clause_erase = RepPredProp(PredPropByFunc(FunctorDoLogUpdClauseErase,PROLOG_MODULE)); PredLogUpdClauseErase = RepPredProp(PredPropByFunc(FunctorDoLogUpdClauseErase,PROLOG_MODULE));
Yap_heap_regs->pred_log_upd_clause0 = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE)); PredLogUpdClause0 = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE));
Yap_heap_regs->pred_static_clause = RepPredProp(PredPropByFunc(FunctorDoStaticClause,PROLOG_MODULE)); PredStaticClause = RepPredProp(PredPropByFunc(FunctorDoStaticClause,PROLOG_MODULE));
Yap_heap_regs->pred_throw = RepPredProp(PredPropByFunc(FunctorThrow,PROLOG_MODULE)); PredThrow = RepPredProp(PredPropByFunc(FunctorThrow,PROLOG_MODULE));
Yap_heap_regs->pred_handle_throw = RepPredProp(PredPropByFunc(FunctorHandleThrow,PROLOG_MODULE)); PredHandleThrow = RepPredProp(PredPropByFunc(FunctorHandleThrow,PROLOG_MODULE));
Yap_heap_regs->pred_is = RepPredProp(PredPropByFunc(FunctorIs,PROLOG_MODULE)); PredIs = RepPredProp(PredPropByFunc(FunctorIs,PROLOG_MODULE));
Yap_heap_regs->pred_safe_call_cleanup = RepPredProp(PredPropByFunc(FunctorSafeCallCleanup,PROLOG_MODULE)); PredSafeCallCleanup = RepPredProp(PredPropByFunc(FunctorSafeCallCleanup,PROLOG_MODULE));
Yap_heap_regs->pred_restore_regs = RepPredProp(PredPropByFunc(FunctorRestoreRegs,PROLOG_MODULE)); PredRestoreRegs = RepPredProp(PredPropByFunc(FunctorRestoreRegs,PROLOG_MODULE));
#ifdef YAPOR #ifdef YAPOR
Yap_heap_regs->pred_getwork = RepPredProp(PredPropByAtom(AtomGetwork,PROLOG_MODULE)); PredGetwork = RepPredProp(PredPropByAtom(AtomGetwork,PROLOG_MODULE));
Yap_heap_regs->pred_getwork_seq = RepPredProp(PredPropByAtom(AtomGetworkSeq,PROLOG_MODULE)); PredGetworkSeq = RepPredProp(PredPropByAtom(AtomGetworkSeq,PROLOG_MODULE));
#endif /* YAPOR */ #endif /* YAPOR */
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
Yap_heap_regs->yap_do_low_level_trace = FALSE; Yap_do_low_level_trace = FALSE;
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
INIT_LOCK(Yap_heap_regs->low_level_trace_lock); INIT_LOCK(Yap_low_level_trace_lock);
#endif #endif
#endif #endif
Yap_heap_regs->clause_space = 0; Yap_ClauseSpace = 0;
Yap_heap_regs->index_space_Tree = 0; Yap_IndexSpace_Tree = 0;
Yap_heap_regs->index_space_EXT = 0; Yap_IndexSpace_EXT = 0;
Yap_heap_regs->index_space_SW = 0; Yap_IndexSpace_SW = 0;
Yap_heap_regs->lu_clause_space = 0; Yap_LUClauseSpace = 0;
Yap_heap_regs->lu_index_space_Tree = 0; Yap_LUIndexSpace_Tree = 0;
Yap_heap_regs->lu_index_space_CP = 0; Yap_LUIndexSpace_CP = 0;
Yap_heap_regs->lu_index_space_EXT = 0; Yap_LUIndexSpace_EXT = 0;
Yap_heap_regs->lu_index_space_SW = 0; Yap_LUIndexSpace_SW = 0;
Yap_heap_regs->dummycode->opc = Yap_opcode(_op_fail); DUMMYCODE->opc = Yap_opcode(_op_fail);
Yap_heap_regs->failcode->opc = Yap_opcode(_op_fail); FAILCODE->opc = Yap_opcode(_op_fail);
Yap_heap_regs->nocode->opc = Yap_opcode(_Nstop); NOCODE->opc = Yap_opcode(_Nstop);
InitEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail); InitEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail);
InitEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail); InitEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail);
InitOtaplInst(RTRYCODE,_retry_and_mark,PredFail); InitOtaplInst(RTRYCODE,_retry_and_mark,PredFail);
#ifdef BEAM #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 */ #endif /* BEAM */
#ifdef YAPOR #ifdef YAPOR
Yap_heap_regs->seq_def = FALSE; SEQUENTIAL_IS_DEFAULT = FALSE;
InitOtaplInst(GETWORK,_getwork,PredGetwork); InitOtaplInst(GETWORK,_getwork,PredGetwork);
InitOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq); 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 */ #endif /* YAPOR */
#ifdef TABLING #ifdef TABLING
InitOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail); 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; RETRY_C_RECORDEDP_CODE = NULL;
Yap_heap_regs->retry_recorded_k_code = NULL; RETRY_C_RECORDED_K_CODE = NULL;
Yap_heap_regs->system_profiling = FALSE; PROFILING = FALSE;
Yap_heap_regs->system_call_counting = FALSE; CALL_COUNTING = FALSE;
Yap_heap_regs->system_pred_goal_expansion_all = FALSE; PRED_GOAL_EXPANSION_ALL = FALSE;
Yap_heap_regs->system_pred_goal_expansion_func = FALSE; PRED_GOAL_EXPANSION_FUNC = FALSE;
Yap_heap_regs->system_pred_goal_expansion_on = FALSE; PRED_GOAL_EXPANSION_ON = FALSE;
Yap_heap_regs->compiler_optimizer_on = TRUE; optimizer_on = TRUE;
Yap_heap_regs->compiler_compile_mode = 0; compile_mode = 0;
Yap_heap_regs->compiler_profiling = FALSE; profiling = FALSE;
Yap_heap_regs->compiler_call_counting = FALSE; call_counting = FALSE;
Yap_heap_regs->compiler_compile_arrays = FALSE; compile_arrays = FALSE;
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
INIT_LOCK(Yap_heap_regs->dbterms_list_lock); INIT_LOCK(DBTermsListLock);
#endif #endif
Yap_heap_regs->dbterms_list = NULL; DBTermsList = NULL;
Yap_heap_regs->expand_clauses_first = NULL; ExpandClausesFirst = NULL;
Yap_heap_regs->expand_clauses_last = NULL; ExpandClausesLast = NULL;
Yap_heap_regs->expand_clauses = 0; Yap_ExpandClauses = 0;
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
INIT_LOCK(Yap_heap_regs->expand_clauses_list_lock); INIT_LOCK(ExpandClausesListLock);
INIT_LOCK(Yap_heap_regs->op_list_lock); INIT_LOCK(OpListLock);
#endif #endif
#ifdef DEBUG #ifdef DEBUG
Yap_heap_regs->new_cps = 0L; Yap_NewCps = 0L;
Yap_heap_regs->live_cps = 0L; Yap_LiveCps = 0L;
Yap_heap_regs->dirty_cps = 0L; Yap_DirtyCps = 0L;
Yap_heap_regs->freed_cps = 0L; Yap_FreedCps = 0L;
#endif #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; INT_KEYS = NULL;
Yap_heap_regs->IntLUKeys = NULL; INT_LU_KEYS = NULL;
Yap_heap_regs->IntBBKeys = NULL; INT_BB_KEYS = NULL;
Yap_heap_regs->int_keys_size = INT_KEYS_DEFAULT_SIZE; INT_KEYS_SIZE = INT_KEYS_DEFAULT_SIZE;
Yap_heap_regs->int_keys_timestamp = 0L; INT_KEYS_TIMESTAMP = 0L;
Yap_heap_regs->int_bb_keys_size = INT_KEYS_DEFAULT_SIZE; INT_BB_KEYS_SIZE = INT_KEYS_DEFAULT_SIZE;
Yap_heap_regs->update_mode = UPDATE_MODE_LOGICAL; UPDATE_MODE = UPDATE_MODE_LOGICAL;
InitDBErasedMarker(); InitDBErasedMarker();
InitLogDBErasedMarker(); InitLogDBErasedMarker();
Yap_heap_regs->dead_static_clauses = NULL; DeadStaticClauses = NULL;
Yap_heap_regs->dead_mega_clauses = NULL; DeadMegaClauses = NULL;
Yap_heap_regs->dead_static_indices = NULL; DeadStaticIndices = NULL;
Yap_heap_regs->db_erased_list = NULL; DBErasedList = NULL;
Yap_heap_regs->db_erased_ilist = NULL; DBErasedIList = NULL;
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
INIT_LOCK(Yap_heap_regs->dead_static_clauses_lock); INIT_LOCK(DeadStaticClausesLock);
INIT_LOCK(Yap_heap_regs->dead_mega_clauses_lock); INIT_LOCK(DeadMegaClausesLock);
INIT_LOCK(Yap_heap_regs->dead_static_indices_lock); INIT_LOCK(DeadStaticIndicesLock);
#endif #endif
#ifdef COROUTINING #ifdef COROUTINING
Yap_heap_regs->num_of_atts = 1; NUM_OF_ATTS = 1;
#endif #endif
InitFlags(); 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; NOfFileAliases = 0;
Yap_heap_regs->sz_of_file_aliases = 0; SzOfFileAliases = 0;
Yap_heap_regs->file_aliases = NULL; FileAliases = NULL;
Yap_heap_regs->atprompt = AtomNil; AtPrompt = AtomNil;
Yap_heap_regs->char_conversion_table = NULL; CharConversionTable = NULL;
Yap_heap_regs->char_conversion_table2 = 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 #if LOW_PROF
Yap_heap_regs->profiler_on = FALSE; ProfilerOn = FALSE;
Yap_heap_regs->offline_profiler = FALSE; Yap_OffLineProfiler = FALSE;
Yap_heap_regs->f_prof = NULL; FProf = NULL;
Yap_heap_regs->f_preds = NULL; FPreds = NULL;
Yap_heap_regs->prof_preds = 0L; ProfPreds = 0L;
#endif /* LOW_PROF */ #endif /* LOW_PROF */
Yap_heap_regs->foreign_code_loaded = NULL; ForeignCodeLoaded = NULL;
Yap_heap_regs->foreign_code_base = NULL; ForeignCodeBase = NULL;
Yap_heap_regs->foreign_code_top = NULL; ForeignCodeTop = NULL;
Yap_heap_regs->foreign_code_max = NULL; ForeignCodeMax = NULL;
Yap_heap_regs->yap_records = NULL; Yap_Records = NULL;
InitSWIAtoms(); InitSWIAtoms();
Yap_heap_regs->swi_blob_types = NULL; SWI_BlobTypes = NULL;
Yap_heap_regs->swi_blobs = NULL; SWI_Blobs = NULL;

View File

@ -48,13 +48,11 @@ static void InitWorker(int wid) {
FOREIGN(wid)->global_arena = 0L; FOREIGN(wid)->global_arena = 0L;
FOREIGN(wid)->global_arena_overflows = 0L; FOREIGN(wid)->global_arena_overflows = 0L;
FOREIGN(wid)->delay_arena_overflows = 0L;
FOREIGN(wid)->arena_overflows = 0L; FOREIGN(wid)->arena_overflows = 0L;
FOREIGN(wid)->depth_arenas = 0; FOREIGN(wid)->depth_arenas = 0;
FOREIGN(wid)->arith_error = FALSE; FOREIGN(wid)->arith_error = FALSE;
FOREIGN(wid)->last_asserted_pred = NULL; FOREIGN(wid)->last_asserted_pred = NULL;
FOREIGN(wid)->debug_on = FALSE; FOREIGN(wid)->debug_on = FALSE;
FOREIGN(wid)->f_info = NULL;
FOREIGN(wid)->scanner_stack = NULL; FOREIGN(wid)->scanner_stack = NULL;
FOREIGN(wid)->scanner_extra_blocks = NULL; FOREIGN(wid)->scanner_extra_blocks = NULL;
FOREIGN(wid)->ball_term = NULL; FOREIGN(wid)->ball_term = NULL;
@ -82,24 +80,21 @@ static void InitWorker(int wid) {
FOREIGN(wid)->total_cps = 0; FOREIGN(wid)->total_cps = 0;
#endif #endif
FOREIGN(wid)->consult_level_ = 0; FOREIGN(wid)->consult_level_ = 0;
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
INIT_LOCK(FOREIGN(wid)->signal_lock); INIT_LOCK(FOREIGN(wid)->signal_lock);
FOREIGN(wid)->wpp = NULL; #endif
FOREIGN(wid)->tot_marked = 0L; FOREIGN(wid)->tot_marked = 0L;
FOREIGN(wid)->tot_oldies = 0L; FOREIGN(wid)->tot_oldies = 0L;
#if DEBUG && COROUTINING
FOREIGN(wid)->tot_smarked = 0L;
#endif
FOREIGN(wid)->wl_current_B = NULL; FOREIGN(wid)->wl_current_B = NULL;
FOREIGN(wid)->wl_prev_HB = NULL; FOREIGN(wid)->wl_prev_HB = NULL;
FOREIGN(wid)->hgen = NULL; FOREIGN(wid)->hgen = NULL;
FOREIGN(wid)->ip_top = NULL; FOREIGN(wid)->ip_top = NULL;
#if GC_NO_TAGS
#if defined(GC_NO_TAGS)
FOREIGN(wid)->b_p = NULL; FOREIGN(wid)->b_p = NULL;
#endif #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_sTR = NULL;
FOREIGN(wid)->wl_sTR0 = NULL; FOREIGN(wid)->wl_sTR0 = NULL;
FOREIGN(wid)->new_tr = NULL; FOREIGN(wid)->new_tr = NULL;
@ -107,7 +102,7 @@ static void InitWorker(int wid) {
FOREIGN(wid)->wl_sTR = NULL; FOREIGN(wid)->wl_sTR = NULL;
FOREIGN(wid)->wl_sTR0 = NULL; FOREIGN(wid)->wl_sTR0 = NULL;
FOREIGN(wid)->new_tr = NULL; FOREIGN(wid)->new_tr = NULL;
#endif #endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
FOREIGN(wid)->conttop0 = NULL; FOREIGN(wid)->conttop0 = NULL;
FOREIGN(wid)->conttop = NULL; FOREIGN(wid)->conttop = NULL;
FOREIGN(wid)->disc_trail_entries = 0; FOREIGN(wid)->disc_trail_entries = 0;
@ -119,7 +114,6 @@ static void InitWorker(int wid) {
FOREIGN(wid)->DB_vec0 = NULL; FOREIGN(wid)->DB_vec0 = NULL;
FOREIGN(wid)->DB_root = NULL; FOREIGN(wid)->DB_root = NULL;
FOREIGN(wid)->DB_nil = NULL; FOREIGN(wid)->DB_nil = NULL;
#endif /* defined(YAPOR) || defined(THREADS) */
FOREIGN(wid)->dynamic_arrays = NULL; FOREIGN(wid)->dynamic_arrays = NULL;
FOREIGN(wid)->static_arrays = NULL; FOREIGN(wid)->static_arrays = NULL;

View File

@ -33,7 +33,7 @@ static void RestoreGlobal(void) {
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(Yap_global->bgl); REINIT_LOCK(Yap_BGL);
#endif #endif
@ -47,7 +47,7 @@ static void RestoreGlobal(void) {
#ifdef THREADS #ifdef THREADS
REINIT_LOCK(Yap_global->thread_handles_lock); REINIT_LOCK(Yap_ThreadHandlesLock);
#endif #endif
#if defined(YAPOR) || defined(TABLING) #if defined(YAPOR) || defined(TABLING)

View File

@ -1016,9 +1016,9 @@ static void
RestoreBallTerm(int wid) RestoreBallTerm(int wid)
{ {
CACHE_REGS CACHE_REGS
if (BallTerm) { if (LOCAL_BallTerm) {
BallTerm = DBTermAdjust(BallTerm); LOCAL_BallTerm = DBTermAdjust(LOCAL_BallTerm);
RestoreDBTerm(BallTerm, TRUE PASS_REGS); RestoreDBTerm(LOCAL_BallTerm, TRUE PASS_REGS);
} }
} }
@ -1030,7 +1030,7 @@ static void
restore_codes(void) restore_codes(void)
{ {
CACHE_REGS CACHE_REGS
Yap_heap_regs->heap_top = AddrAdjust(OldHeapTop); Yap_heap_regs->heap_top = AddrAdjust(LOCAL_OldHeapTop);
#include "rhstruct.h" #include "rhstruct.h"
RestoreGlobal(); RestoreGlobal();
#ifndef worker_id #ifndef worker_id

View File

@ -35,7 +35,7 @@
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(Yap_heap_regs->dlmalloc_lock); REINIT_LOCK(DLMallocLock);
#endif #endif
#endif #endif
#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO) #if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO)
@ -51,24 +51,24 @@
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(Yap_heap_regs->free_blocks_lock); REINIT_LOCK(FreeBlocksLock);
REINIT_LOCK(Yap_heap_regs->heap_used_lock); REINIT_LOCK(HeapUsedLock);
REINIT_LOCK(Yap_heap_regs->heap_top_lock); REINIT_LOCK(HeapTopLock);
#endif #endif
#if USE_THREADED_CODE #if USE_THREADED_CODE
Yap_heap_regs->op_rtable = OpRTableAdjust(Yap_heap_regs->op_rtable); OP_RTABLE = OpRTableAdjust(OP_RTABLE);
#endif #endif
Yap_heap_regs->execute_cpred_op_code = Yap_opcode(_execute_cpred); EXECUTE_CPRED_OP_CODE = Yap_opcode(_execute_cpred);
Yap_heap_regs->expand_op_code = Yap_opcode(_expand_index); EXPAND_OP_CODE = Yap_opcode(_expand_index);
Yap_heap_regs->fail_op = Yap_opcode(_op_fail); FAIL_OPCODE = Yap_opcode(_op_fail);
Yap_heap_regs->index_op = Yap_opcode(_index_pred); INDEX_OPCODE = Yap_opcode(_index_pred);
Yap_heap_regs->lockpred_op = Yap_opcode(_lock_pred); LOCKPRED_OPCODE = Yap_opcode(_lock_pred);
Yap_heap_regs->orlast_op = Yap_opcode(_or_last); ORLAST_OPCODE = Yap_opcode(_or_last);
Yap_heap_regs->undef_op = Yap_opcode(_undef_p); UNDEF_OPCODE = Yap_opcode(_undef_p);
@ -80,27 +80,27 @@
#include "ratoms.h" #include "ratoms.h"
#ifdef EUROTRA #ifdef EUROTRA
Yap_heap_regs->term_dollar_u = AtomTermAdjust(Yap_heap_regs->term_dollar_u); TermDollarU = AtomTermAdjust(TermDollarU);
#endif #endif
Yap_heap_regs->term_prolog = AtomTermAdjust(Yap_heap_regs->term_prolog); TermProlog = AtomTermAdjust(TermProlog);
Yap_heap_regs->term_refound_var = AtomTermAdjust(Yap_heap_regs->term_refound_var); TermReFoundVar = AtomTermAdjust(TermReFoundVar);
Yap_heap_regs->user_module = AtomTermAdjust(Yap_heap_regs->user_module); USER_MODULE = AtomTermAdjust(USER_MODULE);
Yap_heap_regs->idb_module = AtomTermAdjust(Yap_heap_regs->idb_module); IDB_MODULE = AtomTermAdjust(IDB_MODULE);
Yap_heap_regs->attributes_module = AtomTermAdjust(Yap_heap_regs->attributes_module); ATTRIBUTES_MODULE = AtomTermAdjust(ATTRIBUTES_MODULE);
Yap_heap_regs->charsio_module = AtomTermAdjust(Yap_heap_regs->charsio_module); CHARSIO_MODULE = AtomTermAdjust(CHARSIO_MODULE);
Yap_heap_regs->terms_module = AtomTermAdjust(Yap_heap_regs->terms_module); TERMS_MODULE = AtomTermAdjust(TERMS_MODULE);
Yap_heap_regs->system_module = AtomTermAdjust(Yap_heap_regs->system_module); SYSTEM_MODULE = AtomTermAdjust(SYSTEM_MODULE);
Yap_heap_regs->operating_system_module = AtomTermAdjust(Yap_heap_regs->operating_system_module); OPERATING_SYSTEM_MODULE = AtomTermAdjust(OPERATING_SYSTEM_MODULE);
Yap_heap_regs->readutil_module = AtomTermAdjust(Yap_heap_regs->readutil_module); READUTIL_MODULE = AtomTermAdjust(READUTIL_MODULE);
Yap_heap_regs->hacks_module = AtomTermAdjust(Yap_heap_regs->hacks_module); HACKS_MODULE = AtomTermAdjust(HACKS_MODULE);
Yap_heap_regs->arg_module = AtomTermAdjust(Yap_heap_regs->arg_module); ARG_MODULE = AtomTermAdjust(ARG_MODULE);
Yap_heap_regs->globals_module = AtomTermAdjust(Yap_heap_regs->globals_module); GLOBALS_MODULE = AtomTermAdjust(GLOBALS_MODULE);
Yap_heap_regs->swi_module = AtomTermAdjust(Yap_heap_regs->swi_module); SWI_MODULE = AtomTermAdjust(SWI_MODULE);
Yap_heap_regs->dbload_module = AtomTermAdjust(Yap_heap_regs->dbload_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); CreepCode = PtoPredAdjust(CreepCode);
Yap_heap_regs->undef_code = PtoPredAdjust(Yap_heap_regs->undef_code); UndefCode = PtoPredAdjust(UndefCode);
Yap_heap_regs->spy_code = PtoPredAdjust(Yap_heap_regs->spy_code); SpyCode = PtoPredAdjust(SpyCode);
Yap_heap_regs->pred_fail = PtoPredAdjust(Yap_heap_regs->pred_fail); PredFail = PtoPredAdjust(PredFail);
Yap_heap_regs->pred_true = PtoPredAdjust(Yap_heap_regs->pred_true); PredTrue = PtoPredAdjust(PredTrue);
#ifdef COROUTINING #ifdef COROUTINING
Yap_heap_regs->wake_up_code = PtoPredAdjust(Yap_heap_regs->wake_up_code); WakeUpCode = PtoPredAdjust(WakeUpCode);
#endif #endif
Yap_heap_regs->pred_goal_expansion = PtoPredAdjust(Yap_heap_regs->pred_goal_expansion); PredGoalExpansion = PtoPredAdjust(PredGoalExpansion);
Yap_heap_regs->pred_meta_call = PtoPredAdjust(Yap_heap_regs->pred_meta_call); PredMetaCall = PtoPredAdjust(PredMetaCall);
Yap_heap_regs->pred_dollar_catch = PtoPredAdjust(Yap_heap_regs->pred_dollar_catch); PredDollarCatch = PtoPredAdjust(PredDollarCatch);
Yap_heap_regs->pred_recorded_with_key = PtoPredAdjust(Yap_heap_regs->pred_recorded_with_key); PredRecordedWithKey = PtoPredAdjust(PredRecordedWithKey);
Yap_heap_regs->pred_log_upd_clause = PtoPredAdjust(Yap_heap_regs->pred_log_upd_clause); PredLogUpdClause = PtoPredAdjust(PredLogUpdClause);
Yap_heap_regs->pred_log_upd_clause_erase = PtoPredAdjust(Yap_heap_regs->pred_log_upd_clause_erase); PredLogUpdClauseErase = PtoPredAdjust(PredLogUpdClauseErase);
Yap_heap_regs->pred_log_upd_clause0 = PtoPredAdjust(Yap_heap_regs->pred_log_upd_clause0); PredLogUpdClause0 = PtoPredAdjust(PredLogUpdClause0);
Yap_heap_regs->pred_static_clause = PtoPredAdjust(Yap_heap_regs->pred_static_clause); PredStaticClause = PtoPredAdjust(PredStaticClause);
Yap_heap_regs->pred_throw = PtoPredAdjust(Yap_heap_regs->pred_throw); PredThrow = PtoPredAdjust(PredThrow);
Yap_heap_regs->pred_handle_throw = PtoPredAdjust(Yap_heap_regs->pred_handle_throw); PredHandleThrow = PtoPredAdjust(PredHandleThrow);
Yap_heap_regs->pred_is = PtoPredAdjust(Yap_heap_regs->pred_is); PredIs = PtoPredAdjust(PredIs);
Yap_heap_regs->pred_safe_call_cleanup = PtoPredAdjust(Yap_heap_regs->pred_safe_call_cleanup); PredSafeCallCleanup = PtoPredAdjust(PredSafeCallCleanup);
Yap_heap_regs->pred_restore_regs = PtoPredAdjust(Yap_heap_regs->pred_restore_regs); PredRestoreRegs = PtoPredAdjust(PredRestoreRegs);
#ifdef YAPOR #ifdef YAPOR
Yap_heap_regs->pred_getwork = PtoPredAdjust(Yap_heap_regs->pred_getwork); PredGetwork = PtoPredAdjust(PredGetwork);
Yap_heap_regs->pred_getwork_seq = PtoPredAdjust(Yap_heap_regs->pred_getwork_seq); PredGetworkSeq = PtoPredAdjust(PredGetworkSeq);
#endif /* YAPOR */ #endif /* YAPOR */
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(Yap_heap_regs->low_level_trace_lock); REINIT_LOCK(Yap_low_level_trace_lock);
#endif #endif
#endif #endif
@ -158,22 +158,22 @@
Yap_heap_regs->dummycode->opc = Yap_opcode(_op_fail); DUMMYCODE->opc = Yap_opcode(_op_fail);
Yap_heap_regs->failcode->opc = Yap_opcode(_op_fail); FAILCODE->opc = Yap_opcode(_op_fail);
Yap_heap_regs->nocode->opc = Yap_opcode(_Nstop); NOCODE->opc = Yap_opcode(_Nstop);
RestoreEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail); RestoreEnvInst(ENV_FOR_TRUSTFAIL,&TRUSTFAILCODE,_trust_fail,PredFail);
RestoreEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail); RestoreEnvInst(ENV_FOR_YESCODE,&YESCODE,_Ystop,PredFail);
RestoreOtaplInst(RTRYCODE,_retry_and_mark,PredFail); RestoreOtaplInst(RTRYCODE,_retry_and_mark,PredFail);
#ifdef BEAM #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 */ #endif /* BEAM */
#ifdef YAPOR #ifdef YAPOR
RestoreOtaplInst(GETWORK,_getwork,PredGetwork); RestoreOtaplInst(GETWORK,_getwork,PredGetwork);
RestoreOtaplInst(GETWORK_SEQ,_getwork_seq,PredGetworkSeq); 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 */ #endif /* YAPOR */
#ifdef TABLING #ifdef TABLING
RestoreOtaplInst(LOAD_ANSWER,_table_load_answer,PredFail); 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); RETRY_C_RECORDEDP_CODE = PtoOpAdjust(RETRY_C_RECORDEDP_CODE);
Yap_heap_regs->retry_recorded_k_code = PtoOpAdjust(Yap_heap_regs->retry_recorded_k_code); RETRY_C_RECORDED_K_CODE = PtoOpAdjust(RETRY_C_RECORDED_K_CODE);
@ -203,7 +203,7 @@
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(Yap_heap_regs->dbterms_list_lock); REINIT_LOCK(DBTermsListLock);
#endif #endif
RestoreDBTermsList(); RestoreDBTermsList();
@ -211,8 +211,8 @@
RestoreExpandList(); RestoreExpandList();
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(Yap_heap_regs->expand_clauses_list_lock); REINIT_LOCK(ExpandClausesListLock);
REINIT_LOCK(Yap_heap_regs->op_list_lock); REINIT_LOCK(OpListLock);
#endif #endif
#ifdef DEBUG #ifdef DEBUG
@ -247,9 +247,9 @@
RestoreDBErasedList(); RestoreDBErasedList();
RestoreDBErasedIList(); RestoreDBErasedIList();
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(Yap_heap_regs->dead_static_clauses_lock); REINIT_LOCK(DeadStaticClausesLock);
REINIT_LOCK(Yap_heap_regs->dead_mega_clauses_lock); REINIT_LOCK(DeadMegaClausesLock);
REINIT_LOCK(Yap_heap_regs->dead_static_indices_lock); REINIT_LOCK(DeadStaticIndicesLock);
#endif #endif
#ifdef COROUTINING #ifdef COROUTINING
@ -260,7 +260,7 @@
Yap_heap_regs->op_list = OpListAdjust(Yap_heap_regs->op_list); OpList = OpListAdjust(OpList);
RestoreStreams(); RestoreStreams();
@ -269,17 +269,17 @@
RestoreAliases(); 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); CharConversionTable = CodeCharPAdjust(CharConversionTable);
Yap_heap_regs->char_conversion_table2 = CodeCharPAdjust(Yap_heap_regs->char_conversion_table2); 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 #if LOW_PROF

View File

@ -55,8 +55,6 @@ static void RestoreWorker(int wid USES_REGS) {
RestoreBallTerm(wid); RestoreBallTerm(wid);
@ -82,24 +80,21 @@ static void RestoreWorker(int wid USES_REGS) {
#endif #endif
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(FOREIGN(wid)->signal_lock); REINIT_LOCK(FOREIGN(wid)->signal_lock);
#if DEBUG && COROUTINING
#endif #endif
#if GC_NO_TAGS
#if defined(GC_NO_TAGS)
#endif #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)->dynamic_arrays = PtoArrayEAdjust(FOREIGN(wid)->dynamic_arrays);
FOREIGN(wid)->static_arrays = PtoArraySAdjust(FOREIGN(wid)->static_arrays); FOREIGN(wid)->static_arrays = PtoArraySAdjust(FOREIGN(wid)->static_arrays);

View File

@ -140,13 +140,13 @@ inline EXTERN CELL *PtoGloAdjust__ (CELL * CACHE_TYPE);
inline EXTERN CELL * inline EXTERN CELL *
PtoGloAdjust__ (CELL * ptr USES_REGS) PtoGloAdjust__ (CELL * ptr USES_REGS)
{ {
if (ptr < GSplit) { if (ptr < LOCAL_GSplit) {
if (ptr < H0) if (ptr < H0)
return (CELL *) (((CELL *) (CharP (ptr) + DelayDiff))); return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_DelayDiff)));
else else
return (CELL *) (((CELL *) (CharP (ptr) + GDiff0))); return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_GDiff0)));
} else { } 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 * inline EXTERN CELL *
PtoDelayAdjust__ (CELL * ptr USES_REGS) PtoDelayAdjust__ (CELL * ptr USES_REGS)
{ {
if (!GSplit || ptr < GSplit) if (!LOCAL_GSplit || ptr < LOCAL_GSplit)
return (CELL *) (((CELL *) (CharP (ptr) + DelayDiff))); return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_DelayDiff)));
else else
return (CELL *) (((CELL *) (CharP (ptr) + GDiff0))); return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_GDiff0)));
} }
inline EXTERN CELL *PtoBaseAdjust__ (CELL * CACHE_TYPE); inline EXTERN CELL *PtoBaseAdjust__ (CELL * CACHE_TYPE);
@ -168,7 +168,7 @@ inline EXTERN CELL *PtoBaseAdjust__ (CELL * CACHE_TYPE);
inline EXTERN CELL * inline EXTERN CELL *
PtoBaseAdjust__ (CELL * ptr USES_REGS) 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 inline EXTERN tr_fr_ptr
PtoTRAdjust__ (tr_fr_ptr ptr USES_REGS) 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 * inline EXTERN CELL *
CellPtoTRAdjust__ (CELL * ptr USES_REGS) 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 * inline EXTERN CELL *
PtoLocAdjust__ (CELL * ptr USES_REGS) 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 * inline EXTERN struct cut_c_str *
CutCAdjust__ (struct cut_c_str * ptr USES_REGS) 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 inline EXTERN choiceptr
ChoicePtrAdjust__ (choiceptr ptr USES_REGS) 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 inline EXTERN choiceptr
ConsumerChoicePtrAdjust__ (choiceptr ptr USES_REGS) 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 inline EXTERN choiceptr
GeneratorChoicePtrAdjust__ (choiceptr ptr USES_REGS) 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 inline EXTERN CELL
GlobalAdjust__ (CELL val USES_REGS) GlobalAdjust__ (CELL val USES_REGS)
{ {
if ((CELL *)val < GSplit) { if ((CELL *)val < LOCAL_GSplit) {
if ((CELL *)val < H0) if ((CELL *)val < H0)
return (CELL) (val + DelayDiff); return (CELL) (val + LOCAL_DelayDiff);
else else
return (CELL) (val + GDiff0); return (CELL) (val + LOCAL_GDiff0);
} else { } else {
return (CELL) (val + GDiff); return (CELL) (val + LOCAL_GDiff);
} }
} }
@ -267,10 +267,10 @@ inline EXTERN CELL DelayAdjust__ (CELL CACHE_TYPE);
inline EXTERN CELL inline EXTERN CELL
DelayAdjust__ (CELL val USES_REGS) DelayAdjust__ (CELL val USES_REGS)
{ {
if (!GSplit || (CELL *)val < GSplit) if (!LOCAL_GSplit || (CELL *)val < LOCAL_GSplit)
return (CELL) (val + DelayDiff); return (CELL) (val + LOCAL_DelayDiff);
else else
return (CELL) (val + GDiff0); return (CELL) (val + LOCAL_GDiff0);
} }
@ -279,13 +279,13 @@ inline EXTERN ADDR GlobalAddrAdjust__ (ADDR CACHE_TYPE);
inline EXTERN ADDR inline EXTERN ADDR
GlobalAddrAdjust__ (ADDR ptr USES_REGS) GlobalAddrAdjust__ (ADDR ptr USES_REGS)
{ {
if ((CELL *)ptr < GSplit) { if ((CELL *)ptr < LOCAL_GSplit) {
if ((CELL *)ptr < H0) if ((CELL *)ptr < H0)
return (ADDR) (ptr + DelayDiff); return (ADDR) (ptr + LOCAL_DelayDiff);
else else
return (ADDR) ((ptr + GDiff0)); return (ADDR) ((ptr + LOCAL_GDiff0));
} else { } else {
return (ADDR) ((ptr + GDiff)); return (ADDR) ((ptr + LOCAL_GDiff));
} }
} }
@ -297,10 +297,10 @@ inline EXTERN ADDR DelayAddrAdjust__ (ADDR CACHE_TYPE);
inline EXTERN ADDR inline EXTERN ADDR
DelayAddrAdjust__ (ADDR ptr USES_REGS) DelayAddrAdjust__ (ADDR ptr USES_REGS)
{ {
if (!GSplit || (CELL *)ptr < GSplit) if (!LOCAL_GSplit || (CELL *)ptr < LOCAL_GSplit)
return (ADDR) ((ptr + DelayDiff)); return (ADDR) ((ptr + LOCAL_DelayDiff));
else else
return (ADDR) ((ptr + GDiff0)); return (ADDR) ((ptr + LOCAL_GDiff0));
} }
@ -309,7 +309,7 @@ inline EXTERN ADDR BaseAddrAdjust__ (ADDR CACHE_TYPE);
inline EXTERN ADDR inline EXTERN ADDR
BaseAddrAdjust__ (ADDR ptr USES_REGS) 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 inline EXTERN CELL
LocalAdjust__ (CELL val USES_REGS) 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 inline EXTERN ADDR
LocalAddrAdjust__ (ADDR ptr USES_REGS) 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 inline EXTERN CELL
TrailAdjust__ (CELL val USES_REGS) 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 inline EXTERN ADDR
TrailAddrAdjust__ (ADDR ptr USES_REGS) 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 * inline EXTERN TokEntry *
TokEntryAdjust__ (TokEntry * ptr USES_REGS) 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 * inline EXTERN VarEntry *
VarEntryAdjust__ (VarEntry * ptr USES_REGS) 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) FuncAdjust__ (Functor f USES_REGS)
{ {
if (!IsExtensionFunctor(f)) if (!IsExtensionFunctor(f))
return (Functor) ((CharP (f) + HDiff)); return (Functor) ((CharP (f) + LOCAL_HDiff));
return f; return f;
} }
@ -392,7 +392,7 @@ CellPtoHeapAdjust__ (CELL * ptr USES_REGS)
{ {
if (!ptr) if (!ptr)
return ptr; return ptr;
return (CELL *) (((CELL *) (CharP (ptr) + HDiff))); return (CELL *) (((CELL *) (CharP (ptr) + LOCAL_HDiff)));
} }
inline EXTERN HoldEntry *HoldEntryAdjust__ (HoldEntry * CACHE_TYPE); inline EXTERN HoldEntry *HoldEntryAdjust__ (HoldEntry * CACHE_TYPE);
@ -400,7 +400,7 @@ inline EXTERN HoldEntry *HoldEntryAdjust__ (HoldEntry * CACHE_TYPE);
inline EXTERN HoldEntry * inline EXTERN HoldEntry *
HoldEntryAdjust__ (HoldEntry * ptr USES_REGS) 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); inline EXTERN struct record_list *DBRecordAdjust__ (struct record_list * CACHE_TYPE);
@ -410,7 +410,7 @@ DBRecordAdjust__ (struct record_list * ptr USES_REGS)
{ {
if (!ptr) if (!ptr)
return 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 inline EXTERN Atom
AtomAdjust__ (Atom at USES_REGS) 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); inline EXTERN Atom NoAGCAtomAdjust__ (Atom CACHE_TYPE);
@ -457,7 +457,7 @@ inline EXTERN Atom NoAGCAtomAdjust__ (Atom CACHE_TYPE);
inline EXTERN Atom inline EXTERN Atom
NoAGCAtomAdjust__ (Atom at USES_REGS) 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 inline EXTERN Prop
PropAdjust__ (Prop p USES_REGS) 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 * inline EXTERN struct PL_blob_t *
BlobTypeAdjust__ (struct PL_blob_t *at USES_REGS) 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); inline EXTERN PredEntry *PredEntryAdjust__ (PredEntry * CACHE_TYPE);
@ -486,7 +486,7 @@ inline EXTERN PredEntry *PredEntryAdjust__ (PredEntry * CACHE_TYPE);
inline EXTERN PredEntry * inline EXTERN PredEntry *
PredEntryAdjust__ (PredEntry *p USES_REGS) 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); 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 * inline EXTERN struct mod_entry *
ModEntryPtrAdjust__ (struct mod_entry *p USES_REGS) 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); inline EXTERN COUNT ConstantAdjust__ (COUNT CACHE_TYPE);
@ -536,7 +536,7 @@ AtomTermAdjust__ (Term at USES_REGS)
{ {
if (at == 0L) if (at == 0L)
return at; return at;
return (Term)(CharP(at) + HDiff); return (Term)(CharP(at) + LOCAL_HDiff);
} }
inline EXTERN Term ModuleAdjust__ (Term CACHE_TYPE); inline EXTERN Term ModuleAdjust__ (Term CACHE_TYPE);
@ -554,7 +554,7 @@ CodeVarAdjust__ (Term var USES_REGS)
{ {
if (var == 0L) if (var == 0L)
return var; 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 inline EXTERN Term
BlobTermInCodeAdjust__ (Term t USES_REGS) 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 inline EXTERN Term
CodeComposedTermAdjust__ (Term t USES_REGS) 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 inline EXTERN Term
BlobTermInCodeAdjust__ (Term t USES_REGS) BlobTermInCodeAdjust__ (Term t USES_REGS)
{ {
return (Term) (CharP(t) + HDiff); return (Term) (CharP(t) + LOCAL_HDiff);
} }
inline EXTERN Term CodeComposedTermAdjust__ (Term CACHE_TYPE); inline EXTERN Term CodeComposedTermAdjust__ (Term CACHE_TYPE);
@ -593,7 +593,7 @@ inline EXTERN Term CodeComposedTermAdjust__ (Term CACHE_TYPE);
inline EXTERN Term inline EXTERN Term
CodeComposedTermAdjust__ (Term t USES_REGS) 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 * inline EXTERN AtomEntry *
AtomEntryAdjust__ (AtomEntry * at USES_REGS) 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); 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 * inline EXTERN struct mfile *
MFileAdjust__ (struct mfile * at USES_REGS) 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); inline EXTERN GlobalEntry *GlobalEntryAdjust__ (GlobalEntry * CACHE_TYPE);
@ -620,7 +620,7 @@ inline EXTERN GlobalEntry *GlobalEntryAdjust__ (GlobalEntry * CACHE_TYPE);
inline EXTERN GlobalEntry * inline EXTERN GlobalEntry *
GlobalEntryAdjust__ (GlobalEntry * at USES_REGS) 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 * inline EXTERN union CONSULT_OBJ *
ConsultObjAdjust__ (union CONSULT_OBJ *co USES_REGS) 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 inline EXTERN DBRef
DBRefAdjust__ (DBRef dbr USES_REGS) 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 * inline EXTERN DBRef *
DBRefPAdjust__ (DBRef * dbrp USES_REGS) 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 * inline EXTERN DBTerm *
DBTermAdjust__ (DBTerm * dbtp USES_REGS) 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) SIndexAdjust__ (struct static_index *si USES_REGS)
{ {
return (struct static_index 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) LUIndexAdjust__ (struct logic_upd_index *lui USES_REGS)
{ {
return (struct logic_upd_index 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 inline EXTERN Term
CodeAdjust__ (Term dbr USES_REGS) 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 inline EXTERN ADDR
AddrAdjust__ (ADDR addr USES_REGS) 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 inline EXTERN CODEADDR
CodeAddrAdjust__ (CODEADDR addr USES_REGS) 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) if (!addr)
return NULL; return NULL;
return addr + HDiff; return addr + LOCAL_HDiff;
} }
inline EXTERN void * CodeVoidPAdjust__ (void * CACHE_TYPE); inline EXTERN void * CodeVoidPAdjust__ (void * CACHE_TYPE);
@ -734,7 +734,7 @@ CodeVoidPAdjust__ (void * addr USES_REGS)
{ {
if (!addr) if (!addr)
return NULL; return NULL;
return addr + HDiff; return addr + LOCAL_HDiff;
} }
inline EXTERN struct halt_hook *HaltHookAdjust__ (struct halt_hook * CACHE_TYPE); inline EXTERN struct halt_hook *HaltHookAdjust__ (struct halt_hook * CACHE_TYPE);
@ -744,7 +744,7 @@ HaltHookAdjust__ (struct halt_hook * addr USES_REGS)
{ {
if (!addr) if (!addr)
return NULL; return NULL;
return (struct halt_hook *) (CharP (addr) + HDiff); return (struct halt_hook *) (CharP (addr) + LOCAL_HDiff);
} }
inline EXTERN BlockHeader *BlockAdjust__ (BlockHeader * CACHE_TYPE); inline EXTERN BlockHeader *BlockAdjust__ (BlockHeader * CACHE_TYPE);
@ -752,7 +752,7 @@ inline EXTERN BlockHeader *BlockAdjust__ (BlockHeader * CACHE_TYPE);
inline EXTERN BlockHeader * inline EXTERN BlockHeader *
BlockAdjust__ (BlockHeader * addr USES_REGS) 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); inline EXTERN yamop *PtoOpAdjust__ (yamop * CACHE_TYPE);
@ -761,7 +761,7 @@ inline EXTERN yamop *
PtoOpAdjust__ (yamop * ptr USES_REGS) PtoOpAdjust__ (yamop * ptr USES_REGS)
{ {
if (ptr) if (ptr)
return (yamop *) (CharP (ptr) + HDiff); return (yamop *) (CharP (ptr) + LOCAL_HDiff);
return ptr; return ptr;
} }
@ -772,7 +772,7 @@ OpListAdjust__ (struct operator_entry * ptr USES_REGS)
{ {
if (!ptr) if (!ptr)
return 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 * inline EXTERN struct logic_upd_clause *
PtoLUClauseAdjust__ (struct logic_upd_clause * ptr USES_REGS) 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); 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 * inline EXTERN struct logic_upd_index *
PtoLUIndexAdjust__ (struct logic_upd_index * ptr USES_REGS) 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 * inline EXTERN CELL *
PtoHeapCellAdjust__ (CELL * ptr USES_REGS) 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); inline EXTERN AtomHashEntry *PtoAtomHashEntryAdjust__ (AtomHashEntry * CACHE_TYPE);
@ -807,7 +807,7 @@ inline EXTERN AtomHashEntry *PtoAtomHashEntryAdjust__ (AtomHashEntry * CACHE_TYP
inline EXTERN AtomHashEntry * inline EXTERN AtomHashEntry *
PtoAtomHashEntryAdjust__ (AtomHashEntry * ptr USES_REGS) 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); inline EXTERN Term TermToGlobalAdjust__ (Term CACHE_TYPE);
@ -841,7 +841,7 @@ inline EXTERN opentry *OpRTableAdjust__ (opentry * CACHE_TYPE);
inline EXTERN opentry * inline EXTERN opentry *
OpRTableAdjust__ (opentry * ptr USES_REGS) 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); inline EXTERN OpEntry *OpEntryAdjust__ (OpEntry * CACHE_TYPE);
@ -849,7 +849,7 @@ inline EXTERN OpEntry *OpEntryAdjust__ (OpEntry * CACHE_TYPE);
inline EXTERN OpEntry * inline EXTERN OpEntry *
OpEntryAdjust__ (OpEntry * ptr USES_REGS) 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); inline EXTERN PredEntry *PtoPredAdjust__ (PredEntry * CACHE_TYPE);
@ -857,7 +857,7 @@ inline EXTERN PredEntry *PtoPredAdjust__ (PredEntry * CACHE_TYPE);
inline EXTERN PredEntry * inline EXTERN PredEntry *
PtoPredAdjust__ (PredEntry * ptr USES_REGS) 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); inline EXTERN PredEntry **PtoPtoPredAdjust__ (PredEntry ** CACHE_TYPE);
@ -867,7 +867,7 @@ PtoPtoPredAdjust__ (PredEntry **ptr USES_REGS)
{ {
if (!ptr) if (!ptr)
return NULL; 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) if (!ptr)
return NULL; 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) if (!ptr)
return NULL; 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) if (!ptr)
return NULL; 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) PtoLUCAdjust__ (struct logic_upd_clause *ptr USES_REGS)
{ {
return (struct logic_upd_clause 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) PtoStCAdjust__ (struct static_clause *ptr USES_REGS)
{ {
return (struct static_clause 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 * inline EXTERN struct dbterm_list *
PtoDBTLAdjust__ (struct dbterm_list * addr USES_REGS) 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 inline EXTERN wamreg
XAdjust__ (wamreg reg USES_REGS) 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 inline EXTERN int
IsOldLocal__ (CELL reg USES_REGS) 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 inline EXTERN int
IsOldLocalPtr__ (CELL * ptr USES_REGS) 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 inline EXTERN int
IsOldLocalInTR__ (CELL reg USES_REGS) 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 inline EXTERN int
IsOldLocalInTRPtr__ (CELL * ptr USES_REGS) 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 inline EXTERN int
IsOldH__ (CELL reg USES_REGS) 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 inline EXTERN int
IsOldGlobal__ (CELL reg USES_REGS) 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 inline EXTERN int
IsOldDelay__ (CELL reg USES_REGS) 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 inline EXTERN int
IsOldGlobalPtr__ (CELL * ptr USES_REGS) 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 inline EXTERN int
IsOldTrail__ (CELL reg USES_REGS) 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 inline EXTERN int
IsOldTrailPtr__ (CELL * ptr USES_REGS) 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 inline EXTERN int
IsOldVarTableTrailPtr__ (struct VARSTRUCT *ptr USES_REGS) 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 inline EXTERN int
IsOldTokenTrailPtr__ (struct TOKEN *ptr USES_REGS) 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) IsOldCode__ (CELL reg USES_REGS)
{ {
#if USE_SYSTEM_MALLOC #if USE_SYSTEM_MALLOC
return reg < (CELL)OldGlobalBase || reg > (CELL)OldTrailTop; return reg < (CELL)LOCAL_OldGlobalBase || reg > (CELL)LOCAL_OldTrailTop;
#else #else
return (int) (IN_BETWEEN (OldHeapBase, reg, OldHeapTop)); return (int) (IN_BETWEEN (LOCAL_OldHeapBase, reg, LOCAL_OldHeapTop));
#endif #endif
} }
@ -1113,7 +1113,7 @@ inline EXTERN int IsOldCodeCellPtr__ (CELL * CACHE_TYPE);
inline EXTERN int inline EXTERN int
IsOldCodeCellPtr__ (CELL * ptr USES_REGS) IsOldCodeCellPtr__ (CELL * ptr USES_REGS)
{ {
return (int) (IN_BETWEEN (OldHeapBase, ptr, OldHeapTop)); return (int) (IN_BETWEEN (LOCAL_OldHeapBase, ptr, LOCAL_OldHeapTop));
} }

View File

@ -265,7 +265,7 @@ chtype(Int ch)
/* parser stack, used to be AuxSp, now is ASP */ /* parser stack, used to be AuxSp, now is ASP */
#define ParserAuxSp ScannerStack #define ParserAuxSp LOCAL_ScannerStack
/* routines in parser.c */ /* routines in parser.c */
VarEntry STD_PROTO(*Yap_LookupVar,(char *)); VarEntry STD_PROTO(*Yap_LookupVar,(char *));

View File

@ -65,13 +65,13 @@ void make_root_choice_point(void) {
this is tricky, we need to get the B from some other stack this is tricky, we need to get the B from some other stack
and convert back to our own stack; and convert back to our own stack;
*/ */
OldLCL0 = LCL0; LOCAL_OldLCL0 = LCL0;
LCL0 = FOREIGN_ThreadHandle(0).current_yaam_regs->LCL0_; LCL0 = FOREIGN_ThreadHandle(0).current_yaam_regs->LCL0_;
imageB = Get_Yap_root_cp(); imageB = Get_Yap_root_cp();
/* we know B */ /* we know B */
B->cp_tr = TR = B->cp_tr = TR =
(tr_fr_ptr)((CELL)(imageB->cp_tr)+((CELL)OldLCL0-(CELL)LCL0)); (tr_fr_ptr)((CELL)(imageB->cp_tr)+((CELL)LOCAL_OldLCL0-(CELL)LCL0));
LCL0 = OldLCL0; LCL0 = LOCAL_OldLCL0;
} }
B->cp_h = H0; B->cp_h = H0;
B->cp_ap = GETWORK; B->cp_ap = GETWORK;

View File

@ -931,7 +931,7 @@ typedef struct opcode_tab_entry {
extern int optimizer_on; extern int optimizer_on;
/******************* the line for the current parse **********************/ /******************* the line for the current parse **********************/
extern int StartLine; extern int LOCAL_StartLine;
extern int StartCh; extern int StartCh;
extern int CurFileNo; extern int CurFileNo;

View File

@ -24,19 +24,19 @@
/* The difference between the old stack pointers and the new ones */ /* The difference between the old stack pointers and the new ones */
extern Int HDiff, extern Int LOCAL_HDiff,
GDiff, LOCAL_GDiff,
LDiff, LOCAL_LDiff,
TrDiff, LOCAL_TrDiff,
XDiff, LOCAL_XDiff,
DelayDiff; LOCAL_DelayDiff;
/* The old stack pointers */ /* The old stack pointers */
extern CELL *OldASP, *OldLCL0; extern CELL *LOCAL_OldASP, *LOCAL_OldLCL0;
extern tr_fr_ptr OldTR; extern tr_fr_ptr LOCAL_OldTR;
extern CELL *OldGlobalBase, *OldH, *OldH0; extern CELL *LOCAL_OldGlobalBase, *LOCAL_OldH, *LOCAL_OldH0;
extern ADDR OldTrailBase, OldTrailTop; extern ADDR LOCAL_OldTrailBase, LOCAL_OldTrailTop;
extern ADDR OldHeapBase, OldHeapTop; extern ADDR LOCAL_OldHeapBase, LOCAL_OldHeapTop;
#define CharP(ptr) ((char *) (ptr)) #define CharP(ptr) ((char *) (ptr))
@ -56,7 +56,7 @@ inline EXTERN CELL * PtoGloAdjust(CELL *);
inline EXTERN CELL * PtoGloAdjust(CELL * ptr) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) inline EXTERN int IsOldCodeCellPtr(CELL * ptr)
{ {
return (int) (IN_BETWEEN(OldHeapBase, ptr, OldHeapTop) ); return (int) (IN_BETWEEN(LOCAL_OldHeapBase, ptr, LOCAL_OldHeapTop) );
} }

View File

@ -1031,7 +1031,7 @@ X_API int PL_throw(term_t exception)
{ {
CACHE_REGS CACHE_REGS
YAP_Throw(Yap_GetFromSlot(exception PASS_REGS)); YAP_Throw(Yap_GetFromSlot(exception PASS_REGS));
longjmp(execution->env, 0); longjmp(LOCAL_execution->env, 0);
return 0; return 0;
} }
@ -2133,14 +2133,14 @@ PL_open_foreign_frame(void)
CACHE_REGS CACHE_REGS
open_query *new = (open_query *)malloc(sizeof(open_query)); open_query *new = (open_query *)malloc(sizeof(open_query));
if (!new) return 0; if (!new) return 0;
new->old = execution; new->old = LOCAL_execution;
new->g = TermNil; new->g = TermNil;
new->open = FALSE; new->open = FALSE;
new->cp = CP; new->cp = CP;
new->p = P; new->p = P;
new->b = (CELL)(LCL0-(CELL*)B); new->b = (CELL)(LCL0-(CELL*)B);
new->slots = CurSlot; new->slots = CurSlot;
execution = new; LOCAL_execution = new;
{ {
/* initialise a new marker choicepoint */ /* initialise a new marker choicepoint */
choiceptr cp_b = ((choiceptr)ASP)-1; choiceptr cp_b = ((choiceptr)ASP)-1;
@ -2168,7 +2168,7 @@ PL_close_foreign_frame(fid_t f)
CurSlot = env->slots; CurSlot = env->slots;
B = (choiceptr)(LCL0-env->b); B = (choiceptr)(LCL0-env->b);
ASP = (CELL *)(LCL0-CurSlot); ASP = (CELL *)(LCL0-CurSlot);
execution = env->old; LOCAL_execution = env->old;
free(env); free(env);
} }
@ -2200,9 +2200,9 @@ PL_discard_foreign_frame(fid_t f)
{ {
CACHE_REGS CACHE_REGS
open_query *env = (open_query *)f; 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 */ /* 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; while (env0 && env0 != env) env0 = env0->old;
if (!env0) if (!env0)
return; return;
@ -2213,7 +2213,7 @@ PL_discard_foreign_frame(fid_t f)
backtrack(); backtrack();
CP = env->cp; CP = env->cp;
P = env->p; P = env->p;
execution = env->old; LOCAL_execution = env->old;
ASP = LCL0-CurSlot; ASP = LCL0-CurSlot;
B = B->cp_b; B = B->cp_b;
free(env); 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 */ /* ignore flags and module for now */
PL_open_foreign_frame(); PL_open_foreign_frame();
execution->open=1; LOCAL_execution->open=1;
execution->state=0; LOCAL_execution->state=0;
PredicateInfo((PredEntry *)p, &yname, &arity, &m); PredicateInfo((PredEntry *)p, &yname, &arity, &m);
t[0] = SWIModuleToModule(ctx); t[0] = SWIModuleToModule(ctx);
if (arity == 0) { 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); t[0] = MkAtomTerm((Atom)ctx);
ti = Yap_MkApplTerm(FunctorModule,2,t); ti = Yap_MkApplTerm(FunctorModule,2,t);
t[0] = ti; t[0] = ti;
execution->g = Yap_MkApplTerm(FunctorCall,1,t); LOCAL_execution->g = Yap_MkApplTerm(FunctorCall,1,t);
} else { } else {
if (m && m != CurrentModule) { if (m && m != CurrentModule) {
Term ti; Term ti;
t[0] = m; t[0] = m;
ti = Yap_MkApplTerm(FunctorModule,2,t); ti = Yap_MkApplTerm(FunctorModule,2,t);
t[0] = ti; t[0] = ti;
execution->g = Yap_MkApplTerm(FunctorCall,1,t); LOCAL_execution->g = Yap_MkApplTerm(FunctorCall,1,t);
} else { } else {
execution->g = t[1]; LOCAL_execution->g = t[1];
} }
} }
return execution; return LOCAL_execution;
} }
X_API int PL_next_solution(qid_t qi) X_API int PL_next_solution(qid_t qi)
@ -2263,12 +2263,12 @@ X_API int PL_next_solution(qid_t qi)
CACHE_REGS CACHE_REGS
int result; int result;
if (qi->open != 1) return 0; if (qi->open != 1) return 0;
if (setjmp(execution->env)) if (setjmp(LOCAL_execution->env))
return 0; return 0;
if (qi->state == 0) { if (qi->state == 0) {
result = YAP_RunGoal(qi->g); result = YAP_RunGoal(qi->g);
} else { } else {
Yap_AllowRestart = qi->open; LOCAL_AllowRestart = qi->open;
result = YAP_RestartGoal(); result = YAP_RestartGoal();
} }
qi->state = 1; qi->state = 1;

View File

@ -2,157 +2,150 @@
START_WORKER_LOCAL START_WORKER_LOCAL
// Streams // Streams
int c_input_stream Yap_c_input_stream =0 int c_input_stream LOCAL_c_input_stream =0
int c_output_stream Yap_c_output_stream =1 int c_output_stream LOCAL_c_output_stream =1
int c_error_stream Yap_c_error_stream =2 int c_error_stream LOCAL_c_error_stream =2
/* shifts and restore: per local data-structure */ /* shifts and restore: per local data-structure */
restoreinfo rinfo restoreinfo rinfo
. rinfo.old_ASP OldASP =NULL . rinfo.old_ASP LOCAL_OldASP =NULL
. rinfo.old_LCL0 OldLCL0 =NULL . rinfo.old_LCL0 LOCAL_OldLCL0 =NULL
. rinfo.old_TR OldTR =NULL . rinfo.old_TR LOCAL_OldTR =NULL
. rinfo.old_GlobalBase OldGlobalBase =NULL . rinfo.old_GlobalBase LOCAL_OldGlobalBase =NULL
. rinfo.old_H OldH =NULL . rinfo.old_H LOCAL_OldH =NULL
. rinfo.old_H0 OldH0 =NULL . rinfo.old_H0 LOCAL_OldH0 =NULL
. rinfo.old_TrailBase OldTrailBase =NULL . rinfo.old_TrailBase LOCAL_OldTrailBase =NULL
. rinfo.old_TrailTop OldTrailTop =NULL . rinfo.old_TrailTop LOCAL_OldTrailTop =NULL
. rinfo.old_HeapBase OldHeapBase =NULL . rinfo.old_HeapBase LOCAL_OldHeapBase =NULL
. rinfo.old_HeapTop OldHeapTop =NULL . rinfo.old_HeapTop LOCAL_OldHeapTop =NULL
. rinfo.cl_diff ClDiff =0L . rinfo.cl_diff LOCAL_ClDiff =0L
. rinfo.g_diff GDiff =0L . rinfo.g_diff LOCAL_GDiff =0L
. rinfo.h_diff HDiff =0L . rinfo.h_diff LOCAL_HDiff =0L
. rinfo.g_diff0 GDiff0 =0L . rinfo.g_diff0 LOCAL_GDiff0 =0L
. rinfo.g_split GSplit =NULL . rinfo.g_split LOCAL_GSplit =NULL
. rinfo.l_diff LDiff =0L . rinfo.l_diff LOCAL_LDiff =0L
. rinfo.tr_diff TrDiff =0L . rinfo.tr_diff LOCAL_TrDiff =0L
. rinfo.x_diff XDiff =0L . rinfo.x_diff LOCAL_XDiff =0L
. rinfo.delay_diff DelayDiff =0L . rinfo.delay_diff LOCAL_DelayDiff =0L
. rinfo.base_diff BaseDiff =0L . rinfo.base_diff LOCAL_BaseDiff =0L
struct reduction_counters call_counters struct reduction_counters call_counters
. call_counters.reductions ReductionsCounter =0L . call_counters.reductions LOCAL_ReductionsCounter =0L
. call_counters.reductions_retries PredEntriesCounter =0L . call_counters.reductions_retries LOCAL_PredEntriesCounter =0L
. call_counters.retries RetriesCounter =0L . call_counters.retries LOCAL_RetriesCounter =0L
. call_counters.reductions_on ReductionsCounterOn =0L . call_counters.reductions_on LOCAL_ReductionsCounterOn =0L
. call_counters.reductions_retries_on PredEntriesCounterOn =0L . call_counters.reductions_retries_on LOCAL_PredEntriesCounterOn =0L
. call_counters.retries_on RetriesCounterOn =0L . call_counters.retries_on LOCAL_RetriesCounterOn =0L
int interrupts_disabled Yap_InterruptsDisabled =FALSE int interrupts_disabled LOCAL_InterruptsDisabled =FALSE
// support for consulting files // support for consulting files
/* current consult stack */ /* current consult stack */
union CONSULT_OBJ* consultsp ConsultSp =NULL union CONSULT_OBJ* consultsp LOCAL_ConsultSp =NULL
/* current maximum number of cells in consult stack */ /* current maximum number of cells in consult stack */
UInt consultcapacity ConsultCapacity void UInt consultcapacity LOCAL_ConsultCapacity void
/* top of consult stack */ /* top of consult stack */
union CONSULT_OBJ* consultbase ConsultBase =NULL union CONSULT_OBJ* consultbase LOCAL_ConsultBase =NULL
/* low-water mark for consult */ /* low-water mark for consult */
union CONSULT_OBJ* consultlow ConsultLow =NULL union CONSULT_OBJ* consultlow LOCAL_ConsultLow =NULL
//global variables //global variables
Term global_arena GlobalArena =0L TermToGlobalOrAtomAdjust Term global_arena LOCAL_GlobalArena =0L TermToGlobalOrAtomAdjust
UInt global_arena_overflows GlobalArenaOverflows =0L UInt global_arena_overflows LOCAL_GlobalArenaOverflows =0L
Int delay_arena_overflows DelayArenaOverflows =0L Int arena_overflows LOCAL_ArenaOverflows =0L
Int arena_overflows ArenaOverflows =0L Int depth_arenas LOCAL_DepthArenas =0
Int depth_arenas DepthArenas =0
int arith_error ArithError =FALSE int arith_error LOCAL_ArithError =FALSE
struct pred_entry* last_asserted_pred LastAssertedPred =NULL struct pred_entry* last_asserted_pred LOCAL_LastAssertedPred =NULL
int debug_on DebugOn =FALSE int debug_on LOCAL_DebugOn =FALSE
struct format_status* f_info FormatInfo =NULL char* scanner_stack LOCAL_ScannerStack =NULL
char* scanner_stack ScannerStack =NULL struct scanner_extra_alloc* scanner_extra_blocks LOCAL_ScannerExtraBlocks =NULL
struct scanner_extra_alloc* scanner_extra_blocks ScannerExtraBlocks =NULL struct DB_TERM* ball_term LOCAL_BallTerm =NULL RestoreBallTerm(wid)
struct DB_TERM *ball_term BallTerm =NULL RestoreBallTerm(wid) UInt active_signals LOCAL_ActiveSignals =0L
UInt active_signals ActiveSignals =0L UInt i_pred_arity LOCAL_IPredArity =0L
UInt i_pred_arity IPredArity =0L yamop* prof_end LOCAL_ProfEnd =NULL
yamop* prof_end ProfEnd =NULL int uncaught_throw LOCAL_UncaughtThrow =FALSE
int uncaught_throw UncaughtThrow =FALSE int doing_undefp LOCAL_DoingUndefp =FALSE
int doing_undefp DoingUndefp =FALSE Int start_line LOCAL_StartLine =0L
Int start_line StartLine =0L scratch_block scratchpad LOCAL_ScratchPad InitScratchPad(wid)
scratch_block scratchpad ScratchPad InitScratchPad(wid)
#ifdef COROUTINING #ifdef COROUTINING
Term woken_goals WokenGoals =0L TermToGlobalAdjust Term woken_goals LOCAL_WokenGoals =0L TermToGlobalAdjust
Term atts_mutable_list AttsMutableList =0L TermToGlobalAdjust Term atts_mutable_list LOCAL_AttsMutableList =0L TermToGlobalAdjust
#endif #endif
// gc_stuff // gc_stuff
Term gc_generation GcGeneration =0L TermToGlobalAdjust Term gc_generation LOCAL_GcGeneration =0L TermToGlobalAdjust
Term gc_phase GcPhase =0L TermToGlobalAdjust Term gc_phase LOCAL_GcPhase =0L TermToGlobalAdjust
UInt gc_current_phase GcCurrentPhase =0L UInt gc_current_phase LOCAL_GcCurrentPhase =0L
UInt gc_calls GcCalls =0L UInt gc_calls LOCAL_GcCalls =0L
Int tot_gc_time TotGcTime =0L Int tot_gc_time LOCAL_TotGcTime =0L
YAP_ULONG_LONG tot_gc_recovered TotGcRecovered =0L YAP_ULONG_LONG tot_gc_recovered LOCAL_TotGcRecovered =0L
Int last_gc_time LastGcTime =0L Int last_gc_time LOCAL_LastGcTime =0L
Int last_ss_time LastSSTime =0L Int last_ss_time LOCAL_LastSSTime =0L
#if LOW_LEVEL_TRACER #if LOW_LEVEL_TRACER
Int total_cps Yap_total_choicepoints =0 Int total_cps LOCAL_total_choicepoints =0
#endif #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) #if defined(YAPOR) || defined(THREADS)
lockvar signal_lock SignalLock MkLock lockvar signal_lock LOCAL_SignalLock MkLock
struct pred_entry* wpp WPP =NULL #endif
/* in a single gc */ /* in a single gc */
Int tot_marked total_marked =0L Int tot_marked LOCAL_total_marked =0L
Int tot_oldies total_oldies =0L Int tot_oldies LOCAL_total_oldies =0L
#if DEBUG && COROUTINING struct choicept* wl_current_B LOCAL_current_B =NULL
UInt tot_smarked total_smarked =0L 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 #endif
struct choicept *wl_current_B current_B =NULL
CELL* wl_prev_HB prev_HB =NULL #if !defined(TABLING) && !defined(YAPOR_SBA) && (defined(YAPOR) || defined(THREADS))
CELL* hgen HGEN =NULL Term* wl_sTR LOCAL_sTR =NULL
CELL** ip_top iptop =NULL Term* wl_sTR0 LOCAL_sTR0 =NULL
#if GC_NO_TAGS Term* new_tr LOCAL_new_TR =NULL
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
#else #else
Term *wl_sTR sTR =NULL struct trail_frame* wl_sTR LOCAL_sTR =NULL
Term *wl_sTR0 sTR0 =NULL struct trail_frame* wl_sTR0 LOCAL_sTR0 =NULL
Term *new_tr new_TR =NULL struct trail_frame* new_tr LOCAL_new_TR =NULL
#endif #endif /* !TABLING && !YAPOR_SBA && (YAPOR || THREADS) */
struct gc_mark_continuation* conttop0 cont_top0 =NULL struct gc_mark_continuation* conttop0 LOCAL_cont_top0 =NULL
struct gc_mark_continuation* conttop cont_top =NULL struct gc_mark_continuation* conttop LOCAL_cont_top =NULL
int disc_trail_entries discard_trail_entries =0 int disc_trail_entries LOCAL_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_hash_table[GC_MAVARS_HASH_SIZE] LOCAL_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_top LOCAL_gc_ma_h_top =NULL
gc_ma_hash_entry* Gc_ma_h_list gc_ma_h_list =NULL gc_ma_hash_entry* Gc_ma_h_list LOCAL_gc_ma_h_list =NULL
UInt Gc_timestamp gc_timestamp =0L UInt Gc_timestamp LOCAL_gc_timestamp =0L
ADDR DB_vec db_vec =NULL ADDR DB_vec LOCAL_db_vec =NULL
ADDR DB_vec0 db_vec0 =NULL ADDR DB_vec0 LOCAL_db_vec0 =NULL
struct RB_red_blk_node* DB_root db_root =NULL struct RB_red_blk_node* DB_root LOCAL_db_root =NULL
struct RB_red_blk_node* DB_nil db_nil =NULL struct RB_red_blk_node* DB_nil LOCAL_db_nil =NULL
#endif /* defined(YAPOR) || defined(THREADS) */
sigjmp_buf gc_restore LOCAL_gc_restore void
sigjmp_buf gc_restore Yap_gc_restore void struct array_entry* dynamic_arrays LOCAL_DynamicArrays =NULL PtoArrayEAdjust
struct array_entry* dynamic_arrays DynamicArrays =NULL PtoArrayEAdjust struct static_array_entry* static_arrays LOCAL_StaticArrays =NULL PtoArraySAdjust
struct static_array_entry* static_arrays StaticArrays =NULL PtoArraySAdjust struct global_entry* global_variables LOCAL_GlobalVariables =NULL PtoGlobalEAdjust
struct global_entry* global_variables GlobalVariables =NULL PtoGlobalEAdjust int allow_restart LOCAL_AllowRestart =FALSE
int allow_restart Yap_AllowRestart =FALSE
// Thread Local Area for Fast Storage of Intermediate Compiled Code. // Thread Local Area for Fast Storage of Intermediate Compiled Code.
struct mem_blk* cmem_first_block Yap_CMemFirstBlock =NULL struct mem_blk* cmem_first_block LOCAL_CMemFirstBlock =NULL
UInt cmem_first_block_sz Yap_CMemFirstBlockSz =0L UInt cmem_first_block_sz LOCAL_CMemFirstBlockSz =0L
// Thread Local Area for Labels. // Thread Local Area for Labels.
Int* label_first_array Yap_LabelFirstArray =NULL Int* label_first_array LOCAL_LabelFirstArray =NULL
UInt label_first_array_sz Yap_LabelFirstArraySz =0L UInt label_first_array_sz LOCAL_LabelFirstArraySz =0L
// Thread Local Area for SWI-Prolog emulation routines. // Thread Local Area for SWI-Prolog emulation routines.
struct PL_local_data *Yap_ld_ PL_local_data_p =Yap_InitThreadIO(wid) struct PL_local_data* Yap_ld_ LOCAL_PL_local_data_p =Yap_InitThreadIO(wid)
struct open_query_struct* _execution execution =NULL
struct open_query_struct* _execution LOCAL_execution =NULL
#ifdef THREADS #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 FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle)
#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle) #define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle)
#endif #endif

View File

@ -126,6 +126,10 @@ fetch_name(Global) :-
fetch_name(Global) :- fetch_name(Global) :-
Global = "Yap_heap_regs->". Global = "Yap_heap_regs->".
fetch_name(Global,RField,_) :-
globals(worker_init), !,
append("FOREIGN(wid)->",RField,Global).
fetch_name(Global,_,Global).
% handle *field[4] % handle *field[4]
cut_c_stuff([0'*|Name], RName) :- !, % 'cut * cut_c_stuff([0'*|Name], RName) :- !, % 'cut *
@ -174,31 +178,31 @@ gen_hstruct(Inp,Out) :-
glue(Inp2, " ", Inp3), glue(Inp2, " ", Inp3),
gen_hstruct(Inp3,Out). gen_hstruct(Inp3,Out).
gen_hstruct(Inp,Out) :- gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkAT", _]), !, split(Inp," ",[_, Field, MacroName, "MkAT", _]), !,
fetch_name(Global), fetch_name(Global,Field,MacroName),
append([" ",Global,Field," = AtomTermAdjust(Yap_heap_regs->",Field,");"], Out). append([" ",Global," = AtomTermAdjust(",Global,");"], Out).
gen_hstruct(Inp,Out) :- gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkPred"| _]), !, split(Inp," ",[_, Field, MacroName, "MkPred"| _]), !,
cut_c_stuff(Field, RField), cut_c_stuff(Field, RField),
fetch_name(Global), fetch_name(Global,RField,MacroName),
append([" ",Global,RField," = PtoPredAdjust(Yap_heap_regs->",RField,");"], Out). append([" ",Global," = PtoPredAdjust(",Global,");"], Out).
gen_hstruct(Inp,Out) :- gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkOp", Name]), !, split(Inp," ",[_, Field, MacroName, "MkOp", Name]), !,
fetch_name(Global), fetch_name(Global,Field,MacroName),
append([" ",Global,Field," = Yap_opcode(",Name,");"], Out). append([" ",Global," = Yap_opcode(",Name,");"], Out).
gen_hstruct(Inp,Out) :- gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkLock"]), !, split(Inp," ",[_, Field, MacroName, "MkLock"]), !,
fetch_name(Global), fetch_name(Global,Field,MacroName),
append([" REINIT_LOCK(",Global,Field,");"], Out). append([" REINIT_LOCK(",Global,");"], Out).
gen_hstruct(Inp,Out) :- gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkRWLock"]), !, split(Inp," ",[_, Field, MacroName, "MkRWLock"]), !,
fetch_name(Global), fetch_name(Global,Field,MacroName),
append([" REINIT_RWLOCK(",Global,Field,");"], Out). append([" REINIT_RWLOCK(",Global,");"], Out).
gen_hstruct(Inp,Out) :- gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkInstE",OP]), !, split(Inp," ",[_, Field, MacroName, "MkInstE",OP]), !,
cut_c_stuff(Field, RField), cut_c_stuff(Field, RField),
fetch_name(Global), fetch_name(Global,RField,MacroName),
append([" ",Global,RField,"->opc = Yap_opcode(",OP,");"], Out). append([" ",Global,"->opc = Yap_opcode(",OP,");"], Out).
gen_hstruct(Inp,"") :- gen_hstruct(Inp,"") :-
split(Inp," ",[_, _, _, _]), !. split(Inp," ",[_, _, _, _]), !.
gen_hstruct(Inp,"") :- gen_hstruct(Inp,"") :-
@ -208,11 +212,11 @@ gen_hstruct(Inp,Restore) :-
append("Restore",_,Restore0), !, append("Restore",_,Restore0), !,
append([" ",Restore0,";"],Restore). %' append([" ",Restore0,";"],Restore). %'
gen_hstruct(Inp,Out) :- gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, _, _, Adjust]), split(Inp," ",[_, Field, MacroName, _, Adjust]),
append(Adjust,"Adjust",_), !, append(Adjust,"Adjust",_), !,
cut_c_stuff(Field, RField), cut_c_stuff(Field, RField),
fetch_name(Global), fetch_name(Global,RField,MacroName),
append([" ",Global,RField," = ",Adjust,"(",Global,RField,");"], Out). append([" ",Global," = ",Adjust,"(",Global,");"], Out).
gen_hstruct(Inp,_) :- gen_hstruct(Inp,_) :-
split(Inp," ",[_, _, _| _]), split(Inp," ",[_, _, _| _]),
format(user_error,"OOPS: could not gen_hstruct for ~s~n",[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("Yap_Init",_,Init0), !,
append([" ",Init0,";"],Init). append([" ",Init0,";"],Init).
gen_init(Inp,Out) :- gen_init(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkAT", AtomName]), !, split(Inp," ",[_, Field, MacroName, "MkAT", AtomName]), !,
cut_c_stuff(Field, RField), cut_c_stuff(Field, RField),
fetch_name(Global), fetch_name(Global,RField,MacroName),
append([" ",Global,RField," = MkAtomTerm(",AtomName,");"], Out). append([" ",Global," = MkAtomTerm(",AtomName,");"], Out).
gen_init(Inp,Out) :- gen_init(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkOp", Name]), !, split(Inp," ",[_, Field, MacroName, "MkOp", Name]), !,
fetch_name(Global), fetch_name(Global,Field,MacroName),
append([" ",Global,Field," = Yap_opcode(",Name,");"], Out). append([" ",Global," = Yap_opcode(",Name,");"], Out).
gen_init(Inp,Out) :- gen_init(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkLock"]), !, split(Inp," ",[_, Field, MacroName, "MkLock"]), !,
fetch_name(Global), fetch_name(Global,Field,MacroName),
append([" INIT_LOCK(",Global,Field,");"], Out). append([" INIT_LOCK(",Global,");"], Out).
gen_init(Inp,Out) :- gen_init(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkRWLock"]), !, split(Inp," ",[_, Field, MacroName, "MkRWLock"]), !,
fetch_name(Global), fetch_name(Global,Field,MacroName),
append([" INIT_RWLOCK(",Global,Field,");"], Out). append([" INIT_RWLOCK(",Global,");"], Out).
gen_init(Inp,Out) :- gen_init(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkInstE",OP]), !, split(Inp," ",[_, Field, MacroName, "MkInstE",OP]), !,
cut_c_stuff(Field, RField), cut_c_stuff(Field, RField),
fetch_name(Global), fetch_name(Global,RField,MacroName),
append([" ",Global,RField,"->opc = Yap_opcode(",OP,");"], Out). append([" ",Global,"->opc = Yap_opcode(",OP,");"], Out).
gen_init(Inp,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), cut_c_stuff(Field, RField),
fetch_name(Global), fetch_name(Global,RField,MacroName),
append([" ",Global,RField," = RepPredProp(PredPropByAtom(",Atom,",",Module,"));"], Out). append([" ",Global," = RepPredProp(PredPropByAtom(",Atom,",",Module,"));"], Out).
gen_init(Inp,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), cut_c_stuff(Field, RField),
fetch_name(Global), fetch_name(Global,RField,MacroName),
append([" ",Global,RField," = RepPredProp(PredPropByFunc(Yap_MkFunctor(",Atom,",",Arity,"),",Module,"));"], Out). append([" ",Global," = RepPredProp(PredPropByFunc(Yap_MkFunctor(",Atom,",",Arity,"),",Module,"));"], Out).
gen_init(Inp,Out) :- gen_init(Inp,Out) :-
split(Inp," ",[_, Field, _, "MkPred", Fun, Module]), !, split(Inp," ",[_, Field, MacroName, "MkPred", Fun, Module]), !,
cut_c_stuff(Field, RField), cut_c_stuff(Field, RField),
fetch_name(Global), fetch_name(Global,RField,MacroName),
append([" ",Global,RField," = RepPredProp(PredPropByFunc(",Fun,",",Module,"));"], Out). append([" ",Global," = RepPredProp(PredPropByFunc(",Fun,",",Module,"));"], Out).
gen_init(Inp,Out) :- gen_init(Inp,Out) :-
split(Inp," ",[_, Field, _, F0|_]), split(Inp," ",[_, Field, MacroName, F0|_]),
append("=",F,F0), !, append("=",F,F0), !,
cut_c_stuff(Field, RField), cut_c_stuff(Field, RField),
fetch_name(Global), fetch_name(Global,RField,MacroName),
append([" ",Global,RField," = ",F,";"], Out). append([" ",Global," = ",F,";"], Out).
gen_init(Inp,_) :- gen_init(Inp,_) :-
split(Inp," ",[_, _, _| _]), split(Inp," ",[_, _, _| _]),
format(user_error,"OOPS: could not gen_init for ~s~n",[Inp]). format(user_error,"OOPS: could not gen_init for ~s~n",[Inp]).

View File

@ -255,7 +255,7 @@ extern PL_local_data_t lds;
// THIS HAS TO BE ABSTRACTED // 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) #if !defined(O_PLMT) && !defined(YAPOR)
#define LOCAL_LD (GLOBAL_LD) #define LOCAL_LD (GLOBAL_LD)

View File

@ -1098,7 +1098,7 @@ pl_readline(term_t flag)
static Term static Term
StreamPosition(IOSTREAM *st) StreamPosition(IOSTREAM *st)
{ { GET_LD
Term t[4]; Term t[4];
if (!st) if (!st)
st = Suser_input; st = Suser_input;