make sure to initialise u.Code in dbase.c

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@745 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-01-21 23:27:02 +00:00
parent 3d5b22a732
commit 8a72ec94b9
3 changed files with 20 additions and 18 deletions

View File

@ -1508,8 +1508,9 @@ CreateDBStruct(Term Tm, DBProp p, int InFlag)
while (ptr != tofref) while (ptr != tofref)
*rfnar++ = *--ptr; *rfnar++ = *--ptr;
pp->u.DBRefs = rfnar; pp->u.DBRefs = rfnar;
} else {
} pp->u.DBRefs = NULL;
}
Yap_ReleasePreAllocCodeSpace((ADDR)pp0); Yap_ReleasePreAllocCodeSpace((ADDR)pp0);
return (pp); return (pp);
} }
@ -1768,30 +1769,31 @@ p_rcdap(void)
Term TRef, t1 = Deref(ARG1), t2 = Deref(ARG2); Term TRef, t1 = Deref(ARG1), t2 = Deref(ARG2);
if (!IsVarTerm(Deref(ARG3))) if (!IsVarTerm(Deref(ARG3)))
return (FALSE); return FALSE;
restart_record: restart_record:
TRef = MkDBRefTerm(record(MkFirst | MkCode, t1, t2, Unsigned(0))); TRef = MkDBRefTerm(record(MkFirst | MkCode, t1, t2, Unsigned(0)));
switch(DBErrorFlag) { switch(DBErrorFlag) {
case NO_ERROR_IN_DB: case NO_ERROR_IN_DB:
return (Yap_unify(ARG3, TRef)); return Yap_unify(ARG3, TRef);
case SOVF_ERROR_IN_DB: case SOVF_ERROR_IN_DB:
if (!Yap_gc(3, ENV, P)) { if (!Yap_gc(3, ENV, P)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
return(FALSE); return FALSE;
} }
goto recover_record; goto recover_record;
case TOVF_ERROR_IN_DB: case TOVF_ERROR_IN_DB:
Yap_Error(SYSTEM_ERROR, TermNil, "YAP could not grow trail in recorda/3"); Yap_Error(SYSTEM_ERROR, TermNil, "YAP could not grow trail in recorda/3");
return(FALSE); return FALSE;
case OVF_ERROR_IN_DB: case OVF_ERROR_IN_DB:
if (!Yap_growheap(FALSE)) { if (!Yap_growheap(FALSE)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage);
return(FALSE); return FALSE;
} else } else {
goto recover_record; goto recover_record;
}
default: default:
Yap_Error(DBErrorNumber, DBErrorTerm, DBErrorMsg); Yap_Error(DBErrorNumber, DBErrorTerm, DBErrorMsg);
return(FALSE); return FALSE;
} }
recover_record: recover_record:
DBErrorFlag = NO_ERROR_IN_DB; DBErrorFlag = NO_ERROR_IN_DB;
@ -3750,7 +3752,8 @@ PrepareToEraseLogUpdClause(Clause *clau, DBRef dbr)
static void static void
PrepareToEraseClause(Clause *clau, DBRef dbr) PrepareToEraseClause(Clause *clau, DBRef dbr)
{ yamop *code_p; {
yamop *code_p;
/* no need to erase what has been erased */ /* no need to erase what has been erased */
if (clau->ClFlags & ErasedMask) if (clau->ClFlags & ErasedMask)
@ -3900,7 +3903,7 @@ EraseEntry(DBRef entryref)
entryref->Next = NIL; entryref->Next = NIL;
if (!DBREF_IN_USE(entryref)) { if (!DBREF_IN_USE(entryref)) {
ErDBE(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); PrepareToEraseClause(ClauseCodeToClause(entryref->u.Code), entryref);
} }
} }

View File

@ -750,12 +750,11 @@ not(A) :-
'$call'(A, _, _,CurMod) :- '$call'(A, _, _,CurMod) :-
( (
% goal_expansion is defined, or % goal_expansion is defined, or
'$pred_goal_expansion_on' -> '$pred_goal_expansion_on' ->
'$expand_call'(A,CurMod)
;
% this is a meta-predicate
'$flags'(A,CurMod,F,_), F /\ 0x200000 =:= 0x200000 ->
'$expand_call'(A,CurMod) '$expand_call'(A,CurMod)
% this is a meta-predicate
; '$flags'(A,CurMod,F,_), F /\ 0x200000 =:= 0x200000 ->
'$expand_call'(A, CurMod)
; ;
'$execute0'(A, CurMod) '$execute0'(A, CurMod)
). ).

View File

@ -498,7 +498,7 @@ debugging :-
CP is '$last_choice_pt', CP is '$last_choice_pt',
functor(G,F,N), functor(G,F,N),
( (
'$meta_predicate'(F,M,N,_) -> '$meta_predicate'(F,M,N,_) ->
'$setflop'(1), '$setflop'(1),
'$creep', '$creep',
% I need to use call, otherwise I'll be in trouble if G % I need to use call, otherwise I'll be in trouble if G
@ -553,10 +553,10 @@ debugging :-
D1 is D0-1. D1 is D0-1.
'$do_execute_dynamic_clause'(G,M,Clause) :- '$do_execute_dynamic_clause'(G,M,Clause) :-
Clause = (G :- Body),
'$check_depth_for_interpreter'(D), '$check_depth_for_interpreter'(D),
('$undefined'('$set_depth_limit'(_),prolog) -> true ; '$set_depth_limit'(D)), ('$undefined'('$set_depth_limit'(_),prolog) -> true ; '$set_depth_limit'(D)),
CP is '$last_choice_pt', CP is '$last_choice_pt',
Clause = (G :- Body),
( Body = true -> true ; '$call'(Body,CP,Body,M) ). ( Body = true -> true ; '$call'(Body,CP,Body,M) ).
'$do_creep_execute'(G,M,Cl) :- '$do_creep_execute'(G,M,Cl) :-