fix previous patch for restoring PredHashTable.

This commit is contained in:
Vitor Santos Costa 2010-04-09 11:46:59 +01:00
parent 066603c79b
commit 45473e939b
4 changed files with 27 additions and 5 deletions

View File

@ -712,9 +712,8 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
PredHash[hsh] = p; PredHash[hsh] = p;
} }
WRITE_UNLOCK(PredHashRWLock); WRITE_UNLOCK(PredHashRWLock);
/* make sure that we have something here */ /* make sure that we have something here: note that this is not a valid pointer!! */
p->NextOfPE = RepPredProp(fe->PropsOfFE)->NextOfPE; RepPredProp(fe->PropsOfFE)->NextOfPE = fe->PropsOfFE;
RepPredProp(fe->PropsOfFE)->NextOfPE = AbsPredProp(p);
} else { } else {
fe->PropsOfFE = AbsPredProp(p); fe->PropsOfFE = AbsPredProp(p);
p->NextOfPE = NIL; p->NextOfPE = NIL;

23
C/agc.c
View File

@ -194,6 +194,29 @@ AtomAdjust(Atom a)
#include "rheap.h" #include "rheap.h"
static void
RestoreHashPreds(void)
{
UInt i;
for (i = 0; i < PredHashTableSize; i++) {
PredEntry *p = PredHash[i];
if (p)
p = PredEntryAdjust(p);
while (p) {
Prop nextp;
if (p->NextOfPE)
p->NextOfPE = PropAdjust(p->NextOfPE);
nextp = p->NextOfPE;
CleanCode(p);
p = RepPredProp(nextp);
}
}
}
static void init_reg_copies(void) static void init_reg_copies(void)
{ {
OldASP = ASP; OldASP = ASP;

View File

@ -1321,7 +1321,6 @@ static void
restore_heap(void) restore_heap(void)
{ {
restore_codes(); restore_codes();
RestoreHashPreds();
RestoreIOStructures(); RestoreIOStructures();
} }

View File

@ -379,6 +379,7 @@ AdjustSwitchTable(op_numbers op, yamop *table, COUNT i)
STATIC_PROTO(void RestoreAtomList, (Atom)); STATIC_PROTO(void RestoreAtomList, (Atom));
STATIC_PROTO(void RestoreAtom, (AtomEntry *)); STATIC_PROTO(void RestoreAtom, (AtomEntry *));
STATIC_PROTO(void RestoreHashPreds, (void));
static void static void
RestoreAtoms(void) RestoreAtoms(void)
@ -658,7 +659,7 @@ RestorePredHash(void)
Yap_Error(FATAL_ERROR,MkIntTerm(0),"restore should find predicate hash table"); Yap_Error(FATAL_ERROR,MkIntTerm(0),"restore should find predicate hash table");
} }
REINIT_RWLOCK(PredHashRWLock); REINIT_RWLOCK(PredHashRWLock);
/* RestoreHashPreds() does most of the work */ RestoreHashPreds(); /* does most of the work */
} }
static void static void