cut_succeed and cut_fail should recover pool of try_c and should

do trim_trail (not that the latter really matters).
This commit is contained in:
Vítor Manuel de Morais Santos Costa 2010-01-26 18:03:09 +00:00
parent 4283f44ebc
commit bcc4a27206
3 changed files with 14 additions and 11 deletions

View File

@ -7713,13 +7713,6 @@ Yap_absmi(int inp)
setregs();
Yap_PrologMode = UserMode;
if (!SREG) {
#ifdef CUT_C
/* Removes the cut functions from the stack
without executing them because we have fail
and not cuted the predicate*/
while(POP_CHOICE_POINT(B))
cut_c_pop();
#endif
FAIL();
}
if ((CELL *) B == YREG && ASP != (CELL *) B) {

View File

@ -722,10 +722,6 @@ EXTERN inline void restore_B(void) {
#define ARG15 XREGS[15]
#define ARG16 XREGS[16]
#define cut_succeed() return( ( B = B->cp_b, 1 ))
#define cut_fail() return( ( B = B->cp_b, 0 ))
/* by default, define HBREG to be HB */
#define HBREG HB

View File

@ -513,3 +513,17 @@ Yap_unify_constant(register Term a, register Term cons)
#define LT_OK_IN_CMP 2
#define GT_OK_IN_CMP 4
static inline int
do_cut(int i) {
while (POP_CHOICE_POINT(B->cp_b)) {
cut_c_pop();
}
Yap_TrimTrail();
B = B->cp_b;
return i;
}
#define cut_succeed() return do_cut(TRUE)
#define cut_fail() return do_cut(FALSE)