reset excess change

This commit is contained in:
Vitor Santos Costa 2019-04-24 12:10:06 +01:00
parent a87654b0b0
commit b97338f84d
17 changed files with 337 additions and 385 deletions

1
.gitignore vendored
View File

@ -215,4 +215,3 @@ cmake/docs/Doxyfile
*.stackdump *.stackdump
*.gz *.gz
.Rproj.user

View File

@ -916,26 +916,24 @@ static int interrupt_dexecute(USES_REGS1) {
static void undef_goal(USES_REGS1) { static void undef_goal(USES_REGS1) {
PredEntry *pe = PredFromDefCode(P); PredEntry *pe = PredFromDefCode(P);
/* avoid trouble with undefined dynamic procedures */ BEGD(d0);
/* I assume they were not locked beforehand */ /* avoid trouble with undefined dynamic procedures */
#if defined(YAPOR) || defined(THREADS) /* I assume they were not locked beforehand */
#if defined(YAPOR) || defined(THREADS)
if (!PP) { if (!PP) {
PELOCK(19, pe); PELOCK(19, pe);
PP = pe; PP = pe;
} }
#endif #endif
BACKUP_MACHINE_REGS(); if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag) ) {
if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag) ) {
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
UNLOCKPE(19, PP); UNLOCKPE(19, PP);
PP = NULL; PP = NULL;
#endif #endif
CalculateStackGap(PASS_REGS1); CalculateStackGap(PASS_REGS1);
P = FAILCODE; P = FAILCODE;
RECOVER_MACHINE_REGS();
return; return;
} }
#if DEBUG
if (UndefCode == NULL || UndefCode->OpcodeOfPred == UNDEF_OPCODE) { if (UndefCode == NULL || UndefCode->OpcodeOfPred == UNDEF_OPCODE) {
fprintf(stderr,"call to undefined Predicates %s ->", IndicatorOfPred(pe)); fprintf(stderr,"call to undefined Predicates %s ->", IndicatorOfPred(pe));
Yap_DebugPlWriteln(ARG1); Yap_DebugPlWriteln(ARG1);
@ -948,28 +946,16 @@ if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag) ) {
#endif #endif
CalculateStackGap(PASS_REGS1); CalculateStackGap(PASS_REGS1);
P = FAILCODE; P = FAILCODE;
RECOVER_MACHINE_REGS();
return; return;
} }
#endif
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
UNLOCKPE(19, PP); UNLOCKPE(19, PP);
PP = NULL; PP = NULL;
#endif #endif
CELL o = AbsPair(HR);
if (pe->ModuleOfPred == PROLOG_MODULE) {
if (CurrentModule == PROLOG_MODULE)
HR[0] = TermProlog;
else
HR[0] = CurrentModule;
} else {
HR[0] = Yap_Module_Name(pe);
}
HR += 2;
if (pe->ArityOfPE == 0) { if (pe->ArityOfPE == 0) {
HR[-1] = MkAtomTerm((Atom)(pe->FunctorOfPred)); d0 = MkAtomTerm((Atom)(pe->FunctorOfPred));
} else { } else {
HR[-1] = AbsAppl(HR); d0 = AbsAppl(HR);
*HR++ = (CELL)pe->FunctorOfPred; *HR++ = (CELL)pe->FunctorOfPred;
CELL *ip=HR; CELL *ip=HR;
UInt imax = pe->ArityOfPE; UInt imax = pe->ArityOfPE;
@ -998,20 +984,30 @@ if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag) ) {
ENDD(d1); ENDD(d1);
} }
} }
ARG1 = o; ARG1 = AbsPair(HR);
ARG2 = MkVarTerm(); HR[1] = d0;
ENDD(d0);
if (pe->ModuleOfPred == PROLOG_MODULE) {
if (CurrentModule == PROLOG_MODULE)
HR[0] = TermProlog;
else
HR[0] = CurrentModule;
} else {
HR[0] = Yap_Module_Name(pe);
}
ARG2 = Yap_getUnknownModule(Yap_GetModuleEntry(HR[0]));
HR += 2;
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) if (Yap_do_low_level_trace)
low_level_trace(enter_pred, UndefCode, XREGS + 1); low_level_trace(enter_pred, UndefCode, XREGS + 1);
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
P = UndefCode->CodeOfPred; P = UndefCode->CodeOfPred;
RECOVER_MACHINE_REGS();
} }
static void spy_goal(USES_REGS1) { static void spy_goal(USES_REGS1) {
PredEntry *pe = PredFromDefCode(P); PredEntry *pe = PredFromDefCode(P);
BACKUP_MACHINE_REGS();
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
if (!PP) { if (!PP) {
PELOCK(14, pe); PELOCK(14, pe);
@ -1031,7 +1027,6 @@ static void spy_goal(USES_REGS1) {
PP = NULL; PP = NULL;
} }
#endif #endif
RECOVER_MACHINE_REGS();
return; return;
} }
} }
@ -1049,7 +1044,6 @@ static void spy_goal(USES_REGS1) {
} }
#endif #endif
Yap_NilError(CALL_COUNTER_UNDERFLOW_EVENT, ""); Yap_NilError(CALL_COUNTER_UNDERFLOW_EVENT, "");
RECOVER_MACHINE_REGS();
return; return;
} }
LOCAL_PredEntriesCounter--; LOCAL_PredEntriesCounter--;
@ -1061,7 +1055,6 @@ static void spy_goal(USES_REGS1) {
} }
#endif #endif
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT, ""); Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT, "");
RECOVER_MACHINE_REGS();
return; return;
} }
if ((pe->PredFlags & (CountPredFlag | ProfiledPredFlag | SpiedPredFlag)) == if ((pe->PredFlags & (CountPredFlag | ProfiledPredFlag | SpiedPredFlag)) ==
@ -1073,7 +1066,6 @@ static void spy_goal(USES_REGS1) {
} }
#endif #endif
P = pe->cs.p_code.TrueCodeOfPred; P = pe->cs.p_code.TrueCodeOfPred;
RECOVER_MACHINE_REGS();
return; return;
} }
} }
@ -1092,7 +1084,6 @@ static void spy_goal(USES_REGS1) {
PP = NULL; PP = NULL;
} }
#endif #endif
RECOVER_MACHINE_REGS();
return; return;
} }
} }
@ -1162,7 +1153,6 @@ static void spy_goal(USES_REGS1) {
low_level_trace(enter_pred, pt0, XREGS + 1); low_level_trace(enter_pred, pt0, XREGS + 1);
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
} }
RECOVER_MACHINE_REGS();
} }
Int Yap_absmi(int inp) { Int Yap_absmi(int inp) {
@ -1323,10 +1313,11 @@ Int Yap_absmi(int inp) {
#endif /* USE_THREADED_CODE */ #endif /* USE_THREADED_CODE */
#if PUSH_REGS #if PUSH_REGS
old_regs = Yap_regp; old_regs = &Yap_REGS;
/* done, let us now initialize this space */ /* done, let us now initialize this space */
init_absmi_regs(&absmi_regs); init_absmi_regs(&absmi_regs);
/* the registers are all set up, let's swap */ /* the registers are all set up, let's swap */
#ifdef THREADS #ifdef THREADS
pthread_setspecific(Yap_yaamregs_key, (const void *)&absmi_regs); pthread_setspecific(Yap_yaamregs_key, (const void *)&absmi_regs);

View File

@ -9,8 +9,8 @@
#endif /* INDENT_CODE */ #endif /* INDENT_CODE */
BOp(Ystop, l); BOp(Ystop, l);
//LOCAL_CBorder = 0; LOCAL_CBorder = 0;
//SET_ASP(YREG, E_CB * sizeof(CELL)); SET_ASP(YREG, E_CB * sizeof(CELL));
/* make sure ASP is initialized */ /* make sure ASP is initialized */
saveregs(); saveregs();
@ -20,13 +20,12 @@
#if BP_FREE #if BP_FREE
P1REG = PCBACKUP; P1REG = PCBACKUP;
#endif #endif
//LOCAL_CBorder = 0; LOCAL_CBorder = 0;
return 1; return 1;
ENDBOp(); ENDBOp();
BOp(Nstop, e); BOp(Nstop, e);
//B= B->cp_b; SET_ASP(YREG, E_CB * sizeof(CELL));
//SET_ASP(YREG, E_CB * sizeof(CELL));
saveregs(); saveregs();
#if PUSH_REGS #if PUSH_REGS
restore_absmi_regs(old_regs); restore_absmi_regs(old_regs);

View File

@ -421,25 +421,8 @@ X_API void *YAP_BlobOfTerm(Term t) {
if (IsVarTerm(t)) if (IsVarTerm(t))
return NULL; return NULL;
if (!IsBigIntTerm(t)) { if (!IsBigIntTerm(t))
if (IsAtomTerm(t)) {
AtomEntry *ae = RepAtom(AtomOfTerm(t));
StaticArrayEntry *pp;
READ_LOCK(ae->ARWLock);
pp = RepStaticArrayProp(ae->PropsOfAE);
while (!EndOfPAEntr(pp) && pp->KindOfPE != ArrayProperty)
pp = RepStaticArrayProp(pp->NextOfPE);
if (EndOfPAEntr(pp) || pp->ValueOfVE.ints == NULL) {
READ_UNLOCK(ae->ARWLock);
return NULL;
} else {
READ_UNLOCK(ae->ARWLock);
return pp->ValueOfVE.ints;
}
}
return NULL; return NULL;
}
src = (MP_INT *)(RepAppl(t) + 2); src = (MP_INT *)(RepAppl(t) + 2);
return (void *)(src + 1); return (void *)(src + 1);
} }
@ -994,10 +977,6 @@ static Int execute_cargs(PredEntry *pe, CPredicate exec_code USES_REGS) {
"YAP only supports SWI C-call with arity =< 10"); "YAP only supports SWI C-call with arity =< 10");
return false; return false;
} }
arity_t i;
for (i = 0; i < pe->ArityOfPE; i++) {
XREGS[i+1] = Yap_GetFromSlot(a1+i);
}
Yap_RecoverSlots(pe->ArityOfPE, a1); Yap_RecoverSlots(pe->ArityOfPE, a1);
return rc; return rc;
} }
@ -1759,35 +1738,35 @@ static int run_emulator(USES_REGS1) {
X_API bool YAP_EnterGoal(YAP_PredEntryPtr ape, CELL *ptr, YAP_dogoalinfo *dgi) { X_API bool YAP_EnterGoal(YAP_PredEntryPtr ape, CELL *ptr, YAP_dogoalinfo *dgi) {
CACHE_REGS CACHE_REGS
PredEntry *pe = ape; PredEntry *pe = ape;
bool out; bool out;
fprintf(stderr,"EnterGoal: H=%ld ENV=%ld B=%ld TR=%ld P=%p CP=%p, Slots=%ld\n",HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, // fprintf(stderr,"EnterGoal: H=%d ENV=%p B=%d TR=%d P=%p CP=%p
LOCAL_CurSlot); // Slots=%d\n",HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP,
// LOCAL_CurSlot);
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
LOCAL_ActiveError->errorNo = YAP_NO_ERROR; LOCAL_ActiveError->errorNo = YAP_NO_ERROR;
LOCAL_PrologMode = UserMode; LOCAL_PrologMode = UserMode;
dgi->p = P; dgi->p = P;
dgi->cp = CP; dgi->cp = CP;
dgi->b_top = LCL0 - (CELL *)B; dgi->b0 = LCL0 - (CELL *)B;
dgi->e = LCL0-ENV;
dgi->CurSlot = LOCAL_CurSlot; dgi->CurSlot = LOCAL_CurSlot;
// ensure our current ENV receives current P. // ensure our current ENV receives current P.
Yap_PrepGoal(pe->ArityOfPE, nullptr, dgi PASS_REGS); Yap_PrepGoal(pe->ArityOfPE, nullptr, B PASS_REGS);
P = pe->CodeOfPred; P = pe->CodeOfPred;
// __android_log_print(ANDROID_LOG_INFO, "YAP ", "ap=%p %ld %x %x args=%x,%x // __android_log_print(ANDROID_LOG_INFO, "YAP ", "ap=%p %d %x %x args=%x,%x
// slot=%ld", pe, pe->CodeOfPred->opc, FAILCODE, Deref(ARG1), Deref(ARG2), // slot=%d", pe, pe->CodeOfPred->opc, FAILCODE, Deref(ARG1), Deref(ARG2),
// LOCAL_CurSlot); // LOCAL_CurSlot);
dgi->b = LCL0 - (CELL *)B;
dgi->h = HR - H0; dgi->h = HR - H0;
dgi->tr = (CELL *)TR - LCL0; dgi->tr = (CELL *)TR - LCL0;
// HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P11= (LCL0 - (CELL*)B); // fprintf(stderr,"PrepGoal: H=%d ENV=%p B=%d TR=%d P=%p CP=%p Slots=%d\n",
out = Yap_exec_absmi(true, false); // HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, LOCAL_CurSlot);
// fprintf(stderr,"EnterGoal success=%ld: H=%ld ENV=%p B=%ld TR=%ld P=%p CP=%p out = Yap_exec_absmi(true, false);
// Slots=%ld\n", out,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, // fprintf(stderr,"EnterGoal success=%d: H=%d ENV=%p B=%d TR=%d P=%p CP=%p
// LOCAL_CurSlot); // Slots=%d\n", out,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP,
dgi->b_bottom = (LCL0 - (CELL*)B); // LOCAL_CurSlot);
dgi->e = LCL0 - (CELL *)ENV; dgi->b = LCL0 - (CELL *)B;
dgi->y = LCL0 - (CELL *)YENV;
if (out) { if (out) {
dgi->EndSlot = LOCAL_CurSlot; dgi->EndSlot = LOCAL_CurSlot;
Yap_StartSlots(); Yap_StartSlots();
@ -1805,8 +1784,8 @@ X_API bool YAP_RetryGoal(YAP_dogoalinfo *dgi) {
bool out; bool out;
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
myB = (choiceptr)(LCL0 - dgi->b_top); myB = (choiceptr)(LCL0 - dgi->b);
myB0 = (choiceptr)(LCL0 - dgi->b_bottom); myB0 = (choiceptr)(LCL0 - dgi->b0);
CP = myB->cp_cp; CP = myB->cp_cp;
/* sanity check */ /* sanity check */
if (B >= myB0) { if (B >= myB0) {
@ -1816,15 +1795,16 @@ X_API bool YAP_RetryGoal(YAP_dogoalinfo *dgi) {
// get rid of garbage choice-points // get rid of garbage choice-points
B = myB; B = myB;
} }
// fprintf(stderr,"RetryGoal: H=%ld ENV=%p B=%ld TR=%ld P=%p CP=%p Slots=%ld\n", // fprintf(stderr,"RetryGoal: H=%d ENV=%p B=%d TR=%d P=%p CP=%p Slots=%d\n",
// HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, LOCAL_CurSlot); // HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, LOCAL_CurSlot);
P = FAILCODE; P = FAILCODE;
/* make sure we didn't leave live slots when we backtrack */ /* make sure we didn't leave live slots when we backtrack */
ASP = (CELL *)B;
LOCAL_CurSlot = dgi->EndSlot; LOCAL_CurSlot = dgi->EndSlot;
out = Yap_exec_absmi(true, true ); out = Yap_exec_absmi(true, true );
if (out) { if (out) {
dgi->EndSlot = LOCAL_CurSlot; dgi->EndSlot = LOCAL_CurSlot;
dgi->b_bottom = LCL0-CellPtr(myB); dgi->b = LCL0 - (CELL *)B;
} else { } else {
LOCAL_CurSlot = LOCAL_CurSlot =
dgi->CurSlot; // ignore any slots created within the called goal dgi->CurSlot; // ignore any slots created within the called goal
@ -1837,12 +1817,12 @@ X_API bool YAP_LeaveGoal(bool successful, YAP_dogoalinfo *dgi) {
CACHE_REGS CACHE_REGS
choiceptr myB, handler; choiceptr myB, handler;
// fprintf(stderr,"LeaveGoal success=%ld: H=%d ENV=%p B=%ldd myB=%ldd TR=%ld // fprintf(stderr,"LeaveGoal success=%d: H=%d ENV=%p B=%ld myB=%ld TR=%d
// P=%p CP=%p Slots=%ld\n", // P=%p CP=%p Slots=%d\n",
// successful,HR-H0,LCL0-ENV,LCL0-(CELL*)B,dgi->b0,(CELL*)TR-LCL0, P, CP, // successful,HR-H0,LCL0-ENV,LCL0-(CELL*)B,dgi->b0,(CELL*)TR-LCL0, P, CP,
// LOCAL_CurSlot); // LOCAL_CurSlot);
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
myB = (choiceptr)(LCL0 - dgi->b_bottom); myB = (choiceptr)(LCL0 - dgi->b);
if (LOCAL_PrologMode & AsyncIntMode) { if (LOCAL_PrologMode & AsyncIntMode) {
Yap_signal(YAP_FAIL_SIGNAL); Yap_signal(YAP_FAIL_SIGNAL);
} }
@ -1868,39 +1848,25 @@ X_API bool YAP_LeaveGoal(bool successful, YAP_dogoalinfo *dgi) {
} }
P = dgi->p; P = dgi->p;
CP = dgi->cp; CP = dgi->cp;
ENV = LCL0-dgi->e;
YENV = LCL0-dgi->y;
/* ASP should be set to the top of the local stack when we
did the call */
SET_ASP(YENV, E_CB * sizeof(CELL));
B = (choiceptr)(LCL0-dgi->b_top)
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
fprintf(stderr,"LeftGoal success=%d: H=%ld ENV=%ld B=%ld TR=%ld P=%p CP=%p, Slots=%ld\n", successful,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, // fprintf(stderr,"LeftGoal success=%d: H=%d ENV=%p B=%d TR=%d P=%p CP=%p
CP, LOCAL_CurSlot); // Slots=%d\n", successful,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P,
// CP, LOCAL_CurSlot);
return TRUE; return TRUE;
} }
X_API Int YAP_RunGoal(Term t) { X_API Int YAP_RunGoal(Term t) {
CACHE_REGS CACHE_REGS
Term out; Term out;
YAP_dogoalinfo gi; yhandle_t cslot = LOCAL_CurSlot;
gi.p = P;
gi.cp = CP;
gi.b_top = LCL0-CellPtr(B);
gi.CurSlot = Yap_CurrentHandle();
gi.y = LCL0-YENV;
gi.e = LCL0-ENV;
yhandle_t cslot = LOCAL_CurSlot;
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
LOCAL_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
LOCAL_PrologMode = UserMode; LOCAL_PrologMode = UserMode;
out = Yap_RunTopGoal(t, &gi, true); out = Yap_RunTopGoal(t, true);
LOCAL_PrologMode = UserCCallMode; LOCAL_PrologMode = UserCCallMode;
// should we catch the exception or pass it through? // should we catch the exception or pass it through?
// We'll pass it through // We'll pass it through
SET_ASP(YENV, E_CB * sizeof(CELL));
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
LOCAL_CurSlot = cslot; LOCAL_CurSlot = cslot;
return out; return out;
@ -1976,17 +1942,17 @@ X_API CELL *YAP_HeapStoreOpaqueTerm(Term t) {
X_API Int YAP_RunGoalOnce(Term t) { X_API Int YAP_RunGoalOnce(Term t) {
CACHE_REGS CACHE_REGS
Term out; Term out;
YAP_dogoalinfo gi; yamop *old_CP = CP;
Int oldPrologMode = LOCAL_PrologMode; Int oldPrologMode = LOCAL_PrologMode;
yhandle_t CSlot;
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
Yap_push_state(&gi PASS_REGS); CSlot = Yap_StartSlots();
LOCAL_PrologMode = UserMode; LOCAL_PrologMode = UserMode;
// Yap_heap_regs->yap_do_low_level_trace=true; // Yap_heap_regs->yap_do_low_level_trace=true;
out = Yap_RunTopGoal(t, &gi, true); out = Yap_RunTopGoal(t, true);
LOCAL_PrologMode = oldPrologMode; LOCAL_PrologMode = oldPrologMode;
// Yap_CloseSlots(CSlot); // Yap_CloseSlots(CSlot);
Yap_pop_state(out, &gi PASS_REGS);
if (!(oldPrologMode & UserCCallMode)) { if (!(oldPrologMode & UserCCallMode)) {
/* called from top-level */ /* called from top-level */
LOCAL_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
@ -1996,6 +1962,38 @@ X_API Int YAP_RunGoalOnce(Term t) {
// should we catch the exception or pass it through? // should we catch the exception or pass it through?
// We'll pass it through // We'll pass it through
// Yap_RaiseException(); // Yap_RaiseException();
if (out) {
choiceptr cut_pt, ob;
ob = NULL;
cut_pt = B;
while (cut_pt->cp_ap != NOCODE) {
/* make sure we prune C-choicepoints */
if (POP_CHOICE_POINT(cut_pt->cp_b)) {
POP_EXECUTE();
}
ob = cut_pt;
cut_pt = cut_pt->cp_b;
}
#ifdef YAPOR
CUT_prune_to(cut_pt);
#endif
if (ob) {
B = ob;
Yap_TrimTrail();
}
B = cut_pt;
} else {
Yap_CloseSlots(CSlot);
}
ASP = B->cp_env;
ENV = (CELL *)ASP[E_E];
B = (choiceptr)ASP[E_CB];
#ifdef DEPTH_LIMITxs
DEPTH = ASP[E_DEPTH];
#endif
P = (yamop *)ASP[E_CP];
CP = old_CP;
LOCAL_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
return out; return out;
@ -2080,7 +2078,7 @@ X_API void YAP_PruneGoal(YAP_dogoalinfo *gi) {
CACHE_REGS CACHE_REGS
BACKUP_B(); BACKUP_B();
choiceptr myB = (choiceptr)(LCL0 - gi->b_top); choiceptr myB = (choiceptr)(LCL0 - gi->b);
while (B != myB) { while (B != myB) {
/* make sure we prune C-choicepoints */ /* make sure we prune C-choicepoints */
if (POP_CHOICE_POINT(B->cp_b)) { if (POP_CHOICE_POINT(B->cp_b)) {
@ -2137,7 +2135,7 @@ int lvl = push_text_stack();
sno = Yap_OpenStream(tat, "r", MkAtomTerm(Yap_LookupAtom(fname)), sno = Yap_OpenStream(tat, "r", MkAtomTerm(Yap_LookupAtom(fname)),
LOCAL_encoding); LOCAL_encoding);
__android_log_print( __android_log_print(
ANDROID_LOG_INFO, "YAPDroid", "OpenStream got %ld ",sno); ANDROID_LOG_INFO, "YAPDroid", "OpenStream got %d ",sno);
if (sno < 0 || !Yap_ChDir(dirname((char *)d))) { if (sno < 0 || !Yap_ChDir(dirname((char *)d))) {
*full = NULL; *full = NULL;
pop_text_stack(lvl); pop_text_stack(lvl);
@ -2179,7 +2177,7 @@ X_API void YAP_EndConsult(int sno, int *osnop, const char *full) {
if (osnop >= 0) if (osnop >= 0)
Yap_AddAlias(AtomLoopStream, *osnop); Yap_AddAlias(AtomLoopStream, *osnop);
Yap_end_consult(); Yap_end_consult();
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s:%s(%ld), %ld", __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s:%s(%d), %d",
CurrentModule == 0 CurrentModule == 0
? "prolog" ? "prolog"
: RepAtom(AtomOfTerm(CurrentModule))->StrOfAE, : RepAtom(AtomOfTerm(CurrentModule))->StrOfAE,
@ -2208,8 +2206,8 @@ X_API Term YAP_ReadFromStream(int sno) {
sigjmp_buf signew; sigjmp_buf signew;
if (sigsetjmp(signew, 0)) { if (sigsetjmp(signew, 0)) {
Yap_syntax_error(LOCAL_toktide, sno, "ReadFromStream"); Yap_syntax_error(LOCAL_toktide, sno, "ReadFromStream");
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
return 0; return 0;
} else { } else {
o = Yap_read_term(sno, TermNil, false); o = Yap_read_term(sno, TermNil, false);
} }

View File

@ -1,4 +1,4 @@
/************************************************************************ \ /************************************************************************\
* Cut & Commit Inst * Cut & Commit Inst
ructions * ructions *

157
C/exec.c
View File

@ -801,13 +801,14 @@ static Int execute_in_mod(USES_REGS1) { /* '$execute'(Goal) */
* *
* @method prune_inner_computation * @method prune_inner_computation
*/ */
static void prune_inner_computation(choiceptr parent, YAP_dogoalinfo *gi) { static void prune_inner_computation(choiceptr parent) {
/* code */ /* code */
choiceptr cut_pt; choiceptr cut_pt;
yamop *oP = P, *oCP = CP;
Int oENV = LCL0 - ENV;
cut_pt = B; cut_pt = B;
while (cut_pt && cut_pt->cp_b while (cut_pt && cut_pt->cp_b < parent) {
&& cut_pt->cp_ap != NOCODE &&
cut_pt->cp_b <= parent) {
cut_pt = cut_pt->cp_b; cut_pt = cut_pt->cp_b;
} }
if (!cut_pt) if (!cut_pt)
@ -818,9 +819,9 @@ static void prune_inner_computation(choiceptr parent, YAP_dogoalinfo *gi) {
B = cut_pt; B = cut_pt;
Yap_TrimTrail(); Yap_TrimTrail();
LOCAL_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
P = gi->p; P = oP;
CP = gi->cp; CP = oCP;
ENV = LCL0-gi->e; ENV = LCL0 - oENV;
B = parent; B = parent;
} }
@ -829,7 +830,7 @@ static void prune_inner_computation(choiceptr parent, YAP_dogoalinfo *gi) {
* after completing a computation. * after completing a computation.
* @method complete_inner_computation * @method complete_inner_computation
*/ */
static void complete_inner_computation(choiceptr old_B, YAP_dogoalinfo *gi) { static void complete_inner_computation(choiceptr old_B) {
choiceptr myB = B; choiceptr myB = B;
if (myB == NULL) { if (myB == NULL) {
return; return;
@ -847,30 +848,30 @@ static void complete_inner_computation(choiceptr old_B, YAP_dogoalinfo *gi) {
return; return;
} }
// restore environment at call... // restore environment at call...
CP = gi->cp; CP = myB->cp_cp;
P = gi->p; ENV = myB->cp_env;
ENV = LCL0-gi->e;
YENV = LCL0-gi->y;
} }
static Int Yap_ignore(Term t, bool fail USES_REGS) { static Int Yap_ignore(Term t, bool fail USES_REGS) {
YAP_dogoalinfo gi; yamop *oP = P, *oCP = CP;
Yap_push_state(&gi); Int oENV = LCL0 - ENV;
Int oYENV = LCL0 - YENV;
Int oB = LCL0 - (CELL *)B;
yap_error_descriptor_t *ctx = malloc(sizeof(yap_error_descriptor_t)); yap_error_descriptor_t *ctx = malloc(sizeof(yap_error_descriptor_t));
bool newxp = Yap_pushErrorContext(true, ctx); bool newxp = Yap_pushErrorContext(true, ctx);
bool rc = Yap_RunTopGoal(t, &gi, false); bool rc = Yap_RunTopGoal(t, false);
choiceptr B0 = (choiceptr)(LCL0-gi.b_top);
if (!rc) { if (!rc) {
complete_inner_computation(B0, &gi); complete_inner_computation((choiceptr)(LCL0 - oB));
// We'll pass it through // We'll pass it through
} else { } else {
prune_inner_computation(B0, &gi); prune_inner_computation((choiceptr)(LCL0 - oB));
} }
Yap_popErrorContext(newxp, true); Yap_popErrorContext(newxp, true);
P = gi.p; P = oP;
CP = gi.cp; CP = oCP;
//YENV? ENV = LCL0 - oENV;
YENV = LCL0 - oYENV;
B = (choiceptr)(LCL0 - oB);
return true; return true;
} }
@ -1000,39 +1001,30 @@ static bool watch_retry(Term d0 USES_REGS) {
static Int setup_call_catcher_cleanup(USES_REGS1) { static Int setup_call_catcher_cleanup(USES_REGS1) {
Term Setup = Deref(ARG1); Term Setup = Deref(ARG1);
YAP_dogoalinfo gi; choiceptr B0 = B;
gi.p = P; yamop *oP = P, *oCP = CP;
gi.cp = CP; Int oENV = LCL0 - ENV;
gi.b_top = LCL0-CellPtr(B); Int oYENV = LCL0 - YENV;
gi.CurSlot = Yap_CurrentHandle(); bool rc;
gi.y = LCL0-YENV;
gi.e = LCL0-ENV;
bool rc;
Yap_DisableInterrupts(worker_id); Yap_DisableInterrupts(worker_id);
rc = Yap_RunTopGoal(Setup, &gi, false); rc = Yap_RunTopGoal(Setup, false);
Yap_EnableInterrupts(worker_id); Yap_EnableInterrupts(worker_id);
if (Yap_RaiseException()) { if (Yap_RaiseException()) {
return false; return false;
} }
choiceptr B0=(choiceptr)(LCL0-gi.b_top);
if (!rc) { if (!rc) {
complete_inner_computation(B0, &gi); complete_inner_computation(B0);
// We'll pass it throughs // We'll pass it throughs
return false; return false;
} else { } else {
prune_inner_computation(B0, &gi); prune_inner_computation(B0);
} }
YENV = LCL0-gi.y; P = oP;
ENV = LCL0-gi.e; CP = oCP;
B = (choiceptr)(LCL0-gi.b_top); ENV = LCL0 - oENV;
SET_ASP(YENV, E_CB * sizeof(CELL)); YENV = LCL0 - oYENV;
#ifdef DEPTH_LIMIT
DEPTH = ENV[E_DEPTH];
#endif
P = gi.p;
CP = gi.cp;
return rc; return rc;
} }
@ -1606,7 +1598,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
ASP = (CELL *)PROTECT_FROZEN_B(B); ASP = (CELL *)PROTECT_FROZEN_B(B);
if (B == NULL || B->cp_b == NULL || if (B == NULL || B->cp_b == NULL ||
(CELL *)(B->cp_b) >= LCL0 - LOCAL_CBorder) { (CELL *)(B->cp_b) > LCL0 - LOCAL_CBorder) {
LOCAL_RestartEnv = sighold; LOCAL_RestartEnv = sighold;
LOCAL_CBorder = OldBorder; LOCAL_CBorder = OldBorder;
pop_text_stack(i + 1); pop_text_stack(i + 1);
@ -1617,8 +1609,8 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
} }
YENV = ASP; YENV = ASP;
YENV[E_CB] = Unsigned(B); YENV[E_CB] = Unsigned(B);
pop_text_stack(i + 1);
out = Yap_absmi(0); out = Yap_absmi(0);
/* make sure we don't leave a FAIL signal hanging around */ /* make sure we don't leave a FAIL signal hanging around */
Yap_get_signal(YAP_FAIL_SIGNAL); Yap_get_signal(YAP_FAIL_SIGNAL);
if (!Yap_has_a_signal()) if (!Yap_has_a_signal())
@ -1628,15 +1620,15 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
pop_text_stack(i + 1); pop_text_stack(i + 1);
return out; return out;
} }
void Yap_PrepGoal(arity_t arity, CELL *pt, YAP_dogoalinfo *gip USES_REGS) {
void Yap_PrepGoal(arity_t arity, CELL *pt, choiceptr saved_b USES_REGS) {
/* create an initial pseudo environment so that when garbage /* create an initial pseudo environment so that when garbage
collection is going up in the environment chain it doesn't ge t collection is going up in the environment chain it doesn't get
confused */ confused */
Yap_ResetException(worker_id); Yap_ResetException(worker_id);
// sl = Yap_InitSlot(t); // sl = Yap_InitSlot(t);
YENV = ASP; YENV = ASP;
YENV[E_CP] = (CELL)CP; YENV[E_CP] = (CELL)YESCODE;
YENV[E_CB] = (CELL)B; YENV[E_CB] = (CELL)B;
YENV[E_E] = (CELL)ENV; YENV[E_E] = (CELL)ENV;
#ifdef TABLING #ifdef TABLING
@ -1652,33 +1644,31 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
/* keep a place where you can inform you had an exception */ /* keep a place where you can inform you had an exception */
if (pt) { if (pt) {
int i; int i;
for (i = 0; i < 3; i++) { for (i = 0; i < arity; i++) {
XREGS[i + 1] = *pt++; XREGS[i + 1] = *pt++;
} }
} }
choiceptr oB = B;
B = (choiceptr)ASP; B = (choiceptr)ASP;
B--; B--;
B->cp_h = HR; B->cp_h = HR;
B->cp_tr = TR; B->cp_tr = TR;
B->cp_cp = YESCODE; B->cp_cp = CP;
B->cp_ap = NOCODE; B->cp_ap = NOCODE;
B->cp_env = ENV; B->cp_env = ENV;
B->cp_b = oB; B->cp_b = saved_b;
#ifdef DEPTH_LIMIT #ifdef DEPTH_LIMIT
B->cp_depth = DEPTH; B->cp_depth = DEPTH;
#endif /* DEPTH_LIMIT */ #endif /* DEPTH_LIMIT */
ASP = (CELL *)B; YENV = ASP = (CELL *)B;
ASP[E_CB] = (CELL)B; YENV[E_CB] = (CELL)B;
HB = HR; HB = HR;
CP = YESCODE; CP = YESCODE;
ASP -= EnvSizeInCells;
gip->b_bottom = LCL0-CellPtr(B);
} }
static bool do_goal(yamop *CodeAdr, int arity, CELL *pt, YAP_dogoalinfo *gi, bool top USES_REGS) { static bool do_goal(yamop *CodeAdr, int arity, CELL *pt, bool top USES_REGS) {
choiceptr saved_b = B;
bool out; bool out;
Yap_PrepGoal(arity, pt, gi PASS_REGS); Yap_PrepGoal(arity, pt, saved_b PASS_REGS);
// CACHE_A1(); // CACHE_A1();
P = (yamop *)CodeAdr; P = (yamop *)CodeAdr;
// S = CellPtr(RepPredProp( // S = CellPtr(RepPredProp(
@ -1750,21 +1740,18 @@ void Yap_fail_all(choiceptr bb USES_REGS) {
} }
bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) { bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
yamop *saved_p, *saved_cp;
yamop *CodeAdr; yamop *CodeAdr;
bool out; bool out;
YAP_dogoalinfo gi;
gi.p = P; saved_p = P;
gi.cp = CP; saved_cp = CP;
gi.b_top = LCL0-CellPtr(B);
gi.CurSlot = Yap_CurrentHandle();
gi.y = LCL0-YENV;
gi.e = LCL0-ENV;
LOCAL_PrologMode |= TopGoalMode; LOCAL_PrologMode |= TopGoalMode;
PELOCK(81, ppe); PELOCK(81, ppe);
CodeAdr = ppe->CodeOfPred; CodeAdr = ppe->CodeOfPred;
UNLOCK(ppe->PELock); UNLOCK(ppe->PELock);
out = do_goal(CodeAdr, ppe->ArityOfPE, pt, &gi, false PASS_REGS); out = do_goal(CodeAdr, ppe->ArityOfPE, pt, false PASS_REGS);
if (out) { if (out) {
choiceptr cut_B; choiceptr cut_B;
@ -1785,13 +1772,14 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
#endif #endif
} }
#endif /* TABLING */ #endif /* TABLING */
B = (choiceptr)(LCL0-gi.b_top); B = cut_B;
CP = gi.cp; CP = saved_cp;
P = gi.p; P = saved_p;
ASP = ENV;
#ifdef DEPTH_LIMIT #ifdef DEPTH_LIMIT
DEPTH = ENV[E_DEPTH]; DEPTH = ENV[E_DEPTH];
#endif #endif
ENV = LCL0-gi.e; ENV = (CELL *)(ENV[E_E]);
/* we have failed, and usually we would backtrack to this B, /* we have failed, and usually we would backtrack to this B,
trouble is, we may also have a delayed cut to do */ trouble is, we may also have a delayed cut to do */
if (B != NULL) if (B != NULL)
@ -1810,18 +1798,18 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
} }
return true; return true;
} else if (out == 0) { } else if (out == 0) {
P = gi.p; P = saved_p;
CP = gi.cp; CP = saved_cp;
HR = B->cp_h; HR = B->cp_h;
#ifdef DEPTH_LIMIT #ifdef DEPTH_LIMIT
DEPTH = B->cp_depth; DEPTH = B->cp_depth;
#endif #endif
/* YENV should be set to the current environment */
YENV = ENV = LCL0-gi.e;
/* ASP should be set to the top of the local stack when we /* ASP should be set to the top of the local stack when we
did the call */ did the call */
SET_ASP(YENV, E_CB * sizeof(CELL)); ASP = B->cp_env;
B =(choiceptr)(LCL0-gi.b_top); /* YENV should be set to the current environment */
YENV = ENV = (CELL *)((B->cp_env)[E_E]);
B = B->cp_b;
SET_BB(B); SET_BB(B);
HB = PROTECT_FROZEN_H(B); HB = PROTECT_FROZEN_H(B);
// should we catch the exception or pass it through? // should we catch the exception or pass it through?
@ -1896,7 +1884,7 @@ void Yap_trust_last(void) {
} }
} }
Term Yap_RunTopGoal(Term t, YAP_dogoalinfo *gip, bool handle_errors) { Term Yap_RunTopGoal(Term t, bool handle_errors) {
CACHE_REGS CACHE_REGS
yamop *CodeAdr; yamop *CodeAdr;
Prop pe; Prop pe;
@ -1905,7 +1893,7 @@ Term Yap_RunTopGoal(Term t, YAP_dogoalinfo *gip, bool handle_errors) {
UInt arity; UInt arity;
Term tmod = CurrentModule; Term tmod = CurrentModule;
Term goal_out = 0; Term goal_out = 0;
LOCAL_PrologMode |= TopGoalMode; LOCAL_PrologMode |= TopGoalMode;
t = Yap_YapStripModule(t, &tmod); t = Yap_YapStripModule(t, &tmod);
if (IsVarTerm(t)) { if (IsVarTerm(t)) {
@ -1975,7 +1963,7 @@ Term Yap_RunTopGoal(Term t, YAP_dogoalinfo *gip, bool handle_errors) {
"unable to boot because of too little Trail space"); "unable to boot because of too little Trail space");
} }
#endif #endif
goal_out = do_goal(CodeAdr, arity, pt, gip, handle_errors PASS_REGS); goal_out = do_goal(CodeAdr, arity, pt, handle_errors PASS_REGS);
return goal_out; return goal_out;
} }
@ -2141,13 +2129,11 @@ bool Yap_Reset(yap_reset_t mode, bool hard) {
Yap_ResetException(worker_id); Yap_ResetException(worker_id);
/* first, backtrack to the root */ /* first, backtrack to the root */
while (B->cp_b) { while (B) {
if (B->cp_ap == NOCODE)
break;
B = B->cp_b;
}
P = FAILCODE; P = FAILCODE;
Yap_exec_absmi(true, mode); Yap_exec_absmi(true, mode);
B = B->cp_b;
}
/* reinitialize the engine */ /* reinitialize the engine */
Yap_InitYaamRegs(worker_id, false); Yap_InitYaamRegs(worker_id, false);
GLOBAL_Initialised = true; GLOBAL_Initialised = true;
@ -2241,7 +2227,6 @@ static Int generate_pred_info(USES_REGS1) {
void Yap_InitYaamRegs(int myworker_id, bool full_reset) { void Yap_InitYaamRegs(int myworker_id, bool full_reset) {
Term h0var; Term h0var;
YAP_dogoalinfo gi;
// getchar(); // getchar();
#if PUSH_REGS #if PUSH_REGS
/* Guarantee that after a longjmp we go back to the original abstract /* Guarantee that after a longjmp we go back to the original abstract
@ -2313,7 +2298,7 @@ void Yap_InitYaamRegs(int myworker_id, bool full_reset) {
PREG_ADDR = NULL; PREG_ADDR = NULL;
#endif #endif
cut_c_initialize(myworker_id); cut_c_initialize(myworker_id);
Yap_PrepGoal(0, NULL, &gi PASS_REGS); Yap_PrepGoal(0, NULL, NULL PASS_REGS);
#ifdef FROZEN_STACKS #ifdef FROZEN_STACKS
H_FZ = HR; H_FZ = HR;
#ifdef YAPOR_SBA #ifdef YAPOR_SBA

View File

@ -470,6 +470,7 @@
LogUpdClause *lcl = PREG->y_u.OtILl.d; LogUpdClause *lcl = PREG->y_u.OtILl.d;
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]);
/* fprintf(stderr,"- %p/%p %d %d %p\n",PREG,ap,timestamp,ap->TimeStampOfPred,PREG->y_u.OtILl.d->ClCode);*/
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
if (PP != ap) { if (PP != ap) {
if (PP) UNLOCKPE(16,PP); if (PP) UNLOCKPE(16,PP);

View File

@ -1949,12 +1949,11 @@
Op(p_arg_vv, xxx); Op(p_arg_vv, xxx);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
CELL HRs[3]; HR[0] = XREG(PREG->y_u.xxx.x1);
HRs[0] = XREG(PREG->y_u.xxx.x1); HR[1] = XREG(PREG->y_u.xxx.x2);
HRs[1] = XREG(PREG->y_u.xxx.x2); RESET_VARIABLE(HR + 2);
HRs[2] = TermNil;
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HRs); RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HR);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);
@ -2045,14 +2044,15 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
Op(p_arg_cv, xxn); Op(p_arg_cv, xxn);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
CELL HRs[3]; CELL *Ho = HR;
Term t = MkIntegerTerm(PREG->y_u.xxn.c); Term t = MkIntegerTerm(PREG->y_u.xxn.c);
HRs[0] = t; HR[0] = t;
HRs[1] = XREG(PREG->y_u.xxn.xi); HR[1] = XREG(PREG->y_u.xxn.xi);
HRs[2] = TermFoundVar; RESET_VARIABLE(HR + 2);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HRs); RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HR);
} HR = Ho;
}
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);
d0 = PREG->y_u.xxn.c; d0 = PREG->y_u.xxn.c;
@ -2118,13 +2118,12 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
Op(p_arg_y_vv, yxx); Op(p_arg_y_vv, yxx);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
CELL HRs[3]; HR[0] = XREG(PREG->y_u.yxx.x1);
HR[1] = XREG(PREG->y_u.yxx.x2);
HRs[0] = XREG(PREG->y_u.yxx.x1); HR[2] = YREG[PREG->y_u.yxx.y];
HRs[1] = XREG(PREG->y_u.yxx.x2); RESET_VARIABLE(HR + 2);
HRs[2] = TermFoundVar; low_level_trace(enter_pred,
low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HR);
RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HRs);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);
@ -2216,13 +2215,15 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
Op(p_arg_y_cv, yxn); Op(p_arg_y_cv, yxn);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
CELL HRs[3]; CELL *Ho = HR;
Term t = MkIntegerTerm(PREG->y_u.yxn.c); Term t = MkIntegerTerm(PREG->y_u.yxn.c);
HRs[0] = t; HR[0] = t;
HRs[1] = XREG(PREG->y_u.yxn.xi); HR[1] = XREG(PREG->y_u.yxn.xi);
HRs[2] = TermNil; HR[2] = YREG[PREG->y_u.yxn.y];
RESET_VARIABLE(HR + 2);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HRs); RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HR);
HR = Ho;
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);
@ -2294,13 +2295,12 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
restart_func2s: restart_func2s:
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
CELL HRs[3]; RESET_VARIABLE(HR);
HRs[0] = TermNil; HR[1] = XREG(PREG->y_u.xxx.x1);
HRs[1] = XREG(PREG->y_u.xxx.x1); HR[2] = XREG(PREG->y_u.xxx.x2);
HRs[2] = XREG(PREG->y_u.xxx.x2);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
/* We have to build the structure */ /* We have to build the structure */
@ -2412,13 +2412,12 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
restart_func2s_cv: restart_func2s_cv:
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
CELL HRs[3]; RESET_VARIABLE(HR);
HRs[0] = TermNil; HR[1] = PREG->y_u.xxc.c;
HRs[1] = PREG->y_u.xxc.c; HR[2] = XREG(PREG->y_u.xxc.xi);
HRs[2] = XREG(PREG->y_u.xxc.xi);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);
@ -2518,14 +2517,16 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
Term ti; Term ti;
CELL HRs[3]; CELL *hi = HR;
HRs[0] = TermNil;
ti = MkIntegerTerm(PREG->y_u.xxn.c); ti = MkIntegerTerm(PREG->y_u.xxn.c);
HRs[1] = XREG(PREG->y_u.xxn.xi); RESET_VARIABLE(HR);
HRs[2] = ti; HR[1] = XREG(PREG->y_u.xxn.xi);
HR[2] = ti;
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
HR = hi;
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
/* We have to build the structure */ /* We have to build the structure */
@ -2610,13 +2611,12 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
restart_func2s_y: restart_func2s_y:
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
CELL HRs[3]; RESET_VARIABLE(HR);
HRs[0] = TermNil; HR[1] = XREG(PREG->y_u.yxx.x1);
HRs[1] = XREG(PREG->y_u.yxx.x1); HR[2] = XREG(PREG->y_u.yxx.x2);
HRs[2] = XREG(PREG->y_u.yxx.x2);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
/* We have to build the structure */ /* We have to build the structure */
@ -2735,13 +2735,12 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
restart_func2s_y_cv: restart_func2s_y_cv:
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
CELL HRs[3]; RESET_VARIABLE(HR);
HRs[0] = TermNil; HR[1] = PREG->y_u.yxc.c;
HRs[1] = PREG->y_u.yxc.c; HR[2] = XREG(PREG->y_u.yxc.xi);
HRs[2] = XREG(PREG->y_u.yxc.xi);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
/* We have to build the structure */ /* We have to build the structure */
@ -2847,15 +2846,16 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
Term ti; Term ti;
CELL HRs[3]; CELL *hi = HR;
ti = MkIntegerTerm((Int)(PREG->y_u.yxn.c)); ti = MkIntegerTerm((Int)(PREG->y_u.yxn.c));
HRs[0] = TermFoundVar; RESET_VARIABLE(HR);
HRs[1] = XREG(PREG->y_u.yxn.xi); HR[1] = XREG(PREG->y_u.yxn.xi);
HRs[2] = ti; HR[2] = ti;
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
HR = hi;
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
/* We have to build the structure */ /* We have to build the structure */
@ -2952,12 +2952,12 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
Op(p_func2f_xx, xxx); Op(p_func2f_xx, xxx);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
Term HRs[3]; HR[0] = XREG(PREG->y_u.xxx.x);
HRs[0] = XREG(PREG->y_u.xxx.x); RESET_VARIABLE(HR + 1);
HRs[1] = HRs[2] = TermFoundVar; RESET_VARIABLE(HR + 2);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);
@ -3000,12 +3000,12 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
Op(p_func2f_xy, xxy); Op(p_func2f_xy, xxy);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
Term HRs[3]; HR[0] = XREG(PREG->y_u.xxy.x);
HRs[0] = XREG(PREG->y_u.xxy.x); RESET_VARIABLE(HR + 1);
HRs[1] = HRs[2] = TermFoundVar; RESET_VARIABLE(HR + 2);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);
@ -3051,12 +3051,12 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
Op(p_func2f_yx, yxx); Op(p_func2f_yx, yxx);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
Term HRs[3]; HR[0] = XREG(PREG->y_u.yxx.x2);
HRs[0] = XREG(PREG->y_u.yxx.x2); RESET_VARIABLE(HR + 1);
HRs[1] = HRs[2] = TermFoundVar; RESET_VARIABLE(HR + 2);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);
@ -3102,12 +3102,12 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO );
Op(p_func2f_yy, yyx); Op(p_func2f_yy, yyx);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
CELL HRs[3]; HR[0] = XREG(PREG->y_u.yyx.x);
HRs[0] = XREG(PREG->y_u.yyx.x); RESET_VARIABLE(HR + 1);
HRs[1] = HRs[2] = TermFoundVar; RESET_VARIABLE(HR + 2);
low_level_trace(enter_pred, low_level_trace(enter_pred,
RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)),
HRs); HR);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);

View File

@ -151,9 +151,8 @@ clean_complex_tr(tr_fr_ptr TR0 USES_REGS) {
} }
#define expand_stack(S0,SP,SF,TYPE) \ #define expand_stack(S0,SP,SF,TYPE) \
{ size_t sz = SF-S0, used = SP-S0;\ { size_t sz = SF-S0, used = SP-S0; \
sz = 1024+sz; \ S0 = Realloc(S0, (1024+sz)*sizeof(TYPE) PASS_REGS); \
S0 = Realloc(S0, sz*sizeof(TYPE) PASS_REGS); \
SP = S0+used; SF = S0+sz; } SP = S0+used; SF = S0+sz; }
#define MIN_ARENA_SIZE (1048L) #define MIN_ARENA_SIZE (1048L)

View File

@ -1,3 +1,4 @@
# value of 3.4.0 or lower. # value of 3.4.0 or lower.
cmake_minimum_required(VERSION 3.4) cmake_minimum_required(VERSION 3.4)
@ -904,7 +905,11 @@ add_subDIRECTORY(packages/ProbLog)
endif() endif()
add_subDIRECTORY(packages/bee) if (WITH_MINISAT)
add_subDIRECTORY(packages/swi-minisat2)
endif()
if (WITH_CLPQR) if (WITH_CLPQR)

View File

@ -252,10 +252,10 @@ YAPStringTerm::YAPStringTerm(wchar_t *s, size_t len)
YAPApplTerm::YAPApplTerm(YAPFunctor f, YAPTerm ts[]) { YAPApplTerm::YAPApplTerm(YAPFunctor f, YAPTerm ts[]) {
BACKUP_H(); BACKUP_H();
arity_t arity = ArityOfFunctor(f.f); arity_t arity = ArityOfFunctor(f.f);
Term o = AbsAppl(HR); Term o = Yap_MkNewApplTerm(f.f, arity);
*HR++ = (CELL)f.f; Term *tt = RepAppl(o) + 1;
for (arity_t i = 0; i < arity; i++) for (arity_t i = 0; i < arity; i++)
*HR++ = ts[i].term(); tt[i] = ts[i].term();
mk(o); mk(o);
RECOVER_H(); RECOVER_H();
} }
@ -411,23 +411,6 @@ std::vector<Term> YAPPairTerm::listToArray() {
return o; return o;
} }
std::vector<YAPTerm> YAPPairTerm::listToVector() {
Term *tailp;
Term t1 = gt();
Int l = Yap_SkipList(&t1, &tailp);
if (l < 0) {
throw YAPError(SOURCE(), TYPE_ERROR_LIST, (t), nullptr);
}
std::vector<YAPTerm> o = *new std::vector<YAPTerm>(l);
int i = 0;
Term t = gt();
while (t != TermNil) {
o[i++] = YAPTerm(HeadOfTerm(t));
t = TailOfTerm(t);
}
return o;
}
YAP_tag_t YAPTerm::tag() { YAP_tag_t YAPTerm::tag() {
Term tt = gt(); Term tt = gt();
if (IsVarTerm(tt)) { if (IsVarTerm(tt)) {
@ -612,9 +595,43 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) {
#endif #endif
CACHE_REGS CACHE_REGS
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
bool rc = YAP_RunGoalOnce(t); Term *ts = nullptr;
q.CurSlot = Yap_StartSlots();
q.p = P;
q.cp = CP;
Term omod = CurrentModule;
PredEntry *ap = nullptr;
if (IsStringTerm(tmod))
tmod = MkAtomTerm(Yap_LookupAtom(StringOfTerm(tmod)));
ap = Yap_get_pred(t, tmod, "C++");
if (ap == nullptr ||
ap->OpcodeOfPred == UNDEF_OPCODE) {
ap = rewriteUndefEngineQuery(ap, t, tmod);
}
if (IsApplTerm(t))
ts = RepAppl(t) + 1;
else if (IsPairTerm(t))
ts = RepPair(t);
/* legal ap */
arity_t arity = ap->ArityOfPE;
for (arity_t i = 0; i < arity; i++) {
XREGS[i + 1] = ts[i];
}
ts = nullptr;
bool result;
// allow Prolog style exception handling
// don't forget, on success these guys may create slots
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
result = (bool)YAP_EnterGoal(ap, nullptr, &q);
// std::cerr << "mgoal " << YAPTerm(tmod).text() << ":" << YAPTerm(t).text() << "\n";
YAP_LeaveGoal(result && !release, &q);
CurrentModule = LOCAL_SourceModule = omod;
// PyEval_RestoreThread(_save);
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
return rc; return result;
} }
/** /**
* called when a query must be terminated and its state fully recovered, * called when a query must be terminated and its state fully recovered,
@ -631,51 +648,61 @@ Term YAPEngine::fun(Term t) {
CACHE_REGS CACHE_REGS
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
Term tmod = Yap_CurrentModule(), *ts = nullptr; Term tmod = Yap_CurrentModule(), *ts = nullptr;
PredEntry *ap;
arity_t arity; arity_t arity;
Functor f; Functor f;
Atom name; Atom name;
yhandle_t yt = Yap_NewHandles(1);
if (IsApplTerm(t)) { if (IsApplTerm(t)) {
ts = RepAppl(t) + 1; ts = RepAppl(t) + 1;
f = (Functor)ts[-1]; f = (Functor)ts[-1];
name = NameOfFunctor(f); name = NameOfFunctor(f);
arity = ArityOfFunctor(f); arity = ArityOfFunctor(f);
t = AbsAppl(HR); for (arity_t i = 0; i < arity; i++)
HR[0] = (CELL)Yap_MkFunctor(name, arity+1); XREGS[i + 1] = ts[i];
for (arity_t i = 0; i < arity; i++) {
HR[i + 1] = ts[i];
}
HR += (arity+2);
arity++;
} else if (IsAtomTerm(t)) { } else if (IsAtomTerm(t)) {
name = AtomOfTerm(t); name = AtomOfTerm(t);
t = AbsAppl(HR); f = nullptr;
HR[0] = (CELL)Yap_MkFunctor(name, 1); arity = 0;
HR += 2;
arity = 1;
} else if (IsPairTerm(t)) { } else if (IsPairTerm(t)) {
HR[0] = (CELL)Yap_MkFunctor(AtomDot, 3); XREGS[1] = ts[0];
HR[1] = ts[0]; XREGS[2] = ts[1];
HR[2] = ts[1]; arity = 2;
HR += 4; name = AtomDot;
arity = 3; f = FunctorDot;
} else { } else {
throw YAPError(SOURCE(), TYPE_ERROR_CALLABLE, t, 0); throw YAPError(SOURCE(), TYPE_ERROR_CALLABLE, t, 0);
return 0L; return 0L;
} }
RESET_VARIABLE(HR-1); Term ot = XREGS[arity + 1] = MkVarTerm();
yt = Yap_InitHandle(t); yhandle_t h = Yap_InitHandle(ot);
CACHE_REGS arity++;
BACKUP_MACHINE_REGS(); HR += arity;
bool rc = YAP_RunGoalOnce(t); f = Yap_MkFunctor(name, arity);
Term ot; ap = (PredEntry *)(PredPropByFunc(f, tmod));
if (rc) if (ap == nullptr || ap->OpcodeOfPred == UNDEF_OPCODE) {
ot = ArgOfTerm(arity,Yap_GetFromHandle(yt)); Term g = (Yap_MkApplTerm(f, arity, ts));
else ap = rewriteUndefEngineQuery(ap, g, (ap->ModuleOfPred));
ot = TermNone; }
RECOVER_MACHINE_REGS(); q.CurSlot = Yap_StartSlots();
return ot; q.p = P;
q.cp = CP;
// make sure this is safe
// allow Prolog style exception handling
//__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec ");
bool result = (bool)YAP_EnterGoal(ap, nullptr, &q);
if (result)
ot = Yap_GetFromHandle(h);
else
ot = TermNone;
YAPCatchError();
{
YAP_LeaveGoal(result, &q);
// PyEval_RestoreThread(_save);
RECOVER_MACHINE_REGS();
return ot;
}
} }
YAPQuery::YAPQuery(YAPFunctor f, YAPTerm mod, YAPTerm ts[]) YAPQuery::YAPQuery(YAPFunctor f, YAPTerm mod, YAPTerm ts[])
@ -700,27 +727,6 @@ YAPQuery::YAPQuery(YAPFunctor f, YAPTerm mod, YAPTerm ts[])
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
} }
YAPQuery::YAPQuery(YAPFunctor f, YAPTerm mod, Term ts[])
: YAPPredicate(f, mod) {
/* ignore flags for now */
BACKUP_MACHINE_REGS();
Term goal;
if (ts) {
size_t arity = f.arity();
goal = Yap_MkApplTerm(Yap_MkFunctor(f.name().asAtom(),arity), arity, ts);
nts = RepAppl(goal) + 1;
for (arity_t i = 0; i < arity; i++)
XREGS[i + 1] = ts[i];
} else {
goal = MkVarTerm();
}
openQuery();
names = YAPPairTerm(TermNil);
RECOVER_MACHINE_REGS();
}
#if 0 #if 0
YAPQuery::YAPQuery(YAPFunctor f, YAPTerm ts[]) : YAPPredicate(f) { YAPQuery::YAPQuery(YAPFunctor f, YAPTerm ts[]) : YAPPredicate(f) {
/* ignore flags for now */ /* ignore flags for now */
@ -821,7 +827,7 @@ bool YAPQuery::deterministic() {
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
if (!q_open || q_state == 0) if (!q_open || q_state == 0)
return false; return false;
choiceptr myB = (choiceptr)(LCL0 - q_h.b_top); choiceptr myB = (choiceptr)(LCL0 - q_h.b);
return (B >= myB); return (B >= myB);
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
} }

View File

@ -304,35 +304,4 @@ static inline Term Yap_PopHandle__(yhandle_t topHandle USES_REGS) {
return Deref(LOCAL_HandleBase[topHandle]); return Deref(LOCAL_HandleBase[topHandle]);
} }
} }
INLINE_ONLY void Yap_push_state(YAP_dogoalinfo *gi USES_REGS);
INLINE_ONLY void Yap_push_state(YAP_dogoalinfo *gi USES_REGS)
{
gi->p = P;
gi->cp = CP;
gi->b_top = LCL0-CellPtr(B);
gi->CurSlot = Yap_CurrentHandle();
gi->y = LCL0-YENV;
gi->e = LCL0-ENV;
gi->a = LCL0-ASP;
}
INLINE_ONLY void Yap_pop_state(bool out, YAP_dogoalinfo *gi USES_REGS);
INLINE_ONLY void Yap_pop_state(bool out, YAP_dogoalinfo *gi USES_REGS)
{
B = (choiceptr)(LCL0-gi->b_top);
YENV = LCL0-gi->y;
ENV = LCL0-gi->e;
if (out) {
Yap_TrimTrail();
}
ASP = LCL0-gi->a;
Yap_CloseHandles(gi->CurSlot);
SET_ASP(YENV, E_CB * sizeof(CELL));
#ifdef DEPTH_LIMIT
DEPTH = ENV[E_DEPTH];
#endif
}
#endif #endif

View File

@ -203,12 +203,12 @@ extern void Yap_fail_all(choiceptr bb USES_REGS);
extern Term Yap_ExecuteCallMetaCall(Term,Term); extern Term Yap_ExecuteCallMetaCall(Term,Term);
extern void Yap_InitExecFs(void); extern void Yap_InitExecFs(void);
extern bool Yap_JumpToEnv(void); extern bool Yap_JumpToEnv(void);
extern Term Yap_RunTopGoal(Term, YAP_dogoalinfo *gip,bool); extern Term Yap_RunTopGoal(Term, bool);
extern bool Yap_execute_goal(Term, int, Term, bool); extern bool Yap_execute_goal(Term, int, Term, bool);
extern bool Yap_exec_absmi(bool, yap_reset_t); extern bool Yap_exec_absmi(bool, yap_reset_t);
extern void Yap_trust_last(void); extern void Yap_trust_last(void);
extern void Yap_closeGoal(bool out, yamop *saved_p, yamop * saved_cp, Int saved_e, Int saved_b, yhandle_t hdl, bool pass_ex); extern void Yap_closeGoal(bool out, yamop *saved_p, yamop * saved_cp, Int saved_e, Int saved_b, yhandle_t hdl, bool pass_ex);
extern void Yap_PrepGoal(arity_t arity, CELL *pt, YAP_dogoalinfo *gip USES_REGS); extern void Yap_PrepGoal(UInt, CELL *, choiceptr USES_REGS);
extern bool Yap_execute_pred(struct pred_entry *ppe, CELL *pt, extern bool Yap_execute_pred(struct pred_entry *ppe, CELL *pt,
bool pass_exception USES_REGS); bool pass_exception USES_REGS);
extern int Yap_dogc(int extra_args, Term *tp USES_REGS); extern int Yap_dogc(int extra_args, Term *tp USES_REGS);

View File

@ -34,7 +34,7 @@
#define HENVYOP(N, NAME, op, NEXTNAME, PFAIL) DEF NAME Yap_heap_regs->NAME##_ #define HENVYOP(N, NAME, op, NEXTNAME, PFAIL) DEF NAME Yap_heap_regs->NAME##_
#define HCPYOP(N, NAME, OP, FAILP) DEF NAME Yap_heap_regs->NAME##_ #define HCPYOP(N, NAME, OP, FAILP) DEF NAME Yap_heap_regs->NAME##_
#include "YapHeap.h" #include "heap.h"
#undef HM #undef HM
#undef HSPACE #undef HSPACE
@ -72,7 +72,7 @@
DEF GLOBAL_##NAME Yap_heap_regs->NAME##_ DEF GLOBAL_##NAME Yap_heap_regs->NAME##_
#define HCPYOP(N, NAME, OP, FAILP) DEF GLOBAL_##NAME Yap_heap_regs->NAME##_ #define HCPYOP(N, NAME, OP, FAILP) DEF GLOBAL_##NAME Yap_heap_regs->NAME##_
#include "YapHeap.h" #include "heap.h"
#undef LOC #undef LOC
#undef LOCL #undef LOCL

View File

@ -3,7 +3,7 @@
// Macro support // Macro support
#ifndef LOCAL #ifndef LOCAL
#include "Yap.h" #include "Yap.h"
#include "YapHeap.h" #include "heap.h"
#define LOCAL(A, B) A B #define LOCAL(A, B) A B
#define LOCAL_INIT(A, B, C) \ #define LOCAL_INIT(A, B, C) \
A B; \ A B; \

View File

@ -137,8 +137,8 @@ typedef enum {
#include "YapInit.h" #include "YapInit.h"
/* this should be opaque to the user */ /* this should be opaque to the user */
typedef struct goal_info { typedef struct {
unsigned long b_top, b_bottom, m, e, y, a; //> choice-point at entry unsigned long b, b0; //> choice-point at entry
YAP_handle_t CurSlot; //> variables at entry YAP_handle_t CurSlot; //> variables at entry
YAP_handle_t EndSlot; //> variables at successful execution YAP_handle_t EndSlot; //> variables at successful execution
struct yami *p; //> Program Counter at entry struct yami *p; //> Program Counter at entry

View File

@ -267,7 +267,7 @@ initialize_prolog :-
:- c_compile( 'protect.yap' ). :- c_compile( 'protect.yap' ).
:- ['absf.yap']. :- ['absf.yap'].
%:- ..............................lp------------------------------------------------------------------. %:- stop_low_level_trace.
:- use_module('error.yap'). :- use_module('error.yap').
:- [ :- [