fix some restore bugs

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2212 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2008-04-06 11:53:02 +00:00
parent 819ef79f4a
commit 0c4388a66b
3 changed files with 31 additions and 17 deletions

View File

@ -12,7 +12,7 @@
* Last rev: *
* mods: *
* comments: allocating space *
* version:$Id: alloc.c,v 1.92 2008-04-02 17:37:05 vsc Exp $ *
* version:$Id: alloc.c,v 1.93 2008-04-06 11:53:02 vsc Exp $ *
*************************************************************************/
#ifdef SCCS
static char SccsId[] = "%W% %G%";
@ -743,7 +743,7 @@ InitWorkSpace(Int s)
Yap_page_size = si.dwPageSize;
s = ((s+ (YAP_ALLOC_SIZE-1))/YAP_ALLOC_SIZE)*YAP_ALLOC_SIZE;
brk = (LPVOID)Yap_page_size;
if (!ExtendWorkSpace(s,0))
if (!ExtendWorkSpace(s+1024*1024,0))
return FALSE;
return (MALLOC_T)brk-s;
}
@ -1358,6 +1358,7 @@ Yap_InitMemory(int Trail, int Heap, int Stack)
sa = Stack; /* stack area size */
ta = Trail; /* trail area size */
pm += 1024*1024;
InitHeap(InitWorkSpace(pm));
Yap_TrailTop = Yap_HeapBase + pm;

View File

@ -11,8 +11,11 @@
* File: stdpreds.c *
* comments: General-purpose C implemented system predicates *
* *
* Last rev: $Date: 2008-03-15 12:19:33 $,$Author: vsc $ *
* Last rev: $Date: 2008-04-06 11:53:02 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.129 2008/03/15 12:19:33 vsc
* fix flags
*
* Revision 1.128 2008/02/15 12:41:33 vsc
* more fixes to modules
*
@ -2669,7 +2672,7 @@ cont_current_predicate(void)
cut_fail();
EXTRA_CBACK_ARG(3,1) = (CELL)MkIntegerTerm((Int)(pp->NextPredOfModule));
if (pp->FunctorOfPred == FunctorModule)
return(FALSE);
return FALSE;
if (pp->ModuleOfPred != IDB_MODULE) {
Arity = pp->ArityOfPE;
if (Arity)
@ -2689,8 +2692,9 @@ cont_current_predicate(void)
Arity = ArityOfFunctor(f);
}
}
return (Yap_unify(ARG2,name) &&
Yap_unify(ARG3, MkIntegerTerm((Int)Arity)));
return
Yap_unify(ARG2,name) &&
Yap_unify(ARG3, MkIntegerTerm((Int)Arity));
}
static Int
@ -2700,7 +2704,7 @@ init_current_predicate(void)
if (IsVarTerm(t1) || !IsAtomTerm(t1)) cut_fail();
EXTRA_CBACK_ARG(3,1) = MkIntegerTerm((Int)Yap_ModulePred(t1));
return (cont_current_predicate());
return cont_current_predicate();
}
static Int
@ -2718,8 +2722,9 @@ cont_current_predicate_for_atom(void)
if (p->ModuleOfPred == mod ||
p->ModuleOfPred == 0) {
/* we found the predicate */
EXTRA_CBACK_ARG(3,1) = (CELL)MkIntegerTerm((Int)(pp->NextOfPE));
return(Yap_unify(ARG3,Yap_MkNewApplTerm(p->FunctorOfPred,p->ArityOfPE)));
EXTRA_CBACK_ARG(3,1) = MkIntegerTerm((Int)(pp->NextOfPE));
return
Yap_unify(ARG3,Yap_MkNewApplTerm(p->FunctorOfPred,p->ArityOfPE));
}
p0 = p->NextOfPE;
}
@ -2728,8 +2733,8 @@ cont_current_predicate_for_atom(void)
if (pe->ModuleOfPred == mod ||
pe->ModuleOfPred == 0) {
/* we found the predicate */
EXTRA_CBACK_ARG(3,1) = (CELL)MkIntegerTerm((Int)(pp->NextOfPE));
return(Yap_unify(ARG3,MkAtomTerm((Atom)(pe->FunctorOfPred))));
EXTRA_CBACK_ARG(3,1) = MkIntegerTerm((Int)(pp->NextOfPE));
return Yap_unify(ARG3,MkAtomTerm((Atom)(pe->FunctorOfPred)));
}
}
pf = pp->NextOfPE;

View File

@ -11,8 +11,11 @@
* File: rheap.h *
* comments: walk through heap code *
* *
* Last rev: $Date: 2008-04-04 09:10:02 $,$Author: vsc $ *
* Last rev: $Date: 2008-04-06 11:53:02 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.93 2008/04/04 09:10:02 vsc
* restore was restoring twice
*
* Revision 1.92 2008/04/03 11:34:47 vsc
* fix restorebb in cases entry key is not an atom (obs from Nicos
* Angelopoulos)
@ -1217,6 +1220,9 @@ CleanCode(PredEntry *pp)
}
}
pp->OpcodeOfPred = Yap_opcode(Yap_op_from_opcode(pp->OpcodeOfPred));
if (pp->NextPredOfModule) {
pp->NextPredOfModule = PtoPredAdjust(pp->NextPredOfModule);
}
if (pp->PredFlags & (AsmPredFlag|CPredFlag)) {
/* assembly */
if (pp->CodeOfPred) {
@ -1233,8 +1239,6 @@ CleanCode(PredEntry *pp)
pp->CodeOfPred =PtoOpAdjust(pp->CodeOfPred);
pp->cs.p_code.TrueCodeOfPred = PtoOpAdjust(pp->cs.p_code.TrueCodeOfPred);
pp->cs.p_code.ExpandCode = Yap_opcode(_expand_index);
if (pp->NextPredOfModule)
pp->NextPredOfModule = PtoPredAdjust(pp->NextPredOfModule);
flag = pp->PredFlags;
FirstC = pp->cs.p_code.FirstClause;
LastC = pp->cs.p_code.LastClause;
@ -1409,10 +1413,14 @@ RestoreEntries(PropEntry *pp, int int_key)
case ModProperty:
{
ModEntry *me = (ModEntry *)pp;
if (me->NextOfPE) {
me->NextOfPE =
PropAdjust(me->NextOfPE);
}
if (me->PredForME) {
me->PredForME =
PtoPredAdjust(me->PredForME);
}
me->AtomOfME =
AtomAdjust(me->AtomOfME);
me->NextME = (struct mod_entry *)