diff --git a/C/c_interface.c b/C/c_interface.c index 557767b66..010dc0a90 100644 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -1939,7 +1939,7 @@ YAP_GoalHasException(Term *t) X_API void YAP_ClearExceptions(void) { - Yap_DeleteGlobal(AtomCatch); + Yap_ResetExceptionTerm(); EX = 0L; UncaughtThrow = FALSE; } diff --git a/C/dbase.c b/C/dbase.c index 8b093a2e2..5b073a310 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -4947,35 +4947,7 @@ Term Yap_PopTermFromDB(DBTerm *ref) { Term t = GetDBTerm(ref); - DBRef *cp = ref->DBRefs; - - if (cp) { - DBRef eref; - - while ((eref = *--cp) != NIL) { - if (eref->Flags & LogUpdMask) { - LogUpdClause *cl = (LogUpdClause *)eref; - cl->ClRefCount--; - if (cl->ClFlags & ErasedMask && - !(cl->ClFlags & InUseMask) && - !(cl->ClRefCount)) { - EraseLogUpdCl(cl); - } - } else { - LOCK(eref->lock); - eref->NOfRefsTo--; - if (eref->Flags & ErasedMask && - !(eref->Flags & InUseMask) && - eref->NOfRefsTo) { - UNLOCK(eref->lock); - ErDBE(eref); - } else { - UNLOCK(eref->lock); - } - } - } - } - Yap_FreeCodeSpace((char *)ref); + ReleaseTermFromDB(ref); return t; } @@ -5395,6 +5367,8 @@ p_resize_int_keys(void) static void ReleaseTermFromDB(DBTerm *ref) { + if (!ref) + return; keepdbrefs(ref); ErasePendingRefs(ref); FreeDBSpace((char *) ref); diff --git a/C/exec.c b/C/exec.c index 4b6aa50ef..575120d03 100644 --- a/C/exec.c +++ b/C/exec.c @@ -1587,7 +1587,7 @@ Yap_InitYaamRegs(void) Yap_regp = &Yap_standard_regs; #endif #endif /* PUSH_REGS */ - Yap_DeleteGlobal (AtomCatch); + Yap_ResetExceptionTerm (); Yap_PutValue (AtomBreak, MkIntTerm (0)); TR = (tr_fr_ptr)Yap_TrailBase; if (Yap_AttsSize > (Yap_LocalBase-Yap_GlobalBase)/8) @@ -1728,6 +1728,13 @@ p_reset_exception(void) return Yap_unify(t, ARG1); } +void +Yap_ResetExceptionTerm(void) +{ + Yap_ReleaseTermFromDB(BallTerm); + BallTerm = NULL; +} + static Int p_get_exception(void) { diff --git a/H/Yapproto.h b/H/Yapproto.h index e9649294d..8cf9a9e8e 100644 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -176,6 +176,7 @@ Term STD_PROTO(Yap_ExecuteCallMetaCall,(Term)); void STD_PROTO(Yap_InitExecFs,(void)); Int STD_PROTO(Yap_JumpToEnv,(Term)); Term STD_PROTO(Yap_RunTopGoal,(Term)); +void STD_PROTO(Yap_ResetExceptionTerm,(void)); Int STD_PROTO(Yap_execute_goal,(Term, int, Term)); int STD_PROTO(Yap_exec_absmi,(int)); void STD_PROTO(Yap_trust_last,(void)); diff --git a/packages/chr b/packages/chr index f6a790076..c325e4564 160000 --- a/packages/chr +++ b/packages/chr @@ -1 +1 @@ -Subproject commit f6a79007615bf46dc79712c41d61289834f28ba3 +Subproject commit c325e4564bb8d4e32c27f2061df85f13d315974e diff --git a/packages/jpl b/packages/jpl index eb6d27251..a2d2f0310 160000 --- a/packages/jpl +++ b/packages/jpl @@ -1 +1 @@ -Subproject commit eb6d27251c2548c25e6d37fff2a27a014caaa7aa +Subproject commit a2d2f03107eecd45462cd61a678035132cf06326 diff --git a/packages/plunit/examples/simple.pl b/packages/plunit/examples/simple.pl index d374bb63d..e3e52d314 100644 --- a/packages/plunit/examples/simple.pl +++ b/packages/plunit/examples/simple.pl @@ -30,3 +30,4 @@ test(append) :- X == "aapnoot". :- end_tests(lists). +