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:
parent
819ef79f4a
commit
0c4388a66b
@ -12,7 +12,7 @@
|
|||||||
* Last rev: *
|
* Last rev: *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: allocating space *
|
* 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
|
#ifdef SCCS
|
||||||
static char SccsId[] = "%W% %G%";
|
static char SccsId[] = "%W% %G%";
|
||||||
@ -743,7 +743,7 @@ InitWorkSpace(Int s)
|
|||||||
Yap_page_size = si.dwPageSize;
|
Yap_page_size = si.dwPageSize;
|
||||||
s = ((s+ (YAP_ALLOC_SIZE-1))/YAP_ALLOC_SIZE)*YAP_ALLOC_SIZE;
|
s = ((s+ (YAP_ALLOC_SIZE-1))/YAP_ALLOC_SIZE)*YAP_ALLOC_SIZE;
|
||||||
brk = (LPVOID)Yap_page_size;
|
brk = (LPVOID)Yap_page_size;
|
||||||
if (!ExtendWorkSpace(s,0))
|
if (!ExtendWorkSpace(s+1024*1024,0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return (MALLOC_T)brk-s;
|
return (MALLOC_T)brk-s;
|
||||||
}
|
}
|
||||||
@ -1358,6 +1358,7 @@ Yap_InitMemory(int Trail, int Heap, int Stack)
|
|||||||
sa = Stack; /* stack area size */
|
sa = Stack; /* stack area size */
|
||||||
ta = Trail; /* trail area size */
|
ta = Trail; /* trail area size */
|
||||||
|
|
||||||
|
pm += 1024*1024;
|
||||||
InitHeap(InitWorkSpace(pm));
|
InitHeap(InitWorkSpace(pm));
|
||||||
|
|
||||||
Yap_TrailTop = Yap_HeapBase + pm;
|
Yap_TrailTop = Yap_HeapBase + pm;
|
||||||
|
23
C/stdpreds.c
23
C/stdpreds.c
@ -11,8 +11,11 @@
|
|||||||
* File: stdpreds.c *
|
* File: stdpreds.c *
|
||||||
* comments: General-purpose C implemented system predicates *
|
* 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 $
|
* $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
|
* Revision 1.128 2008/02/15 12:41:33 vsc
|
||||||
* more fixes to modules
|
* more fixes to modules
|
||||||
*
|
*
|
||||||
@ -2669,7 +2672,7 @@ cont_current_predicate(void)
|
|||||||
cut_fail();
|
cut_fail();
|
||||||
EXTRA_CBACK_ARG(3,1) = (CELL)MkIntegerTerm((Int)(pp->NextPredOfModule));
|
EXTRA_CBACK_ARG(3,1) = (CELL)MkIntegerTerm((Int)(pp->NextPredOfModule));
|
||||||
if (pp->FunctorOfPred == FunctorModule)
|
if (pp->FunctorOfPred == FunctorModule)
|
||||||
return(FALSE);
|
return FALSE;
|
||||||
if (pp->ModuleOfPred != IDB_MODULE) {
|
if (pp->ModuleOfPred != IDB_MODULE) {
|
||||||
Arity = pp->ArityOfPE;
|
Arity = pp->ArityOfPE;
|
||||||
if (Arity)
|
if (Arity)
|
||||||
@ -2689,8 +2692,9 @@ cont_current_predicate(void)
|
|||||||
Arity = ArityOfFunctor(f);
|
Arity = ArityOfFunctor(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (Yap_unify(ARG2,name) &&
|
return
|
||||||
Yap_unify(ARG3, MkIntegerTerm((Int)Arity)));
|
Yap_unify(ARG2,name) &&
|
||||||
|
Yap_unify(ARG3, MkIntegerTerm((Int)Arity));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
@ -2700,7 +2704,7 @@ init_current_predicate(void)
|
|||||||
|
|
||||||
if (IsVarTerm(t1) || !IsAtomTerm(t1)) cut_fail();
|
if (IsVarTerm(t1) || !IsAtomTerm(t1)) cut_fail();
|
||||||
EXTRA_CBACK_ARG(3,1) = MkIntegerTerm((Int)Yap_ModulePred(t1));
|
EXTRA_CBACK_ARG(3,1) = MkIntegerTerm((Int)Yap_ModulePred(t1));
|
||||||
return (cont_current_predicate());
|
return cont_current_predicate();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
@ -2718,8 +2722,9 @@ cont_current_predicate_for_atom(void)
|
|||||||
if (p->ModuleOfPred == mod ||
|
if (p->ModuleOfPred == mod ||
|
||||||
p->ModuleOfPred == 0) {
|
p->ModuleOfPred == 0) {
|
||||||
/* we found the predicate */
|
/* we found the predicate */
|
||||||
EXTRA_CBACK_ARG(3,1) = (CELL)MkIntegerTerm((Int)(pp->NextOfPE));
|
EXTRA_CBACK_ARG(3,1) = MkIntegerTerm((Int)(pp->NextOfPE));
|
||||||
return(Yap_unify(ARG3,Yap_MkNewApplTerm(p->FunctorOfPred,p->ArityOfPE)));
|
return
|
||||||
|
Yap_unify(ARG3,Yap_MkNewApplTerm(p->FunctorOfPred,p->ArityOfPE));
|
||||||
}
|
}
|
||||||
p0 = p->NextOfPE;
|
p0 = p->NextOfPE;
|
||||||
}
|
}
|
||||||
@ -2728,8 +2733,8 @@ cont_current_predicate_for_atom(void)
|
|||||||
if (pe->ModuleOfPred == mod ||
|
if (pe->ModuleOfPred == mod ||
|
||||||
pe->ModuleOfPred == 0) {
|
pe->ModuleOfPred == 0) {
|
||||||
/* we found the predicate */
|
/* we found the predicate */
|
||||||
EXTRA_CBACK_ARG(3,1) = (CELL)MkIntegerTerm((Int)(pp->NextOfPE));
|
EXTRA_CBACK_ARG(3,1) = MkIntegerTerm((Int)(pp->NextOfPE));
|
||||||
return(Yap_unify(ARG3,MkAtomTerm((Atom)(pe->FunctorOfPred))));
|
return Yap_unify(ARG3,MkAtomTerm((Atom)(pe->FunctorOfPred)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pf = pp->NextOfPE;
|
pf = pp->NextOfPE;
|
||||||
|
20
H/rheap.h
20
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-04 09:10:02 $,$Author: vsc $ *
|
* Last rev: $Date: 2008-04-06 11:53:02 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $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
|
* Revision 1.92 2008/04/03 11:34:47 vsc
|
||||||
* fix restorebb in cases entry key is not an atom (obs from Nicos
|
* fix restorebb in cases entry key is not an atom (obs from Nicos
|
||||||
* Angelopoulos)
|
* Angelopoulos)
|
||||||
@ -1217,6 +1220,9 @@ CleanCode(PredEntry *pp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pp->OpcodeOfPred = Yap_opcode(Yap_op_from_opcode(pp->OpcodeOfPred));
|
pp->OpcodeOfPred = Yap_opcode(Yap_op_from_opcode(pp->OpcodeOfPred));
|
||||||
|
if (pp->NextPredOfModule) {
|
||||||
|
pp->NextPredOfModule = PtoPredAdjust(pp->NextPredOfModule);
|
||||||
|
}
|
||||||
if (pp->PredFlags & (AsmPredFlag|CPredFlag)) {
|
if (pp->PredFlags & (AsmPredFlag|CPredFlag)) {
|
||||||
/* assembly */
|
/* assembly */
|
||||||
if (pp->CodeOfPred) {
|
if (pp->CodeOfPred) {
|
||||||
@ -1233,8 +1239,6 @@ CleanCode(PredEntry *pp)
|
|||||||
pp->CodeOfPred =PtoOpAdjust(pp->CodeOfPred);
|
pp->CodeOfPred =PtoOpAdjust(pp->CodeOfPred);
|
||||||
pp->cs.p_code.TrueCodeOfPred = PtoOpAdjust(pp->cs.p_code.TrueCodeOfPred);
|
pp->cs.p_code.TrueCodeOfPred = PtoOpAdjust(pp->cs.p_code.TrueCodeOfPred);
|
||||||
pp->cs.p_code.ExpandCode = Yap_opcode(_expand_index);
|
pp->cs.p_code.ExpandCode = Yap_opcode(_expand_index);
|
||||||
if (pp->NextPredOfModule)
|
|
||||||
pp->NextPredOfModule = PtoPredAdjust(pp->NextPredOfModule);
|
|
||||||
flag = pp->PredFlags;
|
flag = pp->PredFlags;
|
||||||
FirstC = pp->cs.p_code.FirstClause;
|
FirstC = pp->cs.p_code.FirstClause;
|
||||||
LastC = pp->cs.p_code.LastClause;
|
LastC = pp->cs.p_code.LastClause;
|
||||||
@ -1409,10 +1413,14 @@ RestoreEntries(PropEntry *pp, int int_key)
|
|||||||
case ModProperty:
|
case ModProperty:
|
||||||
{
|
{
|
||||||
ModEntry *me = (ModEntry *)pp;
|
ModEntry *me = (ModEntry *)pp;
|
||||||
me->NextOfPE =
|
if (me->NextOfPE) {
|
||||||
PropAdjust(me->NextOfPE);
|
me->NextOfPE =
|
||||||
me->PredForME =
|
PropAdjust(me->NextOfPE);
|
||||||
|
}
|
||||||
|
if (me->PredForME) {
|
||||||
|
me->PredForME =
|
||||||
PtoPredAdjust(me->PredForME);
|
PtoPredAdjust(me->PredForME);
|
||||||
|
}
|
||||||
me->AtomOfME =
|
me->AtomOfME =
|
||||||
AtomAdjust(me->AtomOfME);
|
AtomAdjust(me->AtomOfME);
|
||||||
me->NextME = (struct mod_entry *)
|
me->NextME = (struct mod_entry *)
|
||||||
|
Reference in New Issue
Block a user