add some atom gc fixes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1299 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2005-05-30 03:26:37 +00:00
parent f9dd4ebdf7
commit b45acf1195
5 changed files with 38 additions and 13 deletions

View File

@ -25,6 +25,7 @@ static char SccsId[] = "@(#)agc.c 1.3 3/15/90";
#include "attvar.h" #include "attvar.h"
#ifdef DEBUG #ifdef DEBUG
#define DEBUG_RESTORE1 1
/* #define DEBUG_RESTORE2 1 */ /* #define DEBUG_RESTORE2 1 */
#define errout Yap_stderr #define errout Yap_stderr
#endif #endif
@ -73,8 +74,10 @@ CleanAtomMarkedBit(Atom a)
static inline Functor static inline Functor
FuncAdjust(Functor f) FuncAdjust(Functor f)
{ {
if (!IsExtensionFunctor(f)) {
AtomEntry *ae = RepAtom(NameOfFunctor(f)); AtomEntry *ae = RepAtom(NameOfFunctor(f));
MarkAtomEntry(ae); MarkAtomEntry(ae);
}
return(f); return(f);
} }
@ -170,7 +173,7 @@ mark_atoms(void)
if (atm) { if (atm) {
at = RepAtom(atm); at = RepAtom(atm);
do { do {
#ifdef DEBUG_RESTORE2 /* useful during debug */ #ifdef DEBUG_RESTORE1 /* useful during debug */
fprintf(errout, "Restoring %s\n", at->StrOfAE); fprintf(errout, "Restoring %s\n", at->StrOfAE);
#endif #endif
RestoreEntries(RepProp(at->PropsOfAE)); RestoreEntries(RepProp(at->PropsOfAE));
@ -393,6 +396,7 @@ Yap_atom_gc(void)
static Int static Int
p_atom_gc(void) p_atom_gc(void)
{ {
return TRUE;
#ifndef FIXED_STACKS #ifndef FIXED_STACKS
atom_gc(); atom_gc();
#endif /* FIXED_STACKS */ #endif /* FIXED_STACKS */

View File

@ -12,8 +12,11 @@
* File: rclause.h * * File: rclause.h *
* comments: walk through a clause * * 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 $ * $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 * Revision 1.1 2005/01/04 02:50:21 vsc
* - allow MegaClauses with blobs * - allow MegaClauses with blobs
* - change Diffs to be thread specific * - change Diffs to be thread specific
@ -74,8 +77,6 @@ restore_opcodes(yamop *pc)
#endif #endif
switch (op) { switch (op) {
case _Nstop: case _Nstop:
Yap_Error(SYSTEM_ERROR, TermNil,
"Invalid Opcode found while restoring %p", pc);
return; return;
case _Ystop: case _Ystop:
#ifdef DEBUG_RESTORE2 #ifdef DEBUG_RESTORE2

View File

@ -11,8 +11,13 @@
* File: rheap.h * * File: rheap.h *
* comments: walk through heap code * * 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 $ * $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 * Revision 1.47 2004/12/02 06:06:47 vsc
* fix threads so that they at least start * fix threads so that they at least start
* allow error handling to work with threads * allow error handling to work with threads
@ -848,13 +853,22 @@ CleanCode(PredEntry *pp)
/* Init takes care of the first 2 cases */ /* 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) { if (pp->ModuleOfPred) {
pp->ModuleOfPred = AtomTermAdjust(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->ModuleOfPred != IDB_MODULE) {
if (pp->src.OwnerFile && pp->ModuleOfPred != IDB_MODULE) if (pp->src.OwnerFile && pp->ModuleOfPred != IDB_MODULE)
pp->src.OwnerFile = AtomAdjust(pp->src.OwnerFile); pp->src.OwnerFile = AtomAdjust(pp->src.OwnerFile);

View File

@ -227,6 +227,7 @@ inline EXTERN Functor FuncAdjust (Functor);
inline EXTERN Functor inline EXTERN Functor
FuncAdjust (Functor f) FuncAdjust (Functor f)
{ {
if (!IsExtensionFunctor(f))
return (Functor) ((Functor) (CharP (f) + HDiff)); return (Functor) ((Functor) (CharP (f) + HDiff));
} }

View File

@ -43,7 +43,12 @@ Inline(TrailAddrAdjust, ADDR, ADDR, ptr, (ptr+TrDiff) )
Inline(TokEntryAdjust, TokEntry *, TokEntry*, ptr, ((CELL)ptr+TrDiff) ) Inline(TokEntryAdjust, TokEntry *, TokEntry*, ptr, ((CELL)ptr+TrDiff) )
Inline(VarEntryAdjust, VarEntry *, VarEntry*, ptr, ((CELL)ptr+TrDiff) ) Inline(VarEntryAdjust, VarEntry *, VarEntry*, ptr, ((CELL)ptr+TrDiff) )
/* heap data structures */ /* 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)) ) Inline(CellPtoHeapAdjust, CELL *, CELL *, ptr, ((CELL *)(CharP(ptr) + HDiff)) )
#if USE_OFFSETS #if USE_OFFSETS
Inline(AtomAdjust, Atom, Atom, at, (at) ) Inline(AtomAdjust, Atom, Atom, at, (at) )