ifix pruning

This commit is contained in:
ubu32 2011-07-11 21:14:26 -07:00
parent d488984753
commit 4a13735cb0

View File

@ -1132,8 +1132,9 @@ YAP_cut_up(void)
#endif /* CUT_C */ #endif /* CUT_C */
/* This is complicated: make sure we can restore the ASP /* This is complicated: make sure we can restore the ASP
pointer back to where cut_up called it. Slots depend on it. */ pointer back to where cut_up called it. Slots depend on it. */
if (ENV > B->cp_env) if (ENV > B->cp_env) {
ASP = B->cp_env; ASP = B->cp_env;
}
#ifdef YAPOR #ifdef YAPOR
{ {
choiceptr cut_pt; choiceptr cut_pt;
@ -2316,13 +2317,13 @@ YAP_RunGoalOnce(Term t)
Term out; Term out;
yamop *old_CP = CP; yamop *old_CP = CP;
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
LOCAL_PrologMode = UserMode; LOCAL_PrologMode = UserMode;
out = Yap_RunTopGoal(t); out = Yap_RunTopGoal(t);
LOCAL_PrologMode = UserCCallMode; LOCAL_PrologMode = UserCCallMode;
if (out) { if (out) {
choiceptr cut_pt; choiceptr cut_pt, ob;
ob = NULL;
cut_pt = B; cut_pt = B;
while (cut_pt-> cp_ap != NOCODE) { while (cut_pt-> cp_ap != NOCODE) {
/* make sure we prune C-choicepoints */ /* make sure we prune C-choicepoints */
@ -2330,14 +2331,18 @@ YAP_RunGoalOnce(Term t)
{ {
POP_EXECUTE(); POP_EXECUTE();
} }
ob = cut_pt;
cut_pt = cut_pt->cp_b; cut_pt = cut_pt->cp_b;
} }
#ifdef YAPOR #ifdef YAPOR
CUT_prune_to(cut_pt); CUT_prune_to(cut_pt);
#endif #endif
B = cut_pt; if (ob) {
B = ob;
Yap_TrimTrail(); Yap_TrimTrail();
} }
B = cut_pt;
}
ASP = B->cp_env; ASP = B->cp_env;
ENV = (CELL *)ASP[E_E]; ENV = (CELL *)ASP[E_E];
B = (choiceptr)ASP[E_CB]; B = (choiceptr)ASP[E_CB];