fix restorebb in cases entry key is not an atom (obs from Nicos
Angelopoulos) git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2200 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
92d26f604e
commit
708e69a670
4
C/agc.c
4
C/agc.c
@ -32,7 +32,7 @@ static char SccsId[] = "@(#)agc.c 1.3 3/15/90";
|
|||||||
#define errout Yap_stderr
|
#define errout Yap_stderr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STATIC_PROTO(void RestoreEntries, (PropEntry *));
|
STATIC_PROTO(void RestoreEntries, (PropEntry *, int));
|
||||||
STATIC_PROTO(void CleanCode, (PredEntry *));
|
STATIC_PROTO(void CleanCode, (PredEntry *));
|
||||||
|
|
||||||
static int agc_calls;
|
static int agc_calls;
|
||||||
@ -192,7 +192,7 @@ mark_hash_entry(AtomHashEntry *HashPtr)
|
|||||||
else
|
else
|
||||||
fprintf(errout, "Restoring %s\n", at->StrOfAE);
|
fprintf(errout, "Restoring %s\n", at->StrOfAE);
|
||||||
#endif
|
#endif
|
||||||
RestoreEntries(RepProp(at->PropsOfAE));
|
RestoreEntries(RepProp(at->PropsOfAE), FALSE);
|
||||||
atm = at->NextOfAE;
|
atm = at->NextOfAE;
|
||||||
at = RepAtom(CleanAtomMarkedBit(atm));
|
at = RepAtom(CleanAtomMarkedBit(atm));
|
||||||
} while (!EndOfPAEntr(at));
|
} while (!EndOfPAEntr(at));
|
||||||
|
4
C/save.c
4
C/save.c
@ -113,7 +113,7 @@ STATIC_PROTO(void RestoreDB, (DBEntry *));
|
|||||||
STATIC_PROTO(void CleanClauses, (yamop *, yamop *,PredEntry *));
|
STATIC_PROTO(void CleanClauses, (yamop *, yamop *,PredEntry *));
|
||||||
STATIC_PROTO(void rehash, (CELL *, int, int));
|
STATIC_PROTO(void rehash, (CELL *, int, int));
|
||||||
STATIC_PROTO(void CleanCode, (PredEntry *));
|
STATIC_PROTO(void CleanCode, (PredEntry *));
|
||||||
STATIC_PROTO(void RestoreEntries, (PropEntry *));
|
STATIC_PROTO(void RestoreEntries, (PropEntry *, int));
|
||||||
STATIC_PROTO(void RestoreFreeSpace, (void));
|
STATIC_PROTO(void RestoreFreeSpace, (void));
|
||||||
STATIC_PROTO(void restore_heap, (void));
|
STATIC_PROTO(void restore_heap, (void));
|
||||||
#ifdef DEBUG_RESTORE3
|
#ifdef DEBUG_RESTORE3
|
||||||
@ -1275,7 +1275,7 @@ RestoreAtomList(Atom atm)
|
|||||||
fprintf(errout, "Restoring %s\n", at->StrOfAE);
|
fprintf(errout, "Restoring %s\n", at->StrOfAE);
|
||||||
#endif
|
#endif
|
||||||
at->PropsOfAE = PropAdjust(at->PropsOfAE);
|
at->PropsOfAE = PropAdjust(at->PropsOfAE);
|
||||||
RestoreEntries(RepProp(at->PropsOfAE));
|
RestoreEntries(RepProp(at->PropsOfAE), FALSE);
|
||||||
atm = at->NextOfAE;
|
atm = at->NextOfAE;
|
||||||
at->NextOfAE = atm = AtomAdjust(atm);
|
at->NextOfAE = atm = AtomAdjust(atm);
|
||||||
at = RepAtom(atm);
|
at = RepAtom(atm);
|
||||||
|
35
H/rheap.h
35
H/rheap.h
@ -11,8 +11,11 @@
|
|||||||
* File: rheap.h *
|
* File: rheap.h *
|
||||||
* comments: walk through heap code *
|
* comments: walk through heap code *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2008-04-01 15:31:43 $,$Author: vsc $ *
|
* Last rev: $Date: 2008-04-03 11:34:47 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.91 2008/04/01 15:31:43 vsc
|
||||||
|
* more saved state fixes
|
||||||
|
*
|
||||||
* Revision 1.90 2008/04/01 14:09:43 vsc
|
* Revision 1.90 2008/04/01 14:09:43 vsc
|
||||||
* improve restore
|
* improve restore
|
||||||
*
|
*
|
||||||
@ -243,13 +246,25 @@ AdjustDBTerm(Term trm, Term *p_base)
|
|||||||
return AtomTermAdjust(trm);
|
return AtomTermAdjust(trm);
|
||||||
if (IsPairTerm(trm)) {
|
if (IsPairTerm(trm)) {
|
||||||
Term *p;
|
Term *p;
|
||||||
|
Term out;
|
||||||
|
|
||||||
p = PtoHeapCellAdjust(RepPair(trm));
|
p = PtoHeapCellAdjust(RepPair(trm));
|
||||||
|
out = AbsPair(p);
|
||||||
|
loop:
|
||||||
if (p >= p_base) {
|
if (p >= p_base) {
|
||||||
p[0] = AdjustDBTerm(p[0], p);
|
p[0] = AdjustDBTerm(p[0], p);
|
||||||
p[1] = AdjustDBTerm(p[1], p);
|
if (IsPairTerm(p[1])) {
|
||||||
|
/* avoid term recursion with very deep lists */
|
||||||
|
Term *newp = PtoHeapCellAdjust(RepPair(p[1]));
|
||||||
|
p[1] = AbsPair(newp);
|
||||||
|
p_base = p;
|
||||||
|
p = newp;
|
||||||
|
goto loop;
|
||||||
|
} else {
|
||||||
|
p[1] = AdjustDBTerm(p[1], p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return AbsPair(p);
|
return out;
|
||||||
}
|
}
|
||||||
if (IsApplTerm(trm)) {
|
if (IsApplTerm(trm)) {
|
||||||
Term *p;
|
Term *p;
|
||||||
@ -600,7 +615,7 @@ restore_codes(void)
|
|||||||
for (i = 0; i < Yap_heap_regs->int_keys_size; i++) {
|
for (i = 0; i < Yap_heap_regs->int_keys_size; i++) {
|
||||||
if (Yap_heap_regs->IntKeys[i] != NIL) {
|
if (Yap_heap_regs->IntKeys[i] != NIL) {
|
||||||
Prop p0 = Yap_heap_regs->IntKeys[i] = PropAdjust(Yap_heap_regs->IntKeys[i]);
|
Prop p0 = Yap_heap_regs->IntKeys[i] = PropAdjust(Yap_heap_regs->IntKeys[i]);
|
||||||
RestoreEntries(RepProp(p0));
|
RestoreEntries(RepProp(p0), TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,7 +647,7 @@ restore_codes(void)
|
|||||||
for (i = 0; i < Yap_heap_regs->int_bb_keys_size; i++) {
|
for (i = 0; i < Yap_heap_regs->int_bb_keys_size; i++) {
|
||||||
if (Yap_heap_regs->IntBBKeys[i] != NIL) {
|
if (Yap_heap_regs->IntBBKeys[i] != NIL) {
|
||||||
Prop p0 = Yap_heap_regs->IntBBKeys[i] = PropAdjust(Yap_heap_regs->IntBBKeys[i]);
|
Prop p0 = Yap_heap_regs->IntBBKeys[i] = PropAdjust(Yap_heap_regs->IntBBKeys[i]);
|
||||||
RestoreEntries(RepProp(p0));
|
RestoreEntries(RepProp(p0), TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1004,7 +1019,7 @@ CleanClauses(yamop *First, yamop *Last, PredEntry *pp)
|
|||||||
|
|
||||||
/* Restores a DB structure, as it was saved in the heap */
|
/* Restores a DB structure, as it was saved in the heap */
|
||||||
static void
|
static void
|
||||||
RestoreBB(BlackBoardEntry *pp)
|
RestoreBB(BlackBoardEntry *pp, int int_key)
|
||||||
{
|
{
|
||||||
Term t = pp->Element;
|
Term t = pp->Element;
|
||||||
if (t) {
|
if (t) {
|
||||||
@ -1018,7 +1033,9 @@ RestoreBB(BlackBoardEntry *pp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pp->KeyOfBB = AtomAdjust(pp->KeyOfBB);
|
if (!int_key) {
|
||||||
|
pp->KeyOfBB = AtomAdjust(pp->KeyOfBB);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1247,7 +1264,7 @@ CleanCode(PredEntry *pp)
|
|||||||
* if we find code or data bases
|
* if we find code or data bases
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
RestoreEntries(PropEntry *pp)
|
RestoreEntries(PropEntry *pp, int int_key)
|
||||||
{
|
{
|
||||||
while (!EndOfPAEntr(pp)) {
|
while (!EndOfPAEntr(pp)) {
|
||||||
switch(pp->KindOfPE) {
|
switch(pp->KindOfPE) {
|
||||||
@ -1339,7 +1356,7 @@ RestoreEntries(PropEntry *pp)
|
|||||||
BlackBoardEntry *bb = (BlackBoardEntry *) pp;
|
BlackBoardEntry *bb = (BlackBoardEntry *) pp;
|
||||||
bb->NextOfPE =
|
bb->NextOfPE =
|
||||||
PropAdjust(bb->NextOfPE);
|
PropAdjust(bb->NextOfPE);
|
||||||
RestoreBB(bb);
|
RestoreBB(bb, int_key);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GlobalProperty:
|
case GlobalProperty:
|
||||||
|
Reference in New Issue
Block a user