From 378035a4b0e0e67cef3fd7726fa5c54ad35e11b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Sun, 12 Dec 2010 16:45:39 +0000 Subject: [PATCH] fix bad marking of dbterms (obs from Ines Dutra). --- C/agc.c | 18 +++++++++++++++++- C/cdmgr.c | 8 +++++--- H/rheap.h | 8 +++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/C/agc.c b/C/agc.c index 24e31e88b..fe13d64bb 100755 --- a/C/agc.c +++ b/C/agc.c @@ -74,6 +74,7 @@ CleanAtomMarkedBit(Atom a) return (Atom)c; } + static inline Functor FuncAdjust(Functor f) { @@ -111,6 +112,22 @@ AtomAdjust(Atom a) return(a); } +static Term AdjustDBTerm(Term, Term *); + +static Term +CodeComposedTermAdjust(Term t) +{ + Term *base; + + if (IsApplTerm(t)) { + base = RepAppl(t); + } else { + base = RepPair(t); + } + return AdjustDBTerm(t, base); +} + + #define IsOldCode(P) FALSE #define IsOldCodeCellPtr(P) FALSE #define IsOldDelay(P) FALSE @@ -145,7 +162,6 @@ AtomAdjust(Atom a) #define AtomEntryAdjust(P) (P) #define GlobalEntryAdjust(P) (P) #define BlobTermAdjust(P) (P) -#define CodeComposedTermAdjust(P) (P) #define CellPtoHeapAdjust(P) (P) #define PtoAtomHashEntryAdjust(P) (P) #define CellPtoHeapCellAdjust(P) (P) diff --git a/C/cdmgr.c b/C/cdmgr.c index 17128c49d..b8c7cd038 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -792,11 +792,13 @@ ConstantTermAdjust (Term t) return AtomTermAdjust(t); else if (IsIntTerm(t)) return t; - else if (IsApplTerm(t)) + else if (IsApplTerm(t) && IsBlobFunctor(FunctorOfTerm(t))) { return BlobTermAdjust(t); - else if (IsPairTerm(t)) + } else if (IsApplTerm(t) || IsPairTerm(t)) { return CodeComposedTermAdjust(t); - else return t; + } else { + return t; + } } diff --git a/H/rheap.h b/H/rheap.h index 06176cd68..33b96b1ea 100755 --- a/H/rheap.h +++ b/H/rheap.h @@ -246,11 +246,13 @@ ConstantTermAdjust (Term t) return AtomTermAdjust(t); else if (IsIntTerm(t)) return t; - else if (IsApplTerm(t)) + else if (IsApplTerm(t) && IsBlobFunctor(FunctorOfTerm(t))) { return BlobTermAdjust(t); - else if (IsPairTerm(t)) + } else if (IsApplTerm(t) || IsPairTerm(t)) { return CodeComposedTermAdjust(t); - else return t; + } else { + return t; + } } /* Now, everything on its place so you must adjust the pointers */