diff --git a/C/dbase.c b/C/dbase.c index 20cf7dafc..44595d689 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -1508,8 +1508,9 @@ CreateDBStruct(Term Tm, DBProp p, int InFlag) while (ptr != tofref) *rfnar++ = *--ptr; pp->u.DBRefs = rfnar; - - } + } else { + pp->u.DBRefs = NULL; + } Yap_ReleasePreAllocCodeSpace((ADDR)pp0); return (pp); } @@ -1768,30 +1769,31 @@ p_rcdap(void) Term TRef, t1 = Deref(ARG1), t2 = Deref(ARG2); if (!IsVarTerm(Deref(ARG3))) - return (FALSE); + return FALSE; restart_record: TRef = MkDBRefTerm(record(MkFirst | MkCode, t1, t2, Unsigned(0))); switch(DBErrorFlag) { case NO_ERROR_IN_DB: - return (Yap_unify(ARG3, TRef)); + return Yap_unify(ARG3, TRef); case SOVF_ERROR_IN_DB: if (!Yap_gc(3, ENV, P)) { Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); + return FALSE; } goto recover_record; case TOVF_ERROR_IN_DB: Yap_Error(SYSTEM_ERROR, TermNil, "YAP could not grow trail in recorda/3"); - return(FALSE); + return FALSE; case OVF_ERROR_IN_DB: if (!Yap_growheap(FALSE)) { Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); - } else + return FALSE; + } else { goto recover_record; + } default: Yap_Error(DBErrorNumber, DBErrorTerm, DBErrorMsg); - return(FALSE); + return FALSE; } recover_record: DBErrorFlag = NO_ERROR_IN_DB; @@ -3750,7 +3752,8 @@ PrepareToEraseLogUpdClause(Clause *clau, DBRef dbr) static void PrepareToEraseClause(Clause *clau, DBRef dbr) -{ yamop *code_p; +{ + yamop *code_p; /* no need to erase what has been erased */ if (clau->ClFlags & ErasedMask) @@ -3900,7 +3903,7 @@ EraseEntry(DBRef entryref) entryref->Next = NIL; if (!DBREF_IN_USE(entryref)) { ErDBE(entryref); - } else if ((entryref->Flags & DBCode && entryref->u.Code)) { + } else if ((entryref->Flags & DBCode) && entryref->u.Code) { PrepareToEraseClause(ClauseCodeToClause(entryref->u.Code), entryref); } } diff --git a/pl/boot.yap b/pl/boot.yap index ed1053eaf..d3ff124a6 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -750,12 +750,11 @@ not(A) :- '$call'(A, _, _,CurMod) :- ( % goal_expansion is defined, or - '$pred_goal_expansion_on' -> - '$expand_call'(A,CurMod) - ; - % this is a meta-predicate - '$flags'(A,CurMod,F,_), F /\ 0x200000 =:= 0x200000 -> + '$pred_goal_expansion_on' -> '$expand_call'(A,CurMod) + % this is a meta-predicate + ; '$flags'(A,CurMod,F,_), F /\ 0x200000 =:= 0x200000 -> + '$expand_call'(A, CurMod) ; '$execute0'(A, CurMod) ). diff --git a/pl/debug.yap b/pl/debug.yap index 3cc798a41..d04f12899 100644 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -498,7 +498,7 @@ debugging :- CP is '$last_choice_pt', functor(G,F,N), ( - '$meta_predicate'(F,M,N,_) -> + '$meta_predicate'(F,M,N,_) -> '$setflop'(1), '$creep', % I need to use call, otherwise I'll be in trouble if G @@ -553,10 +553,10 @@ debugging :- D1 is D0-1. '$do_execute_dynamic_clause'(G,M,Clause) :- + Clause = (G :- Body), '$check_depth_for_interpreter'(D), ('$undefined'('$set_depth_limit'(_),prolog) -> true ; '$set_depth_limit'(D)), CP is '$last_choice_pt', - Clause = (G :- Body), ( Body = true -> true ; '$call'(Body,CP,Body,M) ). '$do_creep_execute'(G,M,Cl) :-