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;
}
WRITE_UNLOCK(PredHashRWLock);
/* make sure that we have something here */
p->NextOfPE = RepPredProp(fe->PropsOfFE)->NextOfPE;
RepPredProp(fe->PropsOfFE)->NextOfPE = AbsPredProp(p);
/* make sure that we have something here: note that this is not a valid pointer!! */
RepPredProp(fe->PropsOfFE)->NextOfPE = fe->PropsOfFE;
} else {
fe->PropsOfFE = AbsPredProp(p);
p->NextOfPE = NIL;

23
C/agc.c
View File

@ -194,6 +194,29 @@ AtomAdjust(Atom a)
#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)
{
OldASP = ASP;

View File

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

View File

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