fix max modules limitation

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1865 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2007-04-10 22:13:21 +00:00
parent c78a210afc
commit 67738fbbd1
14 changed files with 226 additions and 140 deletions

View File

@ -10,8 +10,11 @@
* * * *
* File: absmi.c * * File: absmi.c *
* comments: Portable abstract machine interpreter * * comments: Portable abstract machine interpreter *
* Last rev: $Date: 2007-03-21 18:32:49 $,$Author: vsc $ * * Last rev: $Date: 2007-04-10 22:13:20 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.220 2007/03/21 18:32:49 vsc
* fix memory expansion bugs.
*
* Revision 1.219 2007/01/24 09:57:25 vsc * Revision 1.219 2007/01/24 09:57:25 vsc
* fix glist_void_varx * fix glist_void_varx
* *
@ -708,38 +711,50 @@ Yap_absmi(int inp)
#endif /* USE_THREADED_CODE */ #endif /* USE_THREADED_CODE */
noheapleft: noheapleft:
saveregs(); {
if (!Yap_growheap(FALSE, 0, NULL)) { CELL cut_b = LCL0-(CELL *)(SREG[E_CB]);
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
saveregs();
if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
setregs();
FAIL();
}
setregs(); setregs();
FAIL(); CACHE_A1();
SREG = ASP;
SREG[E_CB] = (CELL)(LCL0-cut_b);
} }
setregs();
CACHE_A1();
goto reset_absmi; goto reset_absmi;
#if !OS_HANDLES_TR_OVERFLOW #if !OS_HANDLES_TR_OVERFLOW
notrailleft: notrailleft:
/* if we are within indexing code, the system may have to /* if we are within indexing code, the system may have to
* update a S */ * update a S */
{
CELL cut_b = LCL0-(CELL *)(SREG[E_CB]);
#if SHADOW_S #if SHADOW_S
S = SREG; S = SREG;
#endif #endif
/* YREG =was pointing to where we were going to build the /* YREG =was pointing to where we were going to build the
* next choice-point. The stack shifter will need to know this * next choice-point. The stack shifter will need to know this
* to move the local stack */ * to move the local stack */
if (YREG > (CELL *) PROTECT_FROZEN_B(B)) { if (YREG > (CELL *) PROTECT_FROZEN_B(B)) {
ASP = (CELL *) PROTECT_FROZEN_B(B); ASP = (CELL *) PROTECT_FROZEN_B(B);
} else { } else {
ASP = YREG+E_CB; ASP = YREG+E_CB;
} }
saveregs(); saveregs();
if(!Yap_growtrail (0, FALSE)) { if(!Yap_growtrail (0, FALSE)) {
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * 16 * 1024L); Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * 16 * 1024L);
setregs();
FAIL();
}
setregs(); setregs();
FAIL(); SREG = ASP;
SREG[E_CB] = (CELL)(LCL0-cut_b);
} }
setregs();
goto reset_absmi; goto reset_absmi;
#endif /* OS_HANDLES_TR_OVERFLOW */ #endif /* OS_HANDLES_TR_OVERFLOW */

View File

@ -11,8 +11,11 @@
* File: cdmgr.c * * File: cdmgr.c *
* comments: Code manager * * comments: Code manager *
* * * *
* Last rev: $Date: 2007-03-26 15:18:43 $,$Author: vsc $ * * Last rev: $Date: 2007-04-10 22:13:20 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.205 2007/03/26 15:18:43 vsc
* debugging and clause/3 over tabled predicates would kill YAP.
*
* Revision 1.204 2007/01/25 22:11:55 vsc * Revision 1.204 2007/01/25 22:11:55 vsc
* all/3 should fail on no solutions. * all/3 should fail on no solutions.
* get rid of annoying gcc complaints. * get rid of annoying gcc complaints.
@ -3637,23 +3640,21 @@ code_in_pred(PredEntry *pp, Atom *pat, UInt *parity, yamop *codeptr) {
static Int static Int
PredForCode(yamop *codeptr, Atom *pat, UInt *parity, Term *pmodule) { PredForCode(yamop *codeptr, Atom *pat, UInt *parity, Term *pmodule) {
Int found = 0; Int found = 0;
Int i_table; ModEntry *me = CurrentModules;
/* should we allow the user to see hidden predicates? */ /* should we allow the user to see hidden predicates? */
for (i_table = 0; i_table < NoOfModules; i_table++) { while (me) {
PredEntry *pp; PredEntry *pp;
pp = ModulePred[i_table]; pp = me->PredForME;
while (pp != NULL) { while (pp != NULL) {
if ((found = code_in_pred(pp, pat, parity, codeptr)) != 0) { if ((found = code_in_pred(pp, pat, parity, codeptr)) != 0) {
if (i_table) *pmodule = MkAtomTerm(me->AtomOfME);
*pmodule = ModuleName[i_table]; return found;
else
*pmodule = TermProlog;
return(found);
} }
pp = pp->NextPredOfModule; pp = pp->NextPredOfModule;
} }
me = me->NextME;
} }
return(0); return(0);
} }
@ -3669,7 +3670,7 @@ Yap_PredForCode(yamop *codeptr, find_pred_type where_from, Atom *pat, UInt *pari
if (p) { if (p) {
Int out; Int out;
if (p->ModuleOfPred == PROLOG_MODULE) if (p->ModuleOfPred == PROLOG_MODULE)
*pmodule = ModuleName[0]; *pmodule = TermProlog;
else else
*pmodule = p->ModuleOfPred; *pmodule = p->ModuleOfPred;
out = find_code_in_clause(p, codeptr, NULL, NULL); out = find_code_in_clause(p, codeptr, NULL, NULL);
@ -3684,7 +3685,7 @@ Yap_PredForCode(yamop *codeptr, find_pred_type where_from, Atom *pat, UInt *pari
} }
clause_was_found(p, pat, parity); clause_was_found(p, pat, parity);
if (p->ModuleOfPred == PROLOG_MODULE) if (p->ModuleOfPred == PROLOG_MODULE)
*pmodule = ModuleName[0]; *pmodule = TermProlog;
else else
*pmodule = p->ModuleOfPred; *pmodule = p->ModuleOfPred;
return -1; return -1;
@ -5532,10 +5533,11 @@ add_code_in_pred(PredEntry *pp) {
void void
Yap_dump_code_area_for_profiler(void) { Yap_dump_code_area_for_profiler(void) {
Int i_table; ModEntry *me = CurrentModules;
while (me) {
PredEntry *pp = me->PredForME;
for (i_table = NoOfModules-1; i_table >= 0; --i_table) {
PredEntry *pp = ModulePred[i_table];
while (pp != NULL) { while (pp != NULL) {
/* if (pp->ArityOfPE) { /* if (pp->ArityOfPE) {
fprintf(stderr,"%s/%d %p\n", fprintf(stderr,"%s/%d %p\n",
@ -5550,6 +5552,7 @@ Yap_dump_code_area_for_profiler(void) {
add_code_in_pred(pp); add_code_in_pred(pp);
pp = pp->NextPredOfModule; pp = pp->NextPredOfModule;
} }
me = me->NextME;
} }
Yap_inform_profiler_of_clause(COMMA_CODE, FAILCODE, RepPredProp(Yap_GetPredPropByFunc(FunctorComma,0)),0); Yap_inform_profiler_of_clause(COMMA_CODE, FAILCODE, RepPredProp(Yap_GetPredPropByFunc(FunctorComma,0)),0);
Yap_inform_profiler_of_clause(FAILCODE, FAILCODE+1, RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)),0); Yap_inform_profiler_of_clause(FAILCODE, FAILCODE+1, RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)),0);

View File

@ -11,8 +11,11 @@
* File: gprof.c * * File: gprof.c *
* comments: Interrupt Driven Profiler * * comments: Interrupt Driven Profiler *
* * * *
* Last rev: $Date: 2006-08-22 16:12:45 $,$Author: vsc $ * * Last rev: $Date: 2007-04-10 22:13:20 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.7 2006/08/22 16:12:45 vsc
* global variables
*
* Revision 1.6 2006/08/07 18:51:44 vsc * Revision 1.6 2006/08/07 18:51:44 vsc
* fix garbage collector not to try to garbage collect when we ask for large * fix garbage collector not to try to garbage collect when we ask for large
* chunks of stack in a single go. * chunks of stack in a single go.
@ -1270,7 +1273,7 @@ static Int getpredinfo(void)
if (!pp) if (!pp)
return FALSE; return FALSE;
if (pp->ModuleOfPred == PROLOG_MODULE) if (pp->ModuleOfPred == PROLOG_MODULE)
mod = ModuleName[0]; mod = TermProlog;
else else
mod = pp->ModuleOfPred; mod = pp->ModuleOfPred;
if (pp->ModuleOfPred == IDB_MODULE) { if (pp->ModuleOfPred == IDB_MODULE) {

View File

@ -3728,6 +3728,8 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
static int static int
is_gc_verbose(void) is_gc_verbose(void)
{ {
if (Yap_PrologMode == BootMode)
return FALSE;
#ifdef INSTRUMENT_GC #ifdef INSTRUMENT_GC
/* always give info when we are debugging gc */ /* always give info when we are debugging gc */
return(TRUE); return(TRUE);
@ -3746,7 +3748,9 @@ Yap_is_gc_verbose(void)
static int static int
is_gc_very_verbose(void) is_gc_very_verbose(void)
{ {
return(Yap_GetValue(AtomGcVeryVerbose) != TermNil); if (Yap_PrologMode == BootMode)
return FALSE;
return Yap_GetValue(AtomGcVeryVerbose) != TermNil;
} }
Int Int

View File

@ -2312,7 +2312,7 @@ p_open (void)
st->stream_wgetc_for_read = st->stream_wgetc; st->stream_wgetc_for_read = st->stream_wgetc;
t = MkStream (sno); t = MkStream (sno);
if (open_mode == AtomWrite ) { if (open_mode == AtomWrite ) {
if (!avoid_bom && !write_bom(sno,st)) if (needs_bom && !write_bom(sno,st))
return FALSE; return FALSE;
} else if (open_mode == AtomRead && } else if (open_mode == AtomRead &&
!avoid_bom && !avoid_bom &&

View File

@ -25,6 +25,60 @@ static char SccsId[] = "%W% %G%";
STATIC_PROTO(Int p_current_module, (void)); STATIC_PROTO(Int p_current_module, (void));
STATIC_PROTO(Int p_current_module1, (void)); STATIC_PROTO(Int p_current_module1, (void));
inline static ModEntry *
FetchModuleEntry(Atom at)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
AtomEntry *ae = RepAtom(at);
WRITE_LOCK(ae->ARWLock);
p0 = ae->PropsOfAE;
while (p0) {
ModEntry *me = RepModProp(p0);
if ( me->KindOfPE == ModProperty
) {
WRITE_UNLOCK(ae->ARWLock);
return me;
}
p0 = me->NextOfPE;
}
return NULL;
}
inline static ModEntry *
GetModuleEntry(Atom at)
/* get predicate entry for ap/arity; create it if neccessary. */
{
Prop p0;
AtomEntry *ae = RepAtom(at);
ModEntry *new;
WRITE_LOCK(ae->ARWLock);
p0 = ae->PropsOfAE;
while (p0) {
ModEntry *me = RepModProp(p0);
if ( me->KindOfPE == ModProperty
) {
WRITE_UNLOCK(ae->ARWLock);
return me;
}
p0 = me->NextOfPE;
}
new = (ModEntry *) Yap_AllocAtomSpace(sizeof(*new));
INIT_RWLOCK(new->GRWLock);
new->KindOfPE = ModProperty;
new->NextME = CurrentModules;
CurrentModules = new;
new->AtomOfME = ae;
new->NextOfPE = ae->PropsOfAE;
ae->PropsOfAE = AbsModProp(new);
WRITE_UNLOCK(ae->ARWLock);
return new;
}
#define ByteAdr(X) ((char *) &(X)) #define ByteAdr(X) ((char *) &(X))
Term Term
Yap_Module_Name(PredEntry *ap) Yap_Module_Name(PredEntry *ap)
@ -46,47 +100,44 @@ Yap_Module_Name(PredEntry *ap)
return TermProlog; return TermProlog;
} }
static int static ModEntry *
LookupModule(Term a) LookupModule(Term a)
{ {
unsigned int i; Atom at;
/* prolog module */ /* prolog module */
if (a == 0) if (a == 0)
return 0; return GetModuleEntry(AtomOfTerm(TermProlog));
LOCK(ModulesLock); at = AtomOfTerm(a);
for (i = 0; i < NoOfModules; ++i) { return GetModuleEntry(at);
if (ModuleName[i] == a) {
UNLOCK(ModulesLock);
return i;
}
}
ModuleName[i = NoOfModules++] = a;
UNLOCK(ModulesLock);
if (NoOfModules == MaxModules) {
Yap_Error(SYSTEM_ERROR,a,"number of modules overflowed");
}
return (i);
} }
Term Term
Yap_Module(Term tmod) Yap_Module(Term tmod)
{ {
return ModuleName[LookupModule(tmod)]; LookupModule(tmod);
return tmod;
} }
struct pred_entry * struct pred_entry *
Yap_ModulePred(Term mod) Yap_ModulePred(Term mod)
{ {
return ModulePred[LookupModule(mod)]; ModEntry *me;
if (!(me = LookupModule(mod)))
return NULL;
return me->PredForME;
} }
void void
Yap_NewModulePred(Term mod, struct pred_entry *ap) Yap_NewModulePred(Term mod, struct pred_entry *ap)
{ {
Term imod = LookupModule(mod); ModEntry *me;
ap->NextPredOfModule = ModulePred[imod];
ModulePred[imod] = ap; if (!(me = LookupModule(mod)))
return;
/* LOCK THIS */
ap->NextPredOfModule = me->PredForME;
me->PredForME = ap;
} }
static Int static Int
@ -133,24 +184,31 @@ p_change_module(void)
static Int static Int
cont_current_module(void) cont_current_module(void)
{ {
Int imod = IntOfTerm(EXTRA_CBACK_ARG(1,1)); ModEntry *imod = (ModEntry *)IntegerOfTerm(EXTRA_CBACK_ARG(1,1)), *next;
Term t = ModuleName[imod]; Term t = MkAtomTerm(imod->AtomOfME);
next = imod->NextME;
LOCK(ModulesLock); /* ARG1 is unbound */
if (imod == NoOfModules) { Yap_unify(ARG1,t);
UNLOCK(ModulesLock); if (!next)
cut_fail(); cut_succeed();
} EXTRA_CBACK_ARG(1,1) = MkIntegerTerm((Int)next);
UNLOCK(ModulesLock); return TRUE;
EXTRA_CBACK_ARG(1,1) = MkIntTerm(imod+1);
return(Yap_unify(ARG1,t));
} }
static Int static Int
init_current_module(void) init_current_module(void)
{ /* current_module(?ModuleName) */ { /* current_module(?ModuleName) */
EXTRA_CBACK_ARG(1,1) = MkIntTerm(0); Term t = Deref(ARG1);
return (cont_current_module()); if (!IsVarTerm(t)) {
if (!IsAtomTerm(t)) {
Yap_Error(TYPE_ERROR_ATOM,t,"module name must be an atom");
return FALSE;
}
return (FetchModuleEntry(AtomOfTerm(t)) != NULL);
}
EXTRA_CBACK_ARG(1,1) = MkIntegerTerm((Int)CurrentModules);
return cont_current_module();
} }
void void
@ -167,26 +225,15 @@ Yap_InitModulesC(void)
void void
Yap_InitModules(void) Yap_InitModules(void)
{ {
ModuleName[PROLOG_MODULE] = LookupModule(MkAtomTerm(Yap_LookupAtom("prolog")));
TermProlog; LookupModule(USER_MODULE);
ModuleName[1] = LookupModule(IDB_MODULE);
USER_MODULE; LookupModule(ATTRIBUTES_MODULE);
ModuleName[2] = LookupModule(CHARSIO_MODULE);
IDB_MODULE; LookupModule(TERMS_MODULE);
ModuleName[3] = LookupModule(SYSTEM_MODULE);
ATTRIBUTES_MODULE; LookupModule(READUTIL_MODULE);
ModuleName[4] = LookupModule(HACKS_MODULE);
CHARSIO_MODULE; LookupModule(GLOBALS_MODULE);
ModuleName[5] =
TERMS_MODULE;
ModuleName[6] =
SYSTEM_MODULE;
ModuleName[7] =
READUTIL_MODULE;
ModuleName[8] =
HACKS_MODULE;
ModuleName[9] =
GLOBALS_MODULE;
NoOfModules = 10;
CurrentModule = PROLOG_MODULE; CurrentModule = PROLOG_MODULE;
} }

View File

@ -621,12 +621,15 @@ InitReverseLookupOpcode(void)
op_numbers i; op_numbers i;
/* 2 K should be OK */ /* 2 K should be OK */
int hash_size_mask = OP_HASH_SIZE-1; int hash_size_mask = OP_HASH_SIZE-1;
UInt sz = OP_HASH_SIZE*sizeof(struct opcode_tab_entry);
if (OP_RTABLE == NULL) while (OP_RTABLE == NULL) {
OP_RTABLE = (opentry *)Yap_AllocCodeSpace(OP_HASH_SIZE*sizeof(struct opcode_tab_entry)); if ((OP_RTABLE = (opentry *)Yap_AllocCodeSpace(sz)) == NULL) {
if (OP_RTABLE == NULL) { if (!Yap_growheap(FALSE, sz, NULL)) {
Yap_Error(INTERNAL_ERROR, TermNil, Yap_Error(INTERNAL_ERROR, TermNil,
"Couldn't obtain space for the reverse translation opcode table"); "Couldn't obtain space for the reverse translation opcode table");
}
}
} }
opeptr = OP_RTABLE; opeptr = OP_RTABLE;
/* clear up table */ /* clear up table */

View File

@ -10,7 +10,7 @@
* File: Heap.h * * File: Heap.h *
* mods: * * mods: *
* comments: Heap Init Structure * * comments: Heap Init Structure *
* version: $Id: Heap.h,v 1.114 2007-03-22 11:12:21 vsc Exp $ * * version: $Id: Heap.h,v 1.115 2007-04-10 22:13:20 vsc Exp $ *
*************************************************************************/ *************************************************************************/
/* information that can be stored in Code Space */ /* information that can be stored in Code Space */
@ -341,12 +341,9 @@ typedef struct various_codes {
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
lockvar low_level_trace_lock; lockvar low_level_trace_lock;
#endif #endif
lockvar modules_lock;
#endif #endif
unsigned int size_of_overflow; unsigned int size_of_overflow;
Term module_name[MaxModules]; struct mod_entry *current_modules;
struct pred_entry *module_pred[MaxModules];
SMALLUNSGN no_of_modules;
struct operator_entry *op_list; struct operator_entry *op_list;
struct static_clause *dead_static_clauses; struct static_clause *dead_static_clauses;
struct static_mega_clause *dead_mega_clauses; struct static_mega_clause *dead_mega_clauses;
@ -654,9 +651,7 @@ struct various_codes *Yap_heap_regs;
#define INT_BB_KEYS Yap_heap_regs->IntBBKeys #define INT_BB_KEYS Yap_heap_regs->IntBBKeys
#define CharConversionTable Yap_heap_regs->char_conversion_table #define CharConversionTable Yap_heap_regs->char_conversion_table
#define CharConversionTable2 Yap_heap_regs->char_conversion_table2 #define CharConversionTable2 Yap_heap_regs->char_conversion_table2
#define ModuleName Yap_heap_regs->module_name #define CurrentModules Yap_heap_regs->current_modules
#define ModulePred Yap_heap_regs->module_pred
#define NoOfModules Yap_heap_regs->no_of_modules
#define OpList Yap_heap_regs->op_list #define OpList Yap_heap_regs->op_list
#define AtomAbol Yap_heap_regs->atom_abol #define AtomAbol Yap_heap_regs->atom_abol
#define AtomAlarm Yap_heap_regs->atom_alarm #define AtomAlarm Yap_heap_regs->atom_alarm

View File

@ -10,7 +10,7 @@
* File: Yap.h.m4 * * File: Yap.h.m4 *
* mods: * * mods: *
* comments: main header file for YAP * * comments: main header file for YAP *
* version: $Id: Yap.h,v 1.21 2007-02-26 10:41:40 vsc Exp $ * * version: $Id: Yap.h,v 1.22 2007-04-10 22:13:20 vsc Exp $ *
*************************************************************************/ *************************************************************************/
#include "config.h" #include "config.h"
@ -1167,7 +1167,7 @@ extern int Yap_PrologShouldHandleInterrupts;
/******************* number of modules ****************************/ /******************* number of modules ****************************/
#define MaxModules 256 #define DefaultMaxModules 256
#if YAPOR #if YAPOR
#define YAPEnterCriticalSection() \ #define YAPEnterCriticalSection() \

View File

@ -342,11 +342,13 @@ IsWideAtom (Atom at)
/* Module property */ /* Module property */
typedef struct typedef struct mod_entry
{ {
Prop NextOfPE; /* used to chain properties */ Prop NextOfPE; /* used to chain properties */
PropFlags KindOfPE; /* kind of property */ PropFlags KindOfPE; /* kind of property */
SMALLUNSGN IndexOfMod; /* index in module table */ struct pred_entry *PredForME; /* index in module table */
Atom AtomOfME; /* module's name */
struct mod_entry *NextME; /* next module */
} ModEntry; } ModEntry;
#if USE_OFFSETS_IN_PROPS #if USE_OFFSETS_IN_PROPS
@ -793,20 +795,20 @@ IsPredProperty (int flags)
/* There are several flags for code and data base entries */ /* There are several flags for code and data base entries */
typedef enum typedef enum
{ {
MegaMask = 0x200000, /* informs this is a mega clause */ MegaMask = 0x200000, /* mega clause */
FactMask = 0x100000, /* informs this is a fact */ FactMask = 0x100000, /* a fact */
SwitchRootMask = 0x80000, /* informs this is the root for the index tree */ SwitchRootMask = 0x80000, /* root for the index tree */
SwitchTableMask = 0x40000, /* informs this is a switch table */ SwitchTableMask = 0x40000, /* switch table */
HasBlobsMask = 0x20000, /* informs this has blobs which may be in use */ HasBlobsMask = 0x20000, /* blobs which may be in use */
ProfFoundMask = 0x10000, /* informs this clause is being counted by profiler */ ProfFoundMask = 0x10000, /* clause is being counted by profiler */
DynamicMask = 0x8000, /* informs this is a dynamic predicate */ DynamicMask = 0x8000, /* dynamic predicate */
InUseMask = 0x4000, /* informs this block is being used */ InUseMask = 0x4000, /* this block is being used */
ErasedMask = 0x2000, /* informs this block has been erased */ ErasedMask = 0x2000, /* this block has been erased */
IndexMask = 0x1000, /* informs this is indexing code */ IndexMask = 0x1000, /* indexing code */
DBClMask = 0x0800, /* informs this is a data base structure */ DBClMask = 0x0800, /* data base structure */
LogUpdRuleMask = 0x0400, /* informs the code is for a log upd rule with env */ LogUpdRuleMask = 0x0400, /* code is for a log upd rule with env */
LogUpdMask = 0x0200, /* informs this is a logic update index. */ LogUpdMask = 0x0200, /* logic update index. */
StaticMask = 0x0100, /* dealing with static predicates */ StaticMask = 0x0100, /* static predicates */
DirtyMask = 0x0080 /* LUIndices */ DirtyMask = 0x0080 /* LUIndices */
/* other flags belong to DB */ /* other flags belong to DB */
} dbentry_flags; } dbentry_flags;

View File

@ -11,8 +11,11 @@
* File: rheap.h * * File: rheap.h *
* comments: walk through heap code * * comments: walk through heap code *
* * * *
* Last rev: $Date: 2007-03-22 11:12:21 $,$Author: vsc $ * * Last rev: $Date: 2007-04-10 22:13:21 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.74 2007/03/22 11:12:21 vsc
* make sure that YAP_Restart does not restart a failed goal.
*
* Revision 1.73 2007/02/18 00:26:36 vsc * Revision 1.73 2007/02/18 00:26:36 vsc
* fix atom garbage collector (although it is still off by default) * fix atom garbage collector (although it is still off by default)
* make valgrind feel better * make valgrind feel better
@ -462,6 +465,10 @@ restore_codes(void)
Yap_heap_regs->atprompt = Yap_heap_regs->atprompt =
AtomAdjust(Yap_heap_regs->atprompt); AtomAdjust(Yap_heap_regs->atprompt);
} }
if (Yap_heap_regs->current_modules) {
Yap_heap_regs->current_modules = (struct mod_entry *)
AddrAdjust((ADDR)Yap_heap_regs->current_modules);
}
if (Yap_heap_regs->char_conversion_table) { if (Yap_heap_regs->char_conversion_table) {
Yap_heap_regs->char_conversion_table = (char *) Yap_heap_regs->char_conversion_table = (char *)
AddrAdjust((ADDR)Yap_heap_regs->char_conversion_table); AddrAdjust((ADDR)Yap_heap_regs->char_conversion_table);
@ -546,17 +553,6 @@ restore_codes(void)
} }
} }
} }
{
/* adjust atoms in atom table */
unsigned int i = 0;
for (i = 0; i < Yap_heap_regs->no_of_modules; i++) {
Yap_heap_regs->module_name[i] = AtomTermAdjust(Yap_heap_regs->module_name[i]);
if (Yap_heap_regs->module_pred[i]) {
Yap_heap_regs->module_pred[i] = PtoPredAdjust(Yap_heap_regs->module_pred[i]);
}
}
}
Yap_heap_regs->atom_abol = AtomAdjust(Yap_heap_regs->atom_abol); 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_append = AtomAdjust(Yap_heap_regs->atom_append);
Yap_heap_regs->atom_array = AtomAdjust(Yap_heap_regs->atom_array); Yap_heap_regs->atom_array = AtomAdjust(Yap_heap_regs->atom_array);
@ -1275,8 +1271,20 @@ RestoreEntries(PropEntry *pp)
opp->OpModule = AtomTermAdjust(opp->OpModule); opp->OpModule = AtomTermAdjust(opp->OpModule);
} }
} }
case ExpProperty:
case ModProperty: case ModProperty:
{
ModEntry *me = (ModEntry *)pp;
me->NextOfPE =
PropAdjust(me->NextOfPE);
me->PredForME =
PtoPredAdjust(me->PredForME);
me->AtomOfME =
AtomAdjust(me->AtomOfME);
me->NextME = (struct mod_entry *)
AddrAdjust((ADDR)me->NextME);
}
break;
case ExpProperty:
pp->NextOfPE = pp->NextOfPE =
PropAdjust(pp->NextOfPE); PropAdjust(pp->NextOfPE);
break; break;

View File

@ -27,7 +27,7 @@ INCLUDEDIR=$(ROOTDIR)/include/Yap
# #
INFODIR=$(SHAREDIR)/info INFODIR=$(SHAREDIR)/info
#3 #
# Add this flag to YAP_EXTRAS if you need the extension: # Add this flag to YAP_EXTRAS if you need the extension:
# -DRATIONAL_TREES: allow unification and builtins over rational trees # -DRATIONAL_TREES: allow unification and builtins over rational trees
# -DCOROUTINING: implement extra control primitives # -DCOROUTINING: implement extra control primitives

View File

@ -16,6 +16,10 @@
<h2>Yap-5.1.2:</h2> <h2>Yap-5.1.2:</h2>
<ul> <ul>
<li> FIXED: get rid of static structures for modules (obs from Bernd
Gutmann).</li>
<li> FIXED: SREG might be lost on trail/heap overflow, and that would
confuse later pruning.</li>
<li> FIXED: UNICODE16 was broken.</li> <li> FIXED: UNICODE16 was broken.</li>
<li> NEW: support for BOM.</li> <li> NEW: support for BOM.</li>
<li> FIXED: debugging and clause/3 over tabled predicates would kill YAP.</li> <li> FIXED: debugging and clause/3 over tabled predicates would kill YAP.</li>

View File

@ -38,6 +38,8 @@ assert(C) :-
'$assert'(V,Mod,_,_,_) :- var(V), !, '$assert'(V,Mod,_,_,_) :- var(V), !,
'$do_error'(instantiation_error,assert(Mod:V)). '$do_error'(instantiation_error,assert(Mod:V)).
'$assert'(V,Mod,_,_,_) :- var(Mod), !,
'$do_error'(instantiation_error,assert(Mod:V)).
'$assert'(M:C,_,Where,R,P) :- !, '$assert'(M:C,_,Where,R,P) :- !,
'$assert'(C,M,Where,R,P). '$assert'(C,M,Where,R,P).
'$assert'((H:-G),M1,Where,R,P) :- !, '$assert'((H:-G),M1,Where,R,P) :- !,