From d0cd5f3fa3c44129b55623e3234a1864347ee1d0 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 26 Oct 2010 10:04:36 +0100 Subject: [PATCH] fix atom gc to actually recover first atom in the chain. --- C/agc.c | 1 + H/rheap.h | 2 +- H/sshift.h | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/C/agc.c b/C/agc.c index 9e0b78617..24e31e88b 100755 --- a/C/agc.c +++ b/C/agc.c @@ -126,6 +126,7 @@ AtomAdjust(Atom a) #define REINIT_LOCK(P) #define REINIT_RWLOCK(P) +#define NoAGCAtomAdjust(P) (P) #define OrArgAdjust(P) #define TabEntryAdjust(P) #define IntegerAdjust(D) (D) diff --git a/H/rheap.h b/H/rheap.h index f48cc246d..a4c978728 100755 --- a/H/rheap.h +++ b/H/rheap.h @@ -391,7 +391,7 @@ RestoreAtoms(void) PtoAtomHashEntryAdjust(Yap_heap_regs->hash_chain); HashPtr = HashChain; for (i = 0; i < AtomHashTableSize; ++i) { - HashPtr->Entry = AtomAdjust(HashPtr->Entry); + HashPtr->Entry = NoAGCAtomAdjust(HashPtr->Entry); RestoreAtomList(HashPtr->Entry); HashPtr++; } diff --git a/H/sshift.h b/H/sshift.h index 44faebc8c..64a1f668c 100755 --- a/H/sshift.h +++ b/H/sshift.h @@ -320,6 +320,14 @@ AtomAdjust (Atom at) return (Atom) ((at)); } +inline EXTERN Atom NoAGCAtomAdjust (Atom); + +inline EXTERN Atom +NoAGCAtomAdjust (Atom at) +{ + return (Atom) ((at)); +} + inline EXTERN Prop PropAdjust (Prop); @@ -341,6 +349,14 @@ AtomAdjust (Atom at) return (Atom) ((at == NULL ? (at) : (Atom) (CharP (at) + HDiff))); } +inline EXTERN Atom NoAGCAtomAdjust (Atom); + +inline EXTERN Atom +NoAGCAtomAdjust (Atom at) +{ + return (Atom) ((at == NULL ? (at) : (Atom) (CharP (at) + HDiff))); +} + inline EXTERN Prop PropAdjust (Prop);