handle learning from interpretations.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1942 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2007-09-28 23:18:17 +00:00
parent f35f5b9253
commit 77f10fe803
9 changed files with 247 additions and 102 deletions

View File

@@ -1281,6 +1281,41 @@ RestoreAtomList(Atom atm)
}
static void
RestoreHashPreds(void)
{
UInt new_size = PredHashTableSize;
PredEntry **oldp = (PredEntry **)AddrAdjust((ADDR)PredHash);
PredEntry **np = (PredEntry **) Yap_AllocAtomSpace(sizeof(PredEntry **)*new_size);
UInt i;
if (!np) {
Yap_Error(FATAL_ERROR,TermNil,"Could not allocate space for pred table");
}
for (i = 0; i < new_size; i++) {
np[i] = NULL;
}
for (i = 0; i < PredHashTableSize; i++) {
PredEntry *p = PredHash[i];
p = PredEntryAdjust(p);
while (p) {
Prop nextp = p->NextOfPE = PropAdjust(p->NextOfPE);
UInt hsh;
CleanCode(p);
hsh = PRED_HASH(p->FunctorOfPred, p->ModuleOfPred, new_size);
p->NextOfPE = AbsPredProp(np[hsh]);
np[hsh] = p;
p = RepPredProp(nextp);
}
}
PredHashTableSize = new_size;
PredHash = np;
Yap_FreeAtomSpace((ADDR)oldp);
}
/*
* This is the really tough part, to restore the whole of the heap
*/
@@ -1302,6 +1337,7 @@ restore_heap(void)
}
INVISIBLECHAIN.Entry = AtomAdjust(INVISIBLECHAIN.Entry);
RestoreAtomList(INVISIBLECHAIN.Entry);
RestoreHashPreds();
RestoreForeignCodeStructure();
RestoreIOStructures();
}