support for making sure exceptions are reset when they should be reset (obs from Nuno Fonseca, #159)
This commit is contained in:
parent
71e4d73a75
commit
1176f71f3a
@ -1939,7 +1939,7 @@ YAP_GoalHasException(Term *t)
|
|||||||
X_API void
|
X_API void
|
||||||
YAP_ClearExceptions(void)
|
YAP_ClearExceptions(void)
|
||||||
{
|
{
|
||||||
Yap_DeleteGlobal(AtomCatch);
|
Yap_ResetExceptionTerm();
|
||||||
EX = 0L;
|
EX = 0L;
|
||||||
UncaughtThrow = FALSE;
|
UncaughtThrow = FALSE;
|
||||||
}
|
}
|
||||||
|
32
C/dbase.c
32
C/dbase.c
@ -4947,35 +4947,7 @@ Term
|
|||||||
Yap_PopTermFromDB(DBTerm *ref)
|
Yap_PopTermFromDB(DBTerm *ref)
|
||||||
{
|
{
|
||||||
Term t = GetDBTerm(ref);
|
Term t = GetDBTerm(ref);
|
||||||
DBRef *cp = ref->DBRefs;
|
ReleaseTermFromDB(ref);
|
||||||
|
|
||||||
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);
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5395,6 +5367,8 @@ p_resize_int_keys(void)
|
|||||||
static void
|
static void
|
||||||
ReleaseTermFromDB(DBTerm *ref)
|
ReleaseTermFromDB(DBTerm *ref)
|
||||||
{
|
{
|
||||||
|
if (!ref)
|
||||||
|
return;
|
||||||
keepdbrefs(ref);
|
keepdbrefs(ref);
|
||||||
ErasePendingRefs(ref);
|
ErasePendingRefs(ref);
|
||||||
FreeDBSpace((char *) ref);
|
FreeDBSpace((char *) ref);
|
||||||
|
9
C/exec.c
9
C/exec.c
@ -1587,7 +1587,7 @@ Yap_InitYaamRegs(void)
|
|||||||
Yap_regp = &Yap_standard_regs;
|
Yap_regp = &Yap_standard_regs;
|
||||||
#endif
|
#endif
|
||||||
#endif /* PUSH_REGS */
|
#endif /* PUSH_REGS */
|
||||||
Yap_DeleteGlobal (AtomCatch);
|
Yap_ResetExceptionTerm ();
|
||||||
Yap_PutValue (AtomBreak, MkIntTerm (0));
|
Yap_PutValue (AtomBreak, MkIntTerm (0));
|
||||||
TR = (tr_fr_ptr)Yap_TrailBase;
|
TR = (tr_fr_ptr)Yap_TrailBase;
|
||||||
if (Yap_AttsSize > (Yap_LocalBase-Yap_GlobalBase)/8)
|
if (Yap_AttsSize > (Yap_LocalBase-Yap_GlobalBase)/8)
|
||||||
@ -1728,6 +1728,13 @@ p_reset_exception(void)
|
|||||||
return Yap_unify(t, ARG1);
|
return Yap_unify(t, ARG1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Yap_ResetExceptionTerm(void)
|
||||||
|
{
|
||||||
|
Yap_ReleaseTermFromDB(BallTerm);
|
||||||
|
BallTerm = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
p_get_exception(void)
|
p_get_exception(void)
|
||||||
{
|
{
|
||||||
|
@ -176,6 +176,7 @@ Term STD_PROTO(Yap_ExecuteCallMetaCall,(Term));
|
|||||||
void STD_PROTO(Yap_InitExecFs,(void));
|
void STD_PROTO(Yap_InitExecFs,(void));
|
||||||
Int STD_PROTO(Yap_JumpToEnv,(Term));
|
Int STD_PROTO(Yap_JumpToEnv,(Term));
|
||||||
Term STD_PROTO(Yap_RunTopGoal,(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_execute_goal,(Term, int, Term));
|
||||||
int STD_PROTO(Yap_exec_absmi,(int));
|
int STD_PROTO(Yap_exec_absmi,(int));
|
||||||
void STD_PROTO(Yap_trust_last,(void));
|
void STD_PROTO(Yap_trust_last,(void));
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit f6a79007615bf46dc79712c41d61289834f28ba3
|
Subproject commit c325e4564bb8d4e32c27f2061df85f13d315974e
|
@ -1 +1 @@
|
|||||||
Subproject commit eb6d27251c2548c25e6d37fff2a27a014caaa7aa
|
Subproject commit a2d2f03107eecd45462cd61a678035132cf06326
|
@ -30,3 +30,4 @@ test(append) :-
|
|||||||
X == "aapnoot".
|
X == "aapnoot".
|
||||||
|
|
||||||
:- end_tests(lists).
|
:- end_tests(lists).
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user