updates to restore

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2234 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2008-05-12 14:04:23 +00:00
parent 257c3a2cbc
commit f4173813ff
6 changed files with 55 additions and 25 deletions

View File

@ -116,6 +116,7 @@ AtomAdjust(Atom a)
#define CharP(X) ((char *)(X))
#define AddrAdjust(P) (P)
#define CodeVarAdjust(P) (P)
#define MFileAdjust(P) (P)
#define PredEntryAdjust(P) (P)
#define AtomEntryAdjust(P) (P)

View File

@ -1618,6 +1618,7 @@ RestoreHeap(OPCODE old_ops[])
#endif
/* opcodes_moved has side-effects and should be tried first */
if (heap_moved) {
opcodes_moved = TRUE;
RestoreFreeSpace();
}
if (heap_moved || opcodes_moved) {

View File

@ -10,7 +10,7 @@
* File: Yap.h.m4 *
* mods: *
* comments: main header file for YAP *
* version: $Id: Yap.h,v 1.33 2008-04-02 17:37:06 vsc Exp $ *
* version: $Id: Yap.h,v 1.34 2008-05-12 14:04:23 vsc Exp $ *
*************************************************************************/
#include "config.h"
@ -243,7 +243,7 @@ extern char Yap_Option[20];
#elif defined(__APPLE__) && !__LP64__
#define MMAP_ADDR 0x20000000
#else
#define MMAP_ADDR 0x08800000
#define MMAP_ADDR 0x08c00000
#endif
#elif __svr4__ || defined(__SVR4)
#define MMAP_ADDR 0x02000000

View File

@ -12,8 +12,11 @@
* File: rclause.h *
* comments: walk through a clause *
* *
* Last rev: $Date: 2008-04-01 08:42:46 $,$Author: vsc $ *
* Last rev: $Date: 2008-05-12 14:04:23 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.25 2008/04/01 08:42:46 vsc
* fix restore and small VISTA thingies
*
* Revision 1.24 2008/03/25 22:03:14 vsc
* fix some icc warnings
*
@ -404,7 +407,6 @@ restore_opcodes(yamop *pc)
case _p_execute_tail:
case _p_execute:
case _p_execute2:
pc->u.sla.sla_u.p = PtoPredAdjust(pc->u.sla.sla_u.p);
if (pc->u.sla.sla_u.mod != 0) {
if (IsAtomTerm(pc->u.sla.sla_u.mod))
pc->u.sla.sla_u.mod = AtomTermAdjust(pc->u.sla.sla_u.mod);

View File

@ -11,8 +11,11 @@
* File: rheap.h *
* comments: walk through heap code *
* *
* Last rev: $Date: 2008-04-11 16:58:17 $,$Author: ricroc $ *
* Last rev: $Date: 2008-05-12 14:04:23 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.96 2008/04/11 16:58:17 ricroc
* yapor: seq_def initialization
*
* Revision 1.95 2008/04/06 12:06:48 vsc
* more small fixes
*
@ -255,8 +258,10 @@ do_clean_susp_clauses(yamop *ipc) {
static Term
AdjustDBTerm(Term trm, Term *p_base)
{
if (IsAtomTerm(trm))
if (IsVarTerm(trm))
return AtomTermAdjust(trm);
if (IsAtomTerm(trm))
return CodeVarAdjust(trm);
if (IsPairTerm(trm)) {
Term *p;
Term out;
@ -424,7 +429,7 @@ RestoreDBTermEntry(struct dbterm_list *dbl) {
}
static void
CleanLUIndex(LogUpdIndex *idx)
CleanLUIndex(LogUpdIndex *idx, int recurse)
{
INIT_LOCK(idx->ClLock);
idx->ClPred = PtoPredAdjust(idx->ClPred);
@ -435,11 +440,13 @@ CleanLUIndex(LogUpdIndex *idx)
}
if (idx->SiblingIndex) {
idx->SiblingIndex = LUIndexAdjust(idx->SiblingIndex);
CleanLUIndex(idx->SiblingIndex);
if (recurse)
CleanLUIndex(idx->SiblingIndex, TRUE);
}
if (idx->ChildIndex) {
idx->ChildIndex = LUIndexAdjust(idx->ChildIndex);
CleanLUIndex(idx->ChildIndex);
if (recurse)
CleanLUIndex(idx->ChildIndex, TRUE);
}
if (!(idx->ClFlags & SwitchTableMask)) {
restore_opcodes(idx->ClCode);
@ -447,16 +454,18 @@ CleanLUIndex(LogUpdIndex *idx)
}
static void
CleanSIndex(StaticIndex *idx)
CleanSIndex(StaticIndex *idx, int recurse)
{
idx->ClPred = PtoPredAdjust(idx->ClPred);
if (idx->SiblingIndex) {
idx->SiblingIndex = SIndexAdjust(idx->SiblingIndex);
CleanSIndex(idx->SiblingIndex);
if (recurse)
CleanSIndex(idx->SiblingIndex, TRUE);
}
if (idx->ChildIndex) {
idx->ChildIndex = SIndexAdjust(idx->ChildIndex);
CleanSIndex(idx->ChildIndex);
if (recurse)
CleanSIndex(idx->ChildIndex, TRUE);
}
if (!(idx->ClFlags & SwitchTableMask)) {
restore_opcodes(idx->ClCode);
@ -614,7 +623,7 @@ restore_codes(void)
StaticIndex *si = (StaticIndex *)AddrAdjust((ADDR)(Yap_heap_regs->dead_static_indices));
Yap_heap_regs->dead_static_indices = si;
while (si) {
CleanSIndex(si);
CleanSIndex(si, FALSE);
si = si->SiblingIndex;
}
}
@ -666,6 +675,22 @@ restore_codes(void)
}
}
}
if (Yap_heap_regs->db_erased_list) {
LogUpdClause *lcl = Yap_heap_regs->db_erased_list =
PtoLUCAdjust(Yap_heap_regs->db_erased_list);
while (lcl) {
RestoreLUClause(lcl, FALSE);
lcl = lcl->ClNext;
}
}
if (Yap_heap_regs->db_erased_ilist) {
LogUpdIndex *icl = Yap_heap_regs->db_erased_ilist =
LUIndexAdjust(Yap_heap_regs->db_erased_ilist);
while (icl) {
CleanLUIndex(icl, FALSE);
icl = icl->SiblingIndex;
}
}
Yap_heap_regs->atom_abol = AtomAdjust(Yap_heap_regs->atom_abol);
Yap_heap_regs->atom_append = AtomAdjust(Yap_heap_regs->atom_append);
Yap_heap_regs->atom_array = AtomAdjust(Yap_heap_regs->atom_array);
@ -851,16 +876,6 @@ restore_codes(void)
PredEntryAdjust(Yap_heap_regs->pred_throw);
Yap_heap_regs->pred_handle_throw =
PredEntryAdjust(Yap_heap_regs->pred_handle_throw);
#ifdef DEBUG
if (Yap_heap_regs->db_erased_list) {
Yap_heap_regs->db_erased_list =
PtoLUCAdjust(Yap_heap_regs->db_erased_list);
}
if (Yap_heap_regs->db_erased_ilist) {
Yap_heap_regs->db_erased_ilist =
LUIndexAdjust(Yap_heap_regs->db_erased_ilist);
}
#endif
if (Yap_heap_regs->undef_code != NULL)
Yap_heap_regs->undef_code = (PredEntry *)PtoHeapCellAdjust((CELL *)(Yap_heap_regs->undef_code));
if (Yap_heap_regs->creep_code != NULL)
@ -1050,6 +1065,9 @@ RestoreBB(BlackBoardEntry *pp, int int_key)
if (!int_key) {
pp->KeyOfBB = AtomAdjust(pp->KeyOfBB);
}
if (pp->ModuleOfBB) {
pp->ModuleOfBB = AtomTermAdjust(pp->ModuleOfBB);
}
}
static void
@ -1262,9 +1280,9 @@ CleanCode(PredEntry *pp)
fprintf(stderr, "Correcting indexed code\n");
#endif
if (flag & LogUpdatePredFlag) {
CleanLUIndex(ClauseCodeToLogUpdIndex(pp->cs.p_code.TrueCodeOfPred));
CleanLUIndex(ClauseCodeToLogUpdIndex(pp->cs.p_code.TrueCodeOfPred), TRUE);
} else {
CleanSIndex(ClauseCodeToStaticIndex(pp->cs.p_code.TrueCodeOfPred));
CleanSIndex(ClauseCodeToStaticIndex(pp->cs.p_code.TrueCodeOfPred), TRUE);
}
} else if (flag & DynamicPredFlag) {
#ifdef DEBUG_RESTORE2

View File

@ -328,6 +328,14 @@ AtomTermAdjust (Term at)
return at + HDiff;
}
inline EXTERN Term CodeVarAdjust (Term);
inline EXTERN Term
CodeVarAdjust (Term var)
{
return var + HDiff;
}
#if TAGS_FAST_OPS