fix bad call to retry_counter

This commit is contained in:
Costa Vitor 2009-06-26 13:16:42 -05:00
parent 69c0a52548
commit 772d091a70

View File

@ -1209,13 +1209,16 @@ Yap_absmi(int inp)
UNLOCK(PREG->u.p.p->StatisticsForPred.lock); UNLOCK(PREG->u.p.p->StatisticsForPred.lock);
RetriesCounter--; RetriesCounter--;
if (RetriesCounter == 0 && RetriesCounterOn) { if (RetriesCounter == 0 && RetriesCounterOn) {
/* act as if we had backtracked */
ENV = B->cp_env;
saveregs(); saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
JMPNext();
setregs(); setregs();
JMPNext();
} }
PredEntriesCounter--; PredEntriesCounter--;
if (PredEntriesCounter == 0 && PredEntriesCounterOn) { if (PredEntriesCounter == 0 && PredEntriesCounterOn) {
ENV = B->cp_env;
saveregs(); saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,""); Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
setregs(); setregs();
@ -1228,8 +1231,18 @@ Yap_absmi(int inp)
/* count_retry_me Label,NArgs */ /* count_retry_me Label,NArgs */
Op(count_retry_me, Otapl); Op(count_retry_me, Otapl);
CACHE_Y(B); CACHE_Y(B);
restore_yaam_regs(PREG->u.Otapl.d);
restore_args(PREG->u.Otapl.s);
/* After retry, cut should be pointing at the parent /* After retry, cut should be pointing at the parent
* choicepoint for the current B */ * choicepoint for the current B */
#ifdef FROZEN_STACKS
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
set_cut(S_YREG, B->cp_b);
#else
set_cut(S_YREG, B_YREG->cp_b);
#endif /* FROZEN_STACKS */
SET_BB(B_YREG);
ENDCACHE_Y();
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);
@ -1247,16 +1260,6 @@ Yap_absmi(int inp)
setregs(); setregs();
JMPNext(); JMPNext();
} }
restore_yaam_regs(PREG->u.Otapl.d);
restore_args(PREG->u.Otapl.s);
#ifdef FROZEN_STACKS
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
set_cut(S_YREG, B->cp_b);
#else
set_cut(S_YREG, B_YREG->cp_b);
#endif /* FROZEN_STACKS */
SET_BB(B_YREG);
ENDCACHE_Y();
PREG = NEXTOP(PREG, Otapl); PREG = NEXTOP(PREG, Otapl);
GONext(); GONext();
ENDOp(); ENDOp();