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

10
C/agc.c
View File

@ -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 */

View File

@ -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

View File

@ -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);

View File

@ -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));
}

View File

@ -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) )