This commit is contained in:
Vitor Santos Costa 2019-04-12 10:48:01 +01:00
parent e7a2195af6
commit 8070e65354
9 changed files with 107 additions and 78 deletions

View File

@ -25,6 +25,7 @@
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

View File

@ -1755,7 +1755,7 @@ 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=%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,
LOCAL_CurSlot); LOCAL_CurSlot);
@ -1764,7 +1764,7 @@ X_API bool YAP_EnterGoal(YAP_PredEntryPtr ape, CELL *ptr, YAP_dogoalinfo *dgi) {
LOCAL_PrologMode = UserMode; LOCAL_PrologMode = UserMode;
dgi->p = P; dgi->p = P;
dgi->cp = CP; dgi->cp = CP;
dgi->b0 = LCL0 - (CELL *)B; dgi->b_top = LCL0 - (CELL *)B;
dgi->e = LCL0-ENV; 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.
@ -1774,17 +1774,15 @@ X_API bool YAP_EnterGoal(YAP_PredEntryPtr ape, CELL *ptr, YAP_dogoalinfo *dgi) {
// __android_log_print(ANDROID_LOG_INFO, "YAP ", "ap=%p %ld %x %x args=%x,%x // __android_log_print(ANDROID_LOG_INFO, "YAP ", "ap=%p %ld %x %x args=%x,%x
// slot=%ld", pe, pe->CodeOfPred->opc, FAILCODE, Deref(ARG1), Deref(ARG2), // slot=%ld", 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;
// fprintf(stderr,"PrepGoal: H=%ld ENV=%p B=%ld TR=%ld P=%p CP=%p Slots=%ld\n", // HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P11= (LCL0 - (CELL*)B);
// HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, LOCAL_CurSlot); out = Yap_exec_absmi(true, false);
out = Yap_exec_absmi(true, false); // fprintf(stderr,"EnterGoal success=%ld: H=%ld ENV=%p B=%ld TR=%ld P=%p CP=%p
// fprintf(stderr,"EnterGoal success=%ld: H=%ld ENV=%p B=%ld TR=%ld P=%p CP=%p // Slots=%ld\n", out,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP,
// Slots=%ld\n", out,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, // LOCAL_CurSlot);
// LOCAL_CurSlot); dgi->b_bottom = (LCL0 - (CELL*)B);
dgi->b = (LCL0 - (CELL*)B); dgi->e = LCL0 - (CELL *)ENV;
dgi->e = LCL0 - (CELL *)B;
dgi->a = LCL0 - (CELL *)ASP; dgi->a = LCL0 - (CELL *)ASP;
if (out) { if (out) {
dgi->EndSlot = LOCAL_CurSlot; dgi->EndSlot = LOCAL_CurSlot;
@ -1803,8 +1801,8 @@ X_API bool YAP_RetryGoal(YAP_dogoalinfo *dgi) {
bool out; bool out;
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
myB = (choiceptr)(LCL0 - dgi->b); myB = (choiceptr)(LCL0 - dgi->b_top);
myB0 = (choiceptr)(LCL0 - dgi->b0); myB0 = (choiceptr)(LCL0 - dgi->b_bottom);
CP = myB->cp_cp; CP = myB->cp_cp;
/* sanity check */ /* sanity check */
if (B >= myB0) { if (B >= myB0) {
@ -1822,7 +1820,7 @@ X_API bool YAP_RetryGoal(YAP_dogoalinfo *dgi) {
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 = LCL0-CellPtr(myB); dgi->b_bottom = LCL0-CellPtr(myB);
} 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
@ -1840,7 +1838,7 @@ X_API bool YAP_LeaveGoal(bool successful, YAP_dogoalinfo *dgi) {
// 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); myB = (choiceptr)(LCL0 - dgi->b_bottom);
if (LOCAL_PrologMode & AsyncIntMode) { if (LOCAL_PrologMode & AsyncIntMode) {
Yap_signal(YAP_FAIL_SIGNAL); Yap_signal(YAP_FAIL_SIGNAL);
} }
@ -1868,7 +1866,7 @@ X_API bool YAP_LeaveGoal(bool successful, YAP_dogoalinfo *dgi) {
CP = dgi->cp; CP = dgi->cp;
ENV = LCL0-dgi->e; ENV = LCL0-dgi->e;
ASP = LCL0-dgi->a; ASP = LCL0-dgi->a;
B = (choiceptr)(LCL0-dgi->b) 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=%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,
CP, LOCAL_CurSlot); CP, LOCAL_CurSlot);
@ -1878,12 +1876,19 @@ X_API bool YAP_LeaveGoal(bool successful, YAP_dogoalinfo *dgi) {
X_API Int YAP_RunGoal(Term t) { X_API Int YAP_RunGoal(Term t) {
CACHE_REGS CACHE_REGS
Term out; Term out;
yhandle_t cslot = LOCAL_CurSlot; YAP_dogoalinfo gi;
gi.p = P;
gi.cp = CP;
gi.b_top = LCL0-CellPtr(B);
gi.CurSlot = Yap_CurrentHandle();
gi.a = LCL0-ASP;
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, true); out = Yap_RunTopGoal(t, &gi, 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
@ -1962,15 +1967,21 @@ 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;
yamop *old_CP = CP; YAP_dogoalinfo gi;
Int oldPrologMode = LOCAL_PrologMode; gi.p = P;
gi.cp = CP;
gi.b_top = LCL0-CellPtr(B);
gi.CurSlot = Yap_CurrentHandle();
gi.a = LCL0-ASP;
gi.e = LCL0-ENV;
Int oldPrologMode = LOCAL_PrologMode;
yhandle_t CSlot; yhandle_t CSlot;
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
CSlot = Yap_StartSlots(); 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, true); out = Yap_RunTopGoal(t, &gi, true);
LOCAL_PrologMode = oldPrologMode; LOCAL_PrologMode = oldPrologMode;
// Yap_CloseSlots(CSlot); // Yap_CloseSlots(CSlot);
if (!(oldPrologMode & UserCCallMode)) { if (!(oldPrologMode & UserCCallMode)) {
@ -2006,14 +2017,14 @@ X_API Int YAP_RunGoalOnce(Term t) {
} else { } else {
Yap_CloseSlots(CSlot); Yap_CloseSlots(CSlot);
} }
ASP = B->cp_env; ASP = LCL0-gi.a;
ENV = (CELL *)ASP[E_E]; ENV = LCL0-gi.e;
B = (choiceptr)ASP[E_CB]; B = (choiceptr)(LCL0-gi.b_top);
#ifdef DEPTH_LIMITxs #ifdef DEPTH_LIMIT
DEPTH = ASP[E_DEPTH]; DEPTH = ASP[E_DEPTH];
#endif #endif
P = (yamop *)ASP[E_CP]; P = gi.p;
CP = old_CP; CP = gi.cp;
LOCAL_AllowRestart = FALSE; LOCAL_AllowRestart = FALSE;
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
return out; return out;
@ -2098,7 +2109,7 @@ X_API void YAP_PruneGoal(YAP_dogoalinfo *gi) {
CACHE_REGS CACHE_REGS
BACKUP_B(); BACKUP_B();
choiceptr myB = (choiceptr)(LCL0 - gi->b); choiceptr myB = (choiceptr)(LCL0 - gi->b_top);
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)) {

104
C/exec.c
View File

@ -808,7 +808,7 @@ static void prune_inner_computation(choiceptr parent) {
Int oENV = LCL0 - ENV; Int oENV = LCL0 - ENV;
cut_pt = B; cut_pt = B;
while (cut_pt && cut_pt->cp_b < parent) { while (cut_pt && cut_pt->cp_b < parent && cut_pt->cp_b->cp_ap != NOCODE) {
cut_pt = cut_pt->cp_b; cut_pt = cut_pt->cp_b;
} }
if (!cut_pt) if (!cut_pt)
@ -853,25 +853,34 @@ static void complete_inner_computation(choiceptr old_B) {
} }
static Int Yap_ignore(Term t, bool fail USES_REGS) { static Int Yap_ignore(Term t, bool fail USES_REGS) {
yamop *oP = P, *oCP = CP; YAP_dogoalinfo gi;
Int oENV = LCL0 - ENV; gi.p = P;
Int oYENV = LCL0 - YENV; gi.cp = CP;
Int oB = LCL0 - (CELL *)B; gi.b_top = LCL0-CellPtr(B);
gi.CurSlot = Yap_CurrentHandle();
gi.a = LCL0-ASP;
gi.e = LCL0-ENV;
// gi. = LCL0-YENV;
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, false); bool rc = Yap_RunTopGoal(t, &gi, false);
choiceptr B0 = (choiceptr)(LCL0-gi.b_top);
if (!rc) { if (!rc) {
complete_inner_computation((choiceptr)(LCL0 - oB)); complete_inner_computation(B0);
// We'll pass it through // We'll pass it through
} else { } else {
prune_inner_computation((choiceptr)(LCL0 - oB)); prune_inner_computation(B0);
} }
Yap_popErrorContext(newxp, true); Yap_popErrorContext(newxp, true);
P = oP; ASP = LCL0-gi.a;
CP = oCP; ENV = LCL0-gi.e;
ENV = LCL0 - oENV; B = (choiceptr)(LCL0-gi.b_top);
YENV = LCL0 - oYENV; #ifdef DEPTH_LIMIT
B = (choiceptr)(LCL0 - oB); DEPTH = ASP[E_DEPTH];
#endif
P = gi.p;
CP = gi.cp;
//YENV?
return true; return true;
} }
@ -1001,18 +1010,22 @@ 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);
choiceptr B0 = B; YAP_dogoalinfo gi;
yamop *oP = P, *oCP = CP; gi.p = P;
Int oENV = LCL0 - ENV; gi.cp = CP;
Int oYENV = LCL0 - YENV; gi.b_top = LCL0-CellPtr(B);
bool rc; gi.CurSlot = Yap_CurrentHandle();
gi.a = LCL0-ASP;
gi.e = LCL0-ENV;
bool rc;
Yap_DisableInterrupts(worker_id); Yap_DisableInterrupts(worker_id);
rc = Yap_RunTopGoal(Setup, false); rc = Yap_RunTopGoal(Setup, &gi, 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); complete_inner_computation(B0);
// We'll pass it throughs // We'll pass it throughs
@ -1021,11 +1034,15 @@ static Int setup_call_catcher_cleanup(USES_REGS1) {
} else { } else {
prune_inner_computation(B0); prune_inner_computation(B0);
} }
P = oP; ASP = LCL0-gi.a;
CP = oCP; ENV = LCL0-gi.e;
ENV = LCL0 - oENV; B = (choiceptr)(LCL0-gi.b_top);
YENV = LCL0 - oYENV; #ifdef DEPTH_LIMIT
return rc; DEPTH = ASP[E_DEPTH];
#endif
P = gi.p;
CP = gi.cp;
return rc;
} }
static Int tag_cleanup(USES_REGS1) { static Int tag_cleanup(USES_REGS1) {
@ -1628,7 +1645,7 @@ void Yap_PrepGoal(arity_t arity, CELL *pt, YAP_dogoalinfo *gip USES_REGS) {
Yap_ResetException(worker_id); Yap_ResetException(worker_id);
// sl = Yap_InitSlot(t); // sl = Yap_InitSlot(t);
YENV = ASP; YENV = ASP;
YENV[E_CP] = (CELL)YESCODE; YENV[E_CP] = (CELL)CP;
YENV[E_CB] = (CELL)B; YENV[E_CB] = (CELL)B;
YENV[E_E] = (CELL)ENV; YENV[E_E] = (CELL)ENV;
#ifdef TABLING #ifdef TABLING
@ -1648,20 +1665,24 @@ void Yap_PrepGoal(arity_t arity, CELL *pt, YAP_dogoalinfo *gip USES_REGS) {
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 = CP; B->cp_cp = YESCODE;
B->cp_ap = NOCODE; B->cp_ap = NOCODE;
B->cp_env = ENV; B->cp_env = ENV;
B->cp_b = oB;
#ifdef DEPTH_LIMIT #ifdef DEPTH_LIMIT
B->cp_depth = DEPTH; B->cp_depth = DEPTH;
#endif /* DEPTH_LIMIT */ #endif /* DEPTH_LIMIT */
YENV = ASP = (CELL *)B; ASP = (CELL *)B;
YENV[E_CB] = (CELL)B; ASP[E_CB] = (CELL)B;
HB = HR; HB = HR;
gip->b = LCL0-CellPtr(B); 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, YAP_dogoalinfo *gi, bool top USES_REGS) {
@ -1743,7 +1764,7 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
YAP_dogoalinfo gi; YAP_dogoalinfo gi;
gi.p = P; gi.p = P;
gi.cp = CP; gi.cp = CP;
gi.b0 = LCL0-CellPtr(B); gi.b_top = LCL0-CellPtr(B);
gi.CurSlot = Yap_CurrentHandle(); gi.CurSlot = Yap_CurrentHandle();
gi.a = LCL0-ASP; gi.a = LCL0-ASP;
gi.e = LCL0-ENV; gi.e = LCL0-ENV;
@ -1773,7 +1794,7 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
#endif #endif
} }
#endif /* TABLING */ #endif /* TABLING */
B = (choiceptr)(LCL0-gi.b0); B = (choiceptr)(LCL0-gi.b_top);
CP = gi.cp; CP = gi.cp;
P = gi.p; P = gi.p;
ASP = LCL0-gi.a; ASP = LCL0-gi.a;
@ -1810,7 +1831,7 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
ASP = LCL0-gi.a; ASP = LCL0-gi.a;
/* YENV should be set to the current environment */ /* YENV should be set to the current environment */
YENV = ENV = LCL0-gi.e; YENV = ENV = LCL0-gi.e;
B =(choiceptr)(LCL0-gi.b); B =(choiceptr)(LCL0-gi.b_top);
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?
@ -1885,7 +1906,7 @@ void Yap_trust_last(void) {
} }
} }
Term Yap_RunTopGoal(Term t, bool handle_errors) { Term Yap_RunTopGoal(Term t, YAP_dogoalinfo *gip, bool handle_errors) {
CACHE_REGS CACHE_REGS
yamop *CodeAdr; yamop *CodeAdr;
Prop pe; Prop pe;
@ -1894,13 +1915,6 @@ Term Yap_RunTopGoal(Term t, bool handle_errors) {
UInt arity; UInt arity;
Term tmod = CurrentModule; Term tmod = CurrentModule;
Term goal_out = 0; Term goal_out = 0;
YAP_dogoalinfo gi;
gi.p = P;
gi.cp = CP;
gi.b0 = gi.b = LCL0-CellPtr(B);
gi.CurSlot = Yap_CurrentHandle();
gi.a = LCL0-ASP;
gi.e = LCL0-ENV;
LOCAL_PrologMode |= TopGoalMode; LOCAL_PrologMode |= TopGoalMode;
t = Yap_YapStripModule(t, &tmod); t = Yap_YapStripModule(t, &tmod);
@ -1971,7 +1985,7 @@ Term Yap_RunTopGoal(Term t, 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, &gi, handle_errors PASS_REGS); goal_out = do_goal(CodeAdr, arity, pt, gip, handle_errors PASS_REGS);
return goal_out; return goal_out;
} }
@ -2137,11 +2151,13 @@ 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) { while (B->cp_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;

View File

@ -304,6 +304,8 @@ bool Yap_search_for_static_predicate_in_use(PredEntry *p,
return true; return true;
} }
env_ptr = b_ptr->cp_env; env_ptr = b_ptr->cp_env;
if (b_ptr->cp_ap == NOCODE)
return false;
b_ptr = b_ptr->cp_b; b_ptr = b_ptr->cp_b;
} while (b_ptr != NULL); } while (b_ptr != NULL);
return (FALSE); return (FALSE);

View File

@ -254,7 +254,6 @@ YAPApplTerm::YAPApplTerm(YAPFunctor f, YAPTerm ts[]) {
arity_t arity = ArityOfFunctor(f.f); arity_t arity = ArityOfFunctor(f.f);
Term o = AbsAppl(HR); Term o = AbsAppl(HR);
*HR++ = (CELL)f.f; *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(); *HR++ = ts[i].term();
mk(o); mk(o);
@ -834,7 +833,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); choiceptr myB = (choiceptr)(LCL0 - q_h.b_top);
return (B >= myB); return (B >= myB);
RECOVER_MACHINE_REGS(); RECOVER_MACHINE_REGS();
} }

View File

@ -203,7 +203,7 @@ 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, bool); extern Term Yap_RunTopGoal(Term, struct goal_info *, 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);

View File

@ -2322,7 +2322,7 @@ static inline void prune(choiceptr cp USES_REGS) {
POP_EXECUTE(); POP_EXECUTE();
} }
if (B->cp_b == NULL) if (B->cp_b == NULL)
break; return;
B = B->cp_b; B = B->cp_b;
} }
if (POP_CHOICE_POINT(B->cp_b)) { if (POP_CHOICE_POINT(B->cp_b)) {

View File

@ -138,7 +138,7 @@ typedef enum {
/* this should be opaque to the user */ /* this should be opaque to the user */
typedef struct goal_info { typedef struct goal_info {
unsigned long b, b0, e, a; //> choice-point at entry unsigned long b_top, b_bottom, m, e, a; //> 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'].
%:- stop_low_level_trace.
:- use_module('error.yap'). :- use_module('error.yap').
:- [ :- [