From ab7489b93dbedc33ae9685972b408bd1358cc475 Mon Sep 17 00:00:00 2001 From: vsc Date: Wed, 8 Sep 2004 17:56:48 +0000 Subject: [PATCH] source: a(X) :- true is a fact! fix use of value after possible overflow in IPred git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1128 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/cdmgr.c | 29 +++++++++++++++++++++++------ C/tracer.c | 4 ++++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index e5d63d312..cb5103a1f 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -11,8 +11,11 @@ * File: cdmgr.c * * comments: Code manager * * * -* Last rev: $Date: 2004-09-07 16:48:04 $,$Author: vsc $ * +* Last rev: $Date: 2004-09-08 17:56:45 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.130 2004/09/07 16:48:04 vsc +* fix bug in unwinding trail at amiops.h +* * Revision 1.129 2004/09/07 16:25:22 vsc * memory management bug fixes * @@ -1187,6 +1190,22 @@ addcl_permission_error(AtomEntry *ap, Int Arity, int in_use) } } + +static int +is_fact(Term t) +{ + Term a1; + + if (IsAtomTerm(t)) + return TRUE; + if (FunctorOfTerm(t) != FunctorAssert) + return TRUE; + a1 = ArgOfTerm(2, t); + if (a1 == MkAtomTerm(AtomTrue)) + return TRUE; + return FALSE; +} + static Term addclause(Term t, yamop *cp, int mode, int mod) /* @@ -1257,16 +1276,14 @@ addclause(Term t, yamop *cp, int mode, int mod) if (pflags & LogUpdatePredFlag) { LogUpdClause *clp = ClauseCodeToLogUpdClause(cp); clp->ClFlags |= LogUpdMask; - if (IsAtomTerm(t) || - FunctorOfTerm(t) != FunctorAssert) { + if (is_fact(t)) { clp->ClFlags |= FactMask; clp->ClSource = NULL; } } else { StaticClause *clp = ClauseCodeToStaticClause(cp); clp->ClFlags |= StaticMask; - if (IsAtomTerm(t) || - FunctorOfTerm(t) != FunctorAssert) { + if (is_fact(t)) { clp->ClFlags |= FactMask; clp->usc.ClPred = p; } @@ -3544,7 +3561,7 @@ p_static_clause(void) IPred(pe); WRITE_UNLOCK(pe->PRWLock); } - return fetch_next_static_clause(pe, pe->cs.p_code.TrueCodeOfPred, t1, ARG3, ARG4, P, TRUE); + return fetch_next_static_clause(pe, pe->cs.p_code.TrueCodeOfPred, ARG1, ARG3, ARG4, P, TRUE); } static Int /* $hidden_predicate(P) */ diff --git a/C/tracer.c b/C/tracer.c index 413f95013..5f1fc5082 100644 --- a/C/tracer.c +++ b/C/tracer.c @@ -120,6 +120,10 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) /* extern int gc_calls; */ vsc_count++; + if (vsc_count < 845900) + return; + if (vsc_count == 845979) + jmp_deb(1); #ifdef COMMENTED // if (vsc_count == 218280) // vsc_xstop = 1;