From b45acf119517ff76baf2957b58459578828229a9 Mon Sep 17 00:00:00 2001 From: vsc Date: Mon, 30 May 2005 03:26:37 +0000 Subject: [PATCH] add some atom gc fixes git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1299 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/agc.c | 10 +++++++--- H/rclause.h | 7 ++++--- H/rheap.h | 24 +++++++++++++++++++----- H/sshift.h | 3 ++- m4/sshift.h.m4 | 7 ++++++- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/C/agc.c b/C/agc.c index 5aca4bd4c..992e6a09a 100644 --- a/C/agc.c +++ b/C/agc.c @@ -25,6 +25,7 @@ static char SccsId[] = "@(#)agc.c 1.3 3/15/90"; #include "attvar.h" #ifdef DEBUG +#define DEBUG_RESTORE1 1 /* #define DEBUG_RESTORE2 1 */ #define errout Yap_stderr #endif @@ -73,8 +74,10 @@ CleanAtomMarkedBit(Atom a) static inline Functor FuncAdjust(Functor f) { - AtomEntry *ae = RepAtom(NameOfFunctor(f)); - MarkAtomEntry(ae); + if (!IsExtensionFunctor(f)) { + AtomEntry *ae = RepAtom(NameOfFunctor(f)); + MarkAtomEntry(ae); + } return(f); } @@ -170,7 +173,7 @@ mark_atoms(void) if (atm) { at = RepAtom(atm); do { -#ifdef DEBUG_RESTORE2 /* useful during debug */ +#ifdef DEBUG_RESTORE1 /* useful during debug */ fprintf(errout, "Restoring %s\n", at->StrOfAE); #endif RestoreEntries(RepProp(at->PropsOfAE)); @@ -393,6 +396,7 @@ Yap_atom_gc(void) static Int p_atom_gc(void) { + return TRUE; #ifndef FIXED_STACKS atom_gc(); #endif /* FIXED_STACKS */ diff --git a/H/rclause.h b/H/rclause.h index 544753824..43980b2fb 100644 --- a/H/rclause.h +++ b/H/rclause.h @@ -12,8 +12,11 @@ * File: rclause.h * * comments: walk through a clause * * * -* Last rev: $Date: 2005-04-10 04:01:13 $,$Author: vsc $ * +* Last rev: $Date: 2005-05-30 03:26:37 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.2 2005/04/10 04:01:13 vsc +* bug fixes, I hope! +* * Revision 1.1 2005/01/04 02:50:21 vsc * - allow MegaClauses with blobs * - change Diffs to be thread specific @@ -74,8 +77,6 @@ restore_opcodes(yamop *pc) #endif switch (op) { case _Nstop: - Yap_Error(SYSTEM_ERROR, TermNil, - "Invalid Opcode found while restoring %p", pc); return; case _Ystop: #ifdef DEBUG_RESTORE2 diff --git a/H/rheap.h b/H/rheap.h index 801b6e4a8..15811e9c0 100644 --- a/H/rheap.h +++ b/H/rheap.h @@ -11,8 +11,13 @@ * File: rheap.h * * comments: walk through heap code * * * -* Last rev: $Date: 2005-01-04 02:50:21 $,$Author: vsc $ * +* Last rev: $Date: 2005-05-30 03:26:37 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.48 2005/01/04 02:50:21 vsc +* - allow MegaClauses with blobs +* - change Diffs to be thread specific +* - include Christian's updates +* * Revision 1.47 2004/12/02 06:06:47 vsc * fix threads so that they at least start * allow error handling to work with threads @@ -848,13 +853,22 @@ CleanCode(PredEntry *pp) /* Init takes care of the first 2 cases */ - if (pp->ArityOfPE) - pp->FunctorOfPred = FuncAdjust(pp->FunctorOfPred); - else - pp->FunctorOfPred = (Functor)AtomAdjust((Atom)(pp->FunctorOfPred)); if (pp->ModuleOfPred) { pp->ModuleOfPred = AtomTermAdjust(pp->ModuleOfPred); } + if (pp->ArityOfPE) { + if (pp->ModuleOfPred == IDB_MODULE) { + if (pp->PredFlags & AtomDBPredFlag) { + pp->FunctorOfPred = (Functor)AtomAdjust((Atom)(pp->FunctorOfPred)); + } else { + pp->FunctorOfPred = FuncAdjust(pp->FunctorOfPred); + } + } else { + pp->FunctorOfPred = FuncAdjust(pp->FunctorOfPred); + } + } else { + pp->FunctorOfPred = (Functor)AtomAdjust((Atom)(pp->FunctorOfPred)); + } if (pp->ModuleOfPred != IDB_MODULE) { if (pp->src.OwnerFile && pp->ModuleOfPred != IDB_MODULE) pp->src.OwnerFile = AtomAdjust(pp->src.OwnerFile); diff --git a/H/sshift.h b/H/sshift.h index 7c594fb57..809c823e1 100644 --- a/H/sshift.h +++ b/H/sshift.h @@ -227,7 +227,8 @@ inline EXTERN Functor FuncAdjust (Functor); inline EXTERN Functor FuncAdjust (Functor f) { - return (Functor) ((Functor) (CharP (f) + HDiff)); + if (!IsExtensionFunctor(f)) + return (Functor) ((Functor) (CharP (f) + HDiff)); } diff --git a/m4/sshift.h.m4 b/m4/sshift.h.m4 index 0fe19e55a..6b87a1e8d 100644 --- a/m4/sshift.h.m4 +++ b/m4/sshift.h.m4 @@ -43,7 +43,12 @@ Inline(TrailAddrAdjust, ADDR, ADDR, ptr, (ptr+TrDiff) ) Inline(TokEntryAdjust, TokEntry *, TokEntry*, ptr, ((CELL)ptr+TrDiff) ) Inline(VarEntryAdjust, VarEntry *, VarEntry*, ptr, ((CELL)ptr+TrDiff) ) /* heap data structures */ -Inline(FuncAdjust, Functor, Functor, f, (Functor)(CharP(f)+HDiff) ) +EXTERN inline Functor +FuncAdjust(Functor f) +{ + if (!IsExtensionFunctor(f)) + return (Functor)(CharP(f)+HDiff); +} Inline(CellPtoHeapAdjust, CELL *, CELL *, ptr, ((CELL *)(CharP(ptr) + HDiff)) ) #if USE_OFFSETS Inline(AtomAdjust, Atom, Atom, at, (at) )