change throw mechanism to fit better with cleanup mechanism:

- balls are now stored off line and recovered by Prolog code when everything
is safe.
- if a ball exists, throw uses the *existing* one (be careful not to have one
laying around).
- Jump routine cleans up every cp except ones for setup_call handling, backtracking simply calls setup handlers.
This commit is contained in:
Vítor Manuel de Morais Santos Costa
2009-11-27 11:21:24 +00:00
parent 7f5da32c08
commit 98f79484ae
19 changed files with 142 additions and 194 deletions

View File

@@ -1300,22 +1300,15 @@ p_nb_getval(void)
return Yap_unify(ARG2, to);
}
static Int
p_nb_delete(void)
static Int
nbdelete(Atom at)
{
Term t = Deref(ARG1);
GlobalEntry *ge, *g;
AtomEntry *ae;
Prop gp, g0;
if (IsVarTerm(t)) {
Yap_Error(INSTANTIATION_ERROR,t,"nb_delete");
return FALSE;
} else if (!IsAtomTerm(t)) {
Yap_Error(TYPE_ERROR_ATOM,t,"nb_delete");
return FALSE;
}
ge = FindGlobalEntry(AtomOfTerm(t));
ge = FindGlobalEntry(at);
if (!ge)
return FALSE;
WRITE_LOCK(ge->GRWLock);
@@ -1344,6 +1337,27 @@ p_nb_delete(void)
return TRUE;
}
Int
Yap_DeleteGlobal(Atom at)
{
return nbdelete(at);
}
static Int
p_nb_delete(void)
{
Term t = Deref(ARG1);
if (IsVarTerm(t)) {
Yap_Error(INSTANTIATION_ERROR,t,"nb_delete");
return FALSE;
} else if (!IsAtomTerm(t)) {
Yap_Error(TYPE_ERROR_ATOM,t,"nb_delete");
return FALSE;
}
return nbdelete(AtomOfTerm(t));
}
static Int
p_nb_create(void)
{