fix repeat as last goal

- ensure allocate.
This commit is contained in:
Vítor Santos Costa 2015-10-11 04:19:33 +01:00
parent 9595bb4e6e
commit ddbba89d16

View File

@ -1609,8 +1609,6 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
push_branch(cglobs->onbranch, TermNil, cglobs); push_branch(cglobs->onbranch, TermNil, cglobs);
cglobs->curbranch++; cglobs->curbranch++;
cglobs->onbranch = cglobs->curbranch; cglobs->onbranch = cglobs->curbranch;
if (cglobs->onlast)
Yap_emit(deallocate_op, Zero, Zero, &cglobs->cint);
Yap_emit_3ops(push_or_op, l1, Zero, Zero, &cglobs->cint); Yap_emit_3ops(push_or_op, l1, Zero, Zero, &cglobs->cint);
Yap_emit_3ops(either_op, l1, Zero, Zero, &cglobs->cint); Yap_emit_3ops(either_op, l1, Zero, Zero, &cglobs->cint);
Yap_emit(restore_tmps_op, Zero, Zero, &cglobs->cint); Yap_emit(restore_tmps_op, Zero, Zero, &cglobs->cint);
@ -1622,17 +1620,19 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
if (cglobs->onlast) { if (cglobs->onlast) {
#ifdef TABLING #ifdef TABLING
PELOCK(43,cglobs->cint.CurrentPred); PELOCK(43,cglobs->cint.CurrentPred);
if (is_tabled(cglobs->cint.CurrentPred)) if (is_tabled(cglobs->cint.CurrentPred)) {
Yap_emit(table_new_answer_op, Zero, cglobs->cint.CurrentPred->ArityOfPE, &cglobs->cint); Yap_emit(table_new_answer_op, Zero, cglobs->cint.CurrentPred->ArityOfPE, &cglobs->cint);
else } else {
#endif /* TABLING */ #endif
Yap_emit(deallocate_op, Zero, Zero, &cglobs->cint);
Yap_emit(procceed_op, Zero, Zero, &cglobs->cint); Yap_emit(procceed_op, Zero, Zero, &cglobs->cint);
#ifdef TABLING #ifdef TABLING
}
UNLOCK(cglobs->cint.CurrentPred->PELock); UNLOCK(cglobs->cint.CurrentPred->PELock);
#endif #endif
} } else {
else ++cglobs->goalno;
++cglobs->goalno; }
cglobs->onbranch = pop_branch(cglobs); cglobs->onbranch = pop_branch(cglobs);
Yap_emit(pop_or_op, Zero, Zero, &cglobs->cint); Yap_emit(pop_or_op, Zero, Zero, &cglobs->cint);
/* --cglobs->onbranch; */ /* --cglobs->onbranch; */