CurSlot maintenance

This commit is contained in:
Vítor Santos Costa 2013-01-19 22:13:43 +00:00
parent eea91f782f
commit 014a0ec5bc
2 changed files with 6 additions and 4 deletions

View File

@ -2510,11 +2510,13 @@ YAP_RunGoalOnce(Term t)
Term out;
yamop *old_CP = CP;
Int oldPrologMode = LOCAL_PrologMode;
Int oldSlot = CurSlot;
BACKUP_MACHINE_REGS();
LOCAL_PrologMode = UserMode;
out = Yap_RunTopGoal(t);
LOCAL_PrologMode = oldPrologMode;
CurSlot = oldSlot;
if (!(oldPrologMode & UserCCallMode)) {
/* called from top-level */
LOCAL_AllowRestart = FALSE;
@ -2545,10 +2547,9 @@ YAP_RunGoalOnce(Term t)
B = cut_pt;
}
ASP = B->cp_env;
Yap_PopSlots( PASS_REGS1 );
ENV = (CELL *)ASP[E_E];
B = (choiceptr)ASP[E_CB];
#ifdef DEPTH_LIMIT
#ifdef DEPTH_LIMITxs
DEPTH = ASP[E_DEPTH];
#endif
P = (yamop *)ASP[E_CP];

View File

@ -1198,6 +1198,7 @@ static int
execute_pred(PredEntry *ppe, CELL *pt USES_REGS)
{
yamop *saved_p, *saved_cp;
Int saved_slot = CurSlot;
yamop *CodeAdr;
Int out;
@ -1214,6 +1215,7 @@ execute_pred(PredEntry *ppe, CELL *pt USES_REGS)
UNLOCK(ppe->PELock);
out = do_goal(CodeAdr, ppe->ArityOfPE, pt, FALSE PASS_REGS);
}
CurSlot = saved_slot;
if (out == 1) {
choiceptr cut_B;
@ -1252,13 +1254,12 @@ execute_pred(PredEntry *ppe, CELL *pt USES_REGS)
DEPTH= ENV[E_DEPTH];
#endif
ENV = (CELL *)(ENV[E_E]);
Yap_StartSlots( PASS_REGS1 );
/* we have failed, and usually we would backtrack to this B,
trouble is, we may also have a delayed cut to do */
if (B != NULL)
HB = B->cp_h;
YENV = ENV;
return(TRUE);
return TRUE;
} else if (out == 0) {
P = saved_p;
CP = saved_cp;