fix atom garbage collector (although it is still off by default)
make valgrind feel better git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1797 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
a32d5dbe5f
commit
400b1958b2
12
C/adtdefs.c
12
C/adtdefs.c
@ -652,13 +652,13 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
|
|||||||
p->FunctorOfPred = (Functor)fe;
|
p->FunctorOfPred = (Functor)fe;
|
||||||
WRITE_UNLOCK(fe->FRWLock);
|
WRITE_UNLOCK(fe->FRWLock);
|
||||||
#ifdef LOW_PROF
|
#ifdef LOW_PROF
|
||||||
if (ProfilerOn &&
|
if (ProfilerOn &&
|
||||||
Yap_OffLineProfiler) {
|
Yap_OffLineProfiler) {
|
||||||
Yap_inform_profiler_of_clause((yamop *)&(p->OpcodeOfPred), (yamop *)(&(p->OpcodeOfPred)+1), p, 1);
|
Yap_inform_profiler_of_clause((yamop *)&(p->OpcodeOfPred), (yamop *)(&(p->OpcodeOfPred)+1), p, 1);
|
||||||
if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) {
|
if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) {
|
||||||
Yap_inform_profiler_of_clause((yamop *)&(p->cs.p_code.ExpandCode), (yamop *)(&(p->cs.p_code.ExpandCode)+1), p, 1);
|
Yap_inform_profiler_of_clause((yamop *)&(p->cs.p_code.ExpandCode), (yamop *)(&(p->cs.p_code.ExpandCode)+1), p, 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
return p0;
|
return p0;
|
||||||
}
|
}
|
||||||
|
164
C/agc.c
164
C/agc.c
@ -22,12 +22,13 @@ static char SccsId[] = "@(#)agc.c 1.3 3/15/90";
|
|||||||
#include "absmi.h"
|
#include "absmi.h"
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
#include "yapio.h"
|
#include "yapio.h"
|
||||||
|
#include "iopreds.h"
|
||||||
#include "attvar.h"
|
#include "attvar.h"
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* #define DEBUG_RESTORE1 1 */
|
/* #define DEBUG_RESTORE1 1 */
|
||||||
/* #define DEBUG_RESTORE2 1 */
|
/* #define DEBUG_RESTORE2 1 */
|
||||||
#define DEBUG_RESTORE3 1
|
/* #define DEBUG_RESTORE3 1 */
|
||||||
#define errout Yap_stderr
|
#define errout Yap_stderr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ STATIC_PROTO(void CleanCode, (PredEntry *));
|
|||||||
|
|
||||||
static int agc_calls;
|
static int agc_calls;
|
||||||
|
|
||||||
static unsigned long int agc_collected;
|
static YAP_ULONG_LONG agc_collected;
|
||||||
|
|
||||||
static Int tot_agc_time = 0; /* total time spent in GC */
|
static Int tot_agc_time = 0; /* total time spent in GC */
|
||||||
|
|
||||||
@ -59,9 +60,9 @@ AtomResetMark(AtomEntry *ae)
|
|||||||
if (c & AtomMarkedBit) {
|
if (c & AtomMarkedBit) {
|
||||||
c &= ~AtomMarkedBit;
|
c &= ~AtomMarkedBit;
|
||||||
ae->NextOfAE = (Atom)c;
|
ae->NextOfAE = (Atom)c;
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
}
|
}
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Atom
|
static inline Atom
|
||||||
@ -69,7 +70,7 @@ CleanAtomMarkedBit(Atom a)
|
|||||||
{
|
{
|
||||||
CELL c = (CELL)a;
|
CELL c = (CELL)a;
|
||||||
c &= ~AtomMarkedBit;
|
c &= ~AtomMarkedBit;
|
||||||
return((Atom)c);
|
return (Atom)c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Functor
|
static inline Functor
|
||||||
@ -164,6 +165,21 @@ rehash(CELL *oldcode, int NOfE, int KindOfEntries)
|
|||||||
|
|
||||||
#include "rheap.h"
|
#include "rheap.h"
|
||||||
|
|
||||||
|
static void init_reg_copies(void)
|
||||||
|
{
|
||||||
|
OldASP = ASP;
|
||||||
|
OldLCL0 = LCL0;
|
||||||
|
OldTR = TR;
|
||||||
|
OldGlobalBase = (CELL *)Yap_GlobalBase;
|
||||||
|
OldH = H;
|
||||||
|
OldH0 = H0;
|
||||||
|
OldTrailBase = Yap_TrailBase;
|
||||||
|
OldTrailTop = Yap_TrailTop;
|
||||||
|
OldHeapBase = Yap_HeapBase;
|
||||||
|
OldHeapTop = HeapTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mark_hash_entry(AtomHashEntry *HashPtr)
|
mark_hash_entry(AtomHashEntry *HashPtr)
|
||||||
{
|
{
|
||||||
@ -175,7 +191,7 @@ mark_hash_entry(AtomHashEntry *HashPtr)
|
|||||||
do {
|
do {
|
||||||
#ifdef DEBUG_RESTORE1 /* useful during debug */
|
#ifdef DEBUG_RESTORE1 /* useful during debug */
|
||||||
if (IsWideAtom(atm))
|
if (IsWideAtom(atm))
|
||||||
fprintf(errout, "Restoring %S\n", at->WStrOfAE);
|
fprintf(errout, "Restoring %S\n", at->WStrOfAE);
|
||||||
else
|
else
|
||||||
fprintf(errout, "Restoring %s\n", at->StrOfAE);
|
fprintf(errout, "Restoring %s\n", at->StrOfAE);
|
||||||
#endif
|
#endif
|
||||||
@ -194,8 +210,6 @@ mark_atoms(void)
|
|||||||
{
|
{
|
||||||
AtomHashEntry *HashPtr = HashChain;
|
AtomHashEntry *HashPtr = HashChain;
|
||||||
register int i;
|
register int i;
|
||||||
AtomEntry *at;
|
|
||||||
Atom atm;
|
|
||||||
|
|
||||||
restore_codes();
|
restore_codes();
|
||||||
for (i = 0; i < AtomHashTableSize; ++i) {
|
for (i = 0; i < AtomHashTableSize; ++i) {
|
||||||
@ -207,23 +221,7 @@ mark_atoms(void)
|
|||||||
mark_hash_entry(HashPtr);
|
mark_hash_entry(HashPtr);
|
||||||
HashPtr++;
|
HashPtr++;
|
||||||
}
|
}
|
||||||
|
mark_hash_entry(&INVISIBLECHAIN);
|
||||||
atm = INVISIBLECHAIN.Entry;
|
|
||||||
at = RepAtom(atm);
|
|
||||||
if (EndOfPAEntr(at)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
#ifdef DEBUG_RESTORE1 /* useful during debug */
|
|
||||||
if (IsWideAtom(atm))
|
|
||||||
fprintf(errout, "Restoring %S\n", at->WStrOfAE);
|
|
||||||
else
|
|
||||||
fprintf(errout, "Restoring %s\n", at->StrOfAE);
|
|
||||||
#endif
|
|
||||||
RestoreEntries(RepProp(at->PropsOfAE));
|
|
||||||
atm = at->NextOfAE;
|
|
||||||
at = RepAtom(CleanAtomMarkedBit(atm));
|
|
||||||
} while (!EndOfPAEntr(at));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -259,6 +257,9 @@ mark_local(void)
|
|||||||
if (IsAtomTerm(reg)) {
|
if (IsAtomTerm(reg)) {
|
||||||
MarkAtomEntry(RepAtom(AtomOfTerm(reg)));
|
MarkAtomEntry(RepAtom(AtomOfTerm(reg)));
|
||||||
}
|
}
|
||||||
|
} else if (IsApplTerm(reg)) {
|
||||||
|
Functor f = FunctorOfTerm(reg);
|
||||||
|
FuncAdjust(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,17 +278,15 @@ mark_global_cell(CELL *pt)
|
|||||||
#else
|
#else
|
||||||
return pt + 3;
|
return pt + 3;
|
||||||
#endif
|
#endif
|
||||||
#if USE_GMP
|
|
||||||
case (CELL)FunctorBigInt:
|
case (CELL)FunctorBigInt:
|
||||||
{
|
{
|
||||||
Int sz = 1+
|
Int sz = 2 +
|
||||||
sizeof(MP_INT)+
|
(sizeof(MP_INT)+
|
||||||
(((MP_INT *)(pt+1))->_mp_alloc*sizeof(mp_limb_t));
|
(((MP_INT *)(pt+1))->_mp_alloc*sizeof(mp_limb_t)))/sizeof(CELL);
|
||||||
return pt + sz+1;
|
return pt + sz;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
return pt += 3;
|
return pt + 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (IsAtomTerm(reg)) {
|
} else if (IsAtomTerm(reg)) {
|
||||||
@ -313,7 +312,6 @@ mark_global(void)
|
|||||||
#endif
|
#endif
|
||||||
while (pt < H) {
|
while (pt < H) {
|
||||||
pt = mark_global_cell(pt);
|
pt = mark_global_cell(pt);
|
||||||
pt++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,17 +324,39 @@ mark_stacks(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clean_atom(AtomHashEntry *HashPtr)
|
mark_streams(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; i < MaxStreams; i++) {
|
||||||
|
if (!(Stream[i].status & (Free_Stream_f|Socket_Stream_f|InMemory_Stream_f|Pipe_Stream_f))) {
|
||||||
|
/* This is a file, so it has a name */
|
||||||
|
AtomEntry *ae = RepAtom(Stream[i].u.file.name);
|
||||||
|
MarkAtomEntry(ae);
|
||||||
|
ae = RepAtom(AtomOfTerm(Stream[i].u.file.user_name));
|
||||||
|
MarkAtomEntry(ae);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i=0;i<NOfFileAliases;i++) {
|
||||||
|
AtomEntry *ae = RepAtom(FileAliases[i].name);
|
||||||
|
MarkAtomEntry(ae);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clean_atom_list(AtomHashEntry *HashPtr)
|
||||||
{
|
{
|
||||||
Atom atm = HashPtr->Entry;
|
Atom atm = HashPtr->Entry;
|
||||||
Atom *patm = &(HashPtr->Entry);
|
Atom *patm = &(HashPtr->Entry);
|
||||||
while (atm != NIL) {
|
while (atm != NIL) {
|
||||||
AtomEntry *at = RepAtom(CleanAtomMarkedBit(atm));
|
AtomEntry *at = RepAtom(atm);
|
||||||
if (AtomResetMark(at) || (AGCHook != NULL && !AGCHook(atm))) {
|
if (AtomResetMark(at) ||
|
||||||
|
at->PropsOfAE != NIL ||
|
||||||
|
(AGCHook != NULL && !AGCHook(atm))) {
|
||||||
patm = &(at->NextOfAE);
|
patm = &(at->NextOfAE);
|
||||||
atm = at->NextOfAE;
|
atm = at->NextOfAE;
|
||||||
NOfAtoms--;
|
|
||||||
} else {
|
} else {
|
||||||
|
NOfAtoms--;
|
||||||
if (IsWideAtom(atm)) {
|
if (IsWideAtom(atm)) {
|
||||||
#ifdef DEBUG_RESTORE3
|
#ifdef DEBUG_RESTORE3
|
||||||
fprintf(errout, "Purged %p:%S\n", at, at->WStrOfAE);
|
fprintf(errout, "Purged %p:%S\n", at, at->WStrOfAE);
|
||||||
@ -344,12 +364,11 @@ clean_atom(AtomHashEntry *HashPtr)
|
|||||||
agc_collected += sizeof(AtomEntry)+wcslen(at->WStrOfAE);
|
agc_collected += sizeof(AtomEntry)+wcslen(at->WStrOfAE);
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG_RESTORE3
|
#ifdef DEBUG_RESTORE3
|
||||||
fprintf(stderr, "Purged %p:%s\n", at, at->StrOfAE);
|
fprintf(stderr, "Purged %p:%s patm=%p %p\n", at, at->StrOfAE, patm, at->NextOfAE);
|
||||||
#endif
|
#endif
|
||||||
agc_collected += sizeof(AtomEntry)+strlen(at->StrOfAE);
|
agc_collected += sizeof(AtomEntry)+strlen(at->StrOfAE);
|
||||||
}
|
}
|
||||||
*patm = at->NextOfAE;
|
*patm = atm = at->NextOfAE;
|
||||||
atm = at->NextOfAE;
|
|
||||||
Yap_FreeCodeSpace((char *)at);
|
Yap_FreeCodeSpace((char *)at);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,43 +382,19 @@ clean_atoms(void)
|
|||||||
{
|
{
|
||||||
AtomHashEntry *HashPtr = HashChain;
|
AtomHashEntry *HashPtr = HashChain;
|
||||||
register int i;
|
register int i;
|
||||||
Atom atm;
|
|
||||||
Atom *patm;
|
|
||||||
AtomEntry *at;
|
|
||||||
|
|
||||||
|
AtomResetMark(AtomFoundVar);
|
||||||
|
AtomResetMark(AtomFreeTerm);
|
||||||
for (i = 0; i < AtomHashTableSize; ++i) {
|
for (i = 0; i < AtomHashTableSize; ++i) {
|
||||||
clean_atom(HashPtr);
|
clean_atom_list(HashPtr);
|
||||||
HashPtr++;
|
HashPtr++;
|
||||||
}
|
}
|
||||||
|
HashPtr = WideHashChain;
|
||||||
for (i = 0; i < WideAtomHashTableSize; ++i) {
|
for (i = 0; i < WideAtomHashTableSize; ++i) {
|
||||||
clean_atom(HashPtr);
|
clean_atom_list(HashPtr);
|
||||||
HashPtr++;
|
HashPtr++;
|
||||||
}
|
}
|
||||||
patm = &(INVISIBLECHAIN.Entry);
|
clean_atom_list(&INVISIBLECHAIN);
|
||||||
atm = INVISIBLECHAIN.Entry;
|
|
||||||
while (atm != NIL) {
|
|
||||||
at = RepAtom(CleanAtomMarkedBit(atm));
|
|
||||||
if (AtomResetMark(at) || (AGCHook != NULL && !AGCHook(atm))) {
|
|
||||||
patm = &(atm->NextOfAE);
|
|
||||||
NOfAtoms--;
|
|
||||||
atm = at->NextOfAE;
|
|
||||||
} else {
|
|
||||||
if (IsWideAtom(atm)) {
|
|
||||||
#ifdef DEBUG_RESTORE3
|
|
||||||
fprintf(errout, "Purged %p:%S\n", at, at->WStrOfAE);
|
|
||||||
#endif
|
|
||||||
agc_collected += sizeof(AtomEntry)+wcslen(at->WStrOfAE);
|
|
||||||
} else {
|
|
||||||
#ifdef DEBUG_RESTORE3
|
|
||||||
fprintf(stderr, "Purged %p:%s\n", at, at->StrOfAE);
|
|
||||||
#endif
|
|
||||||
agc_collected += sizeof(AtomEntry)+strlen(at->StrOfAE);
|
|
||||||
}
|
|
||||||
*patm = at->NextOfAE;
|
|
||||||
atm = at->NextOfAE;
|
|
||||||
Yap_FreeCodeSpace((char *)at);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -414,6 +409,7 @@ atom_gc(void)
|
|||||||
gc_trace = 1;
|
gc_trace = 1;
|
||||||
agc_calls++;
|
agc_calls++;
|
||||||
agc_collected = 0;
|
agc_collected = 0;
|
||||||
|
|
||||||
if (gc_trace) {
|
if (gc_trace) {
|
||||||
fprintf(Yap_stderr, "%% agc:\n");
|
fprintf(Yap_stderr, "%% agc:\n");
|
||||||
} else if (gc_verbose) {
|
} else if (gc_verbose) {
|
||||||
@ -422,15 +418,18 @@ atom_gc(void)
|
|||||||
time_start = Yap_cputime();
|
time_start = Yap_cputime();
|
||||||
/* get the number of active registers */
|
/* get the number of active registers */
|
||||||
YAPEnterCriticalSection();
|
YAPEnterCriticalSection();
|
||||||
|
init_reg_copies();
|
||||||
mark_stacks();
|
mark_stacks();
|
||||||
|
mark_streams();
|
||||||
mark_atoms();
|
mark_atoms();
|
||||||
clean_atoms();
|
clean_atoms();
|
||||||
|
AGcLastCall = NOfAtoms;
|
||||||
YAPLeaveCriticalSection();
|
YAPLeaveCriticalSection();
|
||||||
agc_time = Yap_cputime()-time_start;
|
agc_time = Yap_cputime()-time_start;
|
||||||
tot_agc_time += agc_time;
|
tot_agc_time += agc_time;
|
||||||
tot_agc_recovered += agc_collected;
|
tot_agc_recovered += agc_collected;
|
||||||
if (gc_verbose) {
|
if (gc_verbose) {
|
||||||
fprintf(Yap_stderr, "%% Collected %ld bytes.\n", agc_collected);
|
fprintf(Yap_stderr, "%% Collected %lld bytes.\n", agc_collected);
|
||||||
fprintf(Yap_stderr, "%% GC %d took %g sec, total of %g sec doing GC so far.\n", agc_calls, (double)agc_time/1000, (double)tot_agc_time/1000);
|
fprintf(Yap_stderr, "%% GC %d took %g sec, total of %g sec doing GC so far.\n", agc_calls, (double)agc_time/1000, (double)tot_agc_time/1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -444,7 +443,6 @@ Yap_atom_gc(void)
|
|||||||
static Int
|
static Int
|
||||||
p_atom_gc(void)
|
p_atom_gc(void)
|
||||||
{
|
{
|
||||||
return TRUE;
|
|
||||||
#ifndef FIXED_STACKS
|
#ifndef FIXED_STACKS
|
||||||
atom_gc();
|
atom_gc();
|
||||||
#endif /* FIXED_STACKS */
|
#endif /* FIXED_STACKS */
|
||||||
@ -462,9 +460,31 @@ p_inform_agc(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Int
|
||||||
|
p_agc_threshold(void)
|
||||||
|
{
|
||||||
|
Term t = Deref(ARG1);
|
||||||
|
if (IsVarTerm(t)) {
|
||||||
|
return Yap_unify(ARG1, MkIntegerTerm(AGcThreshold));
|
||||||
|
} else if (!IsIntegerTerm(t)) {
|
||||||
|
Yap_Error(TYPE_ERROR_INTEGER,t,"prolog_flag/2 agc_margin");
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
Int i = IntegerOfTerm(t);
|
||||||
|
if (i<0) {
|
||||||
|
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO,t,"prolog_flag/2 agc_margin");
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
AGcThreshold = i;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Yap_init_agc(void)
|
Yap_init_agc(void)
|
||||||
{
|
{
|
||||||
Yap_InitCPred("$atom_gc", 0, p_atom_gc, HiddenPredFlag);
|
Yap_InitCPred("$atom_gc", 0, p_atom_gc, HiddenPredFlag);
|
||||||
Yap_InitCPred("$inform_agc", 3, p_inform_agc, HiddenPredFlag);
|
Yap_InitCPred("$inform_agc", 3, p_inform_agc, HiddenPredFlag);
|
||||||
|
Yap_InitCPred("$agc_threshold", 1, p_agc_threshold, HiddenPredFlag|SafePredFlag);
|
||||||
}
|
}
|
||||||
|
@ -2148,7 +2148,7 @@ p_compile_array_refs(void)
|
|||||||
static Int
|
static Int
|
||||||
p_array_refs_compiled(void)
|
p_array_refs_compiled(void)
|
||||||
{
|
{
|
||||||
return (compile_arrays);
|
return compile_arrays;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int
|
static Int
|
||||||
|
88
C/grow.c
88
C/grow.c
@ -116,8 +116,10 @@ SetHeapRegs(void)
|
|||||||
AuxSp = PtoDelayAdjust(AuxSp);
|
AuxSp = PtoDelayAdjust(AuxSp);
|
||||||
AuxTop = (ADDR)PtoDelayAdjust((CELL *)AuxTop);
|
AuxTop = (ADDR)PtoDelayAdjust((CELL *)AuxTop);
|
||||||
#endif
|
#endif
|
||||||
|
#if !USE_SYSTEM_MALLOC
|
||||||
if (HeapLim)
|
if (HeapLim)
|
||||||
HeapLim = DelayAddrAdjust(HeapLim);
|
HeapLim = DelayAddrAdjust(HeapLim);
|
||||||
|
#endif
|
||||||
/* The registers pointing to one of the stacks */
|
/* The registers pointing to one of the stacks */
|
||||||
if (ENV)
|
if (ENV)
|
||||||
ENV = PtoLocAdjust(ENV);
|
ENV = PtoLocAdjust(ENV);
|
||||||
@ -975,11 +977,47 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_new_table(AtomHashEntry *ntb, UInt nsize)
|
||||||
|
{
|
||||||
|
UInt i;
|
||||||
|
|
||||||
|
for (i = 0; i < nsize; ++i) {
|
||||||
|
INIT_RWLOCK(ntb[i].AERWLock);
|
||||||
|
ntb[i].Entry = NIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cp_atom_table(AtomHashEntry *ntb, UInt nsize)
|
||||||
|
{
|
||||||
|
UInt i;
|
||||||
|
|
||||||
|
for (i = 0; i < AtomHashTableSize; i++) {
|
||||||
|
Atom catom;
|
||||||
|
|
||||||
|
READ_LOCK(HashChain[i].AERWLock);
|
||||||
|
catom = HashChain[i].Entry;
|
||||||
|
while (catom != NIL) {
|
||||||
|
AtomEntry *ap = RepAtom(catom);
|
||||||
|
Atom natom;
|
||||||
|
CELL hash;
|
||||||
|
|
||||||
|
hash = HashFunction((unsigned char *)ap->StrOfAE) % nsize;
|
||||||
|
natom = ap->NextOfAE;
|
||||||
|
ap->NextOfAE = ntb[hash].Entry;
|
||||||
|
ntb[hash].Entry = catom;
|
||||||
|
catom = natom;
|
||||||
|
}
|
||||||
|
READ_UNLOCK(HashChain[i].AERWLock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
growatomtable(void)
|
growatomtable(void)
|
||||||
{
|
{
|
||||||
AtomHashEntry *ntb;
|
AtomHashEntry *ntb;
|
||||||
UInt nsize = 4*AtomHashTableSize-1, i;
|
UInt nsize = 4*AtomHashTableSize-1;
|
||||||
UInt start_growth_time = Yap_cputime(), growth_time;
|
UInt start_growth_time = Yap_cputime(), growth_time;
|
||||||
int gc_verbose = Yap_is_gc_verbose();
|
int gc_verbose = Yap_is_gc_verbose();
|
||||||
|
|
||||||
@ -1002,28 +1040,8 @@ growatomtable(void)
|
|||||||
fprintf(Yap_stderr, "%% growing the atom table to %ld entries\n", (long int)(nsize));
|
fprintf(Yap_stderr, "%% growing the atom table to %ld entries\n", (long int)(nsize));
|
||||||
}
|
}
|
||||||
YAPEnterCriticalSection();
|
YAPEnterCriticalSection();
|
||||||
for (i = 0; i < nsize; ++i) {
|
init_new_table(ntb, nsize);
|
||||||
INIT_RWLOCK(ntb[i].AERWLock);
|
cp_atom_table(ntb, nsize);
|
||||||
ntb[i].Entry = NIL;
|
|
||||||
}
|
|
||||||
for (i = 0; i < AtomHashTableSize; i++) {
|
|
||||||
Atom catom;
|
|
||||||
|
|
||||||
READ_LOCK(HashChain[i].AERWLock);
|
|
||||||
catom = HashChain[i].Entry;
|
|
||||||
while (catom != NIL) {
|
|
||||||
AtomEntry *ap = RepAtom(catom);
|
|
||||||
Atom natom;
|
|
||||||
CELL hash;
|
|
||||||
|
|
||||||
hash = HashFunction((unsigned char *)ap->StrOfAE) % nsize;
|
|
||||||
natom = ap->NextOfAE;
|
|
||||||
ap->NextOfAE = ntb[hash].Entry;
|
|
||||||
ntb[hash].Entry = catom;
|
|
||||||
catom = natom;
|
|
||||||
}
|
|
||||||
READ_UNLOCK(HashChain[i].AERWLock);
|
|
||||||
}
|
|
||||||
Yap_FreeCodeSpace((char *)HashChain);
|
Yap_FreeCodeSpace((char *)HashChain);
|
||||||
HashChain = ntb;
|
HashChain = ntb;
|
||||||
AtomHashTableSize = nsize;
|
AtomHashTableSize = nsize;
|
||||||
@ -1056,11 +1074,25 @@ Yap_growheap(int fix_code, UInt in_size, void *cip)
|
|||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
Yap_PrologMode |= GrowHeapMode;
|
|
||||||
if (NOfAtoms > 2*AtomHashTableSize) {
|
if (NOfAtoms > 2*AtomHashTableSize) {
|
||||||
|
UInt n = NOfAtoms;
|
||||||
|
if (AGcThreshold)
|
||||||
|
Yap_atom_gc();
|
||||||
|
/* check if we have a significant improvement from agc */
|
||||||
|
if (n > NOfAtoms+ NOfAtoms/10 ||
|
||||||
|
NOfAtoms > 2*AtomHashTableSize) {
|
||||||
res = growatomtable();
|
res = growatomtable();
|
||||||
Yap_PrologMode &= ~GrowHeapMode;
|
} else {
|
||||||
return res;
|
LOCK(SignalLock);
|
||||||
|
if (ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||||
|
CreepFlag = CalculateStackGap();
|
||||||
|
}
|
||||||
|
ActiveSignals &= ~YAP_CDOVF_SIGNAL;
|
||||||
|
UNLOCK(SignalLock);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
Yap_PrologMode &= ~GrowHeapMode;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
res=do_growheap(fix_code, in_size, (struct intermediates *)cip);
|
res=do_growheap(fix_code, in_size, (struct intermediates *)cip);
|
||||||
Yap_PrologMode &= ~GrowHeapMode;
|
Yap_PrologMode &= ~GrowHeapMode;
|
||||||
@ -1424,7 +1456,7 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
|
|||||||
int
|
int
|
||||||
Yap_growtrail(long size, int contiguous_only)
|
Yap_growtrail(long size, int contiguous_only)
|
||||||
{
|
{
|
||||||
return do_growtrail(size, contiguous_only, FALSE, NULL, NULL, NULL);
|
return do_growtrail(size, contiguous_only, FALSE, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -1527,7 +1559,7 @@ p_growstack(void)
|
|||||||
|
|
||||||
static Int
|
static Int
|
||||||
p_inform_stack_overflows(void)
|
p_inform_stack_overflows(void)
|
||||||
{
|
{ /* */
|
||||||
Term tn = MkIntTerm(stack_overflows);
|
Term tn = MkIntTerm(stack_overflows);
|
||||||
Term tt = MkIntegerTerm(total_stack_overflow_time);
|
Term tt = MkIntegerTerm(total_stack_overflow_time);
|
||||||
|
|
||||||
|
29
C/init.c
29
C/init.c
@ -268,7 +268,8 @@ OpDec(int p, char *type, Atom a, Term m)
|
|||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
}
|
}
|
||||||
if (i <= 3) {
|
if (i <= 3) {
|
||||||
if (info->Posfix != 0) /* there is a posfix operator */ {
|
if (yap_flags[STRICT_ISO_FLAG] &&
|
||||||
|
info->Posfix != 0) /* there is a posfix operator */ {
|
||||||
/* ISO dictates */
|
/* ISO dictates */
|
||||||
WRITE_UNLOCK(info->OpRWLock);
|
WRITE_UNLOCK(info->OpRWLock);
|
||||||
Yap_Error(PERMISSION_ERROR_CREATE_OPERATOR,MkAtomTerm(a),"op/3");
|
Yap_Error(PERMISSION_ERROR_CREATE_OPERATOR,MkAtomTerm(a),"op/3");
|
||||||
@ -276,7 +277,8 @@ OpDec(int p, char *type, Atom a, Term m)
|
|||||||
}
|
}
|
||||||
info->Infix = p;
|
info->Infix = p;
|
||||||
} else if (i <= 5) {
|
} else if (i <= 5) {
|
||||||
if (info->Infix != 0) /* there is an infix operator */ {
|
if (yap_flags[STRICT_ISO_FLAG] &&
|
||||||
|
info->Infix != 0) /* there is an infix operator */ {
|
||||||
/* ISO dictates */
|
/* ISO dictates */
|
||||||
WRITE_UNLOCK(info->OpRWLock);
|
WRITE_UNLOCK(info->OpRWLock);
|
||||||
Yap_Error(PERMISSION_ERROR_CREATE_OPERATOR,MkAtomTerm(a),"op/3");
|
Yap_Error(PERMISSION_ERROR_CREATE_OPERATOR,MkAtomTerm(a),"op/3");
|
||||||
@ -1041,11 +1043,11 @@ InitCodes(void)
|
|||||||
Yap_heap_regs->system_profiling = FALSE;
|
Yap_heap_regs->system_profiling = FALSE;
|
||||||
Yap_heap_regs->system_call_counting = FALSE;
|
Yap_heap_regs->system_call_counting = FALSE;
|
||||||
Yap_heap_regs->system_pred_goal_expansion_all = FALSE;
|
Yap_heap_regs->system_pred_goal_expansion_all = FALSE;
|
||||||
Yap_heap_regs->system_pred_goal_expansion_func = FALSE;
|
|
||||||
Yap_heap_regs->system_pred_goal_expansion_on = FALSE;
|
Yap_heap_regs->system_pred_goal_expansion_on = FALSE;
|
||||||
Yap_heap_regs->update_mode = UPDATE_MODE_LOGICAL;
|
Yap_heap_regs->update_mode = UPDATE_MODE_LOGICAL;
|
||||||
Yap_heap_regs->compiler_compile_mode = 0; /* fast will be for native code */
|
Yap_heap_regs->compiler_compile_mode = 0; /* fast will be for native code */
|
||||||
Yap_heap_regs->compiler_optimizer_on = TRUE;
|
Yap_heap_regs->compiler_optimizer_on = TRUE;
|
||||||
|
Yap_heap_regs->compiler_compile_arrays = FALSE;
|
||||||
Yap_heap_regs->maxdepth = 0;
|
Yap_heap_regs->maxdepth = 0;
|
||||||
Yap_heap_regs->maxlist = 0;
|
Yap_heap_regs->maxlist = 0;
|
||||||
Yap_heap_regs->maxwriteargs = 0;
|
Yap_heap_regs->maxwriteargs = 0;
|
||||||
@ -1221,6 +1223,9 @@ InitCodes(void)
|
|||||||
Yap_heap_regs->file_aliases = NULL;
|
Yap_heap_regs->file_aliases = NULL;
|
||||||
Yap_heap_regs->foreign_code_loaded = NULL;
|
Yap_heap_regs->foreign_code_loaded = NULL;
|
||||||
Yap_heap_regs->yap_lib_dir = NULL;
|
Yap_heap_regs->yap_lib_dir = NULL;
|
||||||
|
Yap_heap_regs->agc_last_call = 0;
|
||||||
|
/* should be 10000 */
|
||||||
|
Yap_heap_regs->agc_threshold = 0;
|
||||||
Yap_heap_regs->agc_hook = NULL;
|
Yap_heap_regs->agc_hook = NULL;
|
||||||
Yap_heap_regs->parser_error_style = EXCEPTION_ON_PARSER_ERROR;
|
Yap_heap_regs->parser_error_style = EXCEPTION_ON_PARSER_ERROR;
|
||||||
Yap_heap_regs->size_of_overflow = 0;
|
Yap_heap_regs->size_of_overflow = 0;
|
||||||
@ -1351,6 +1356,9 @@ Yap_InitWorkspace(int Heap, int Stack, int Trail, int max_table_size,
|
|||||||
Yap_LUIndexSpace_CP = 0;
|
Yap_LUIndexSpace_CP = 0;
|
||||||
Yap_LUIndexSpace_EXT = 0;
|
Yap_LUIndexSpace_EXT = 0;
|
||||||
Yap_LUIndexSpace_SW = 0;
|
Yap_LUIndexSpace_SW = 0;
|
||||||
|
#if USE_THREADED_CODE
|
||||||
|
Yap_heap_regs->op_rtable = NULL;
|
||||||
|
#endif
|
||||||
#if defined(YAPOR) || defined(TABLING)
|
#if defined(YAPOR) || defined(TABLING)
|
||||||
Yap_init_global(max_table_size, n_workers, sch_loop, delay_load);
|
Yap_init_global(max_table_size, n_workers, sch_loop, delay_load);
|
||||||
#endif /* YAPOR || TABLING */
|
#endif /* YAPOR || TABLING */
|
||||||
@ -1392,6 +1400,21 @@ Yap_InitWorkspace(int Heap, int Stack, int Trail, int max_table_size,
|
|||||||
Yap_LookupAtomWithAddress(".",&(SF_STORE->AtDot));
|
Yap_LookupAtomWithAddress(".",&(SF_STORE->AtDot));
|
||||||
#endif
|
#endif
|
||||||
/* InitAbsmi must be done before InitCodes */
|
/* InitAbsmi must be done before InitCodes */
|
||||||
|
/* This must be done before initialising predicates */
|
||||||
|
Yap_heap_regs->system_pred_goal_expansion_func = FALSE;
|
||||||
|
for (i = 0; i <= TABLING_MODE_FLAG; i++) {
|
||||||
|
yap_flags[i] = 0;
|
||||||
|
}
|
||||||
|
GcCalls = 0;
|
||||||
|
#ifdef LOW_PROF
|
||||||
|
ProfilerOn = FALSE;
|
||||||
|
#endif
|
||||||
|
ActiveSignals = 0;
|
||||||
|
DoingUndefp = FALSE;
|
||||||
|
FPreds = NULL;
|
||||||
|
DBErasedList = NULL;
|
||||||
|
DBErasedIList = NULL;
|
||||||
|
Yap_heap_regs->IntLUKeys = NULL;
|
||||||
#ifdef MPW
|
#ifdef MPW
|
||||||
Yap_InitAbsmi(REGS, FunctorList);
|
Yap_InitAbsmi(REGS, FunctorList);
|
||||||
#else
|
#else
|
||||||
|
@ -202,6 +202,7 @@ GetFreeStreamD(void)
|
|||||||
if (sno == MaxStreams) {
|
if (sno == MaxStreams) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Stream[sno].encoding = DefaultEncoding();
|
||||||
INIT_LOCK(Stream[sno].streamlock);
|
INIT_LOCK(Stream[sno].streamlock);
|
||||||
return sno;
|
return sno;
|
||||||
}
|
}
|
||||||
@ -385,6 +386,7 @@ InitStdStream (int sno, SMALLUNSGN flags, YP_File file)
|
|||||||
s->linepos = 0;
|
s->linepos = 0;
|
||||||
s->linecount = 1;
|
s->linecount = 1;
|
||||||
s->charcount = 0;
|
s->charcount = 0;
|
||||||
|
s->encoding = DefaultEncoding();
|
||||||
INIT_LOCK(s->streamlock);
|
INIT_LOCK(s->streamlock);
|
||||||
unix_upd_stream_info (s);
|
unix_upd_stream_info (s);
|
||||||
/* Getting streams to prompt is a mess because we need for cooperation
|
/* Getting streams to prompt is a mess because we need for cooperation
|
||||||
@ -2459,6 +2461,7 @@ p_open_mem_read_stream (void) /* $open_mem_read_stream(+List,-Stream) */
|
|||||||
ti = TailOfTerm(ti);
|
ti = TailOfTerm(ti);
|
||||||
}
|
}
|
||||||
nbuf[nchars] = '\0';
|
nbuf[nchars] = '\0';
|
||||||
|
fprintf(stderr,"nbuf=%s\n",nbuf);
|
||||||
sno = open_buf_read_stream(nbuf, nchars);
|
sno = open_buf_read_stream(nbuf, nchars);
|
||||||
t = MkStream (sno);
|
t = MkStream (sno);
|
||||||
return (Yap_unify (ARG2, t));
|
return (Yap_unify (ARG2, t));
|
||||||
|
44
C/save.c
44
C/save.c
@ -114,7 +114,6 @@ 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 *));
|
||||||
STATIC_PROTO(void RestoreInvisibleAtoms, (void));
|
|
||||||
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
|
||||||
@ -1260,14 +1259,11 @@ RestoreFreeSpace(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* restore the atom entries which are invisible for the user */
|
|
||||||
static void
|
static void
|
||||||
RestoreInvisibleAtoms(void)
|
RestoreAtomList(Atom atm)
|
||||||
{
|
{
|
||||||
AtomEntry *at;
|
AtomEntry *at;
|
||||||
Atom atm = INVISIBLECHAIN.Entry;
|
|
||||||
|
|
||||||
INVISIBLECHAIN.Entry = atm = AtomAdjust(atm);
|
|
||||||
at = RepAtom(atm);
|
at = RepAtom(atm);
|
||||||
if (EndOfPAEntr(at))
|
if (EndOfPAEntr(at))
|
||||||
return;
|
return;
|
||||||
@ -1284,6 +1280,7 @@ RestoreInvisibleAtoms(void)
|
|||||||
while (!EndOfPAEntr(at));
|
while (!EndOfPAEntr(at));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the really tough part, to restore the whole of the heap
|
* This is the really tough part, to restore the whole of the heap
|
||||||
*/
|
*/
|
||||||
@ -1293,43 +1290,18 @@ restore_heap(void)
|
|||||||
AtomHashEntry *HashPtr = HashChain;
|
AtomHashEntry *HashPtr = HashChain;
|
||||||
register int i;
|
register int i;
|
||||||
for (i = 0; i < AtomHashTableSize; ++i) {
|
for (i = 0; i < AtomHashTableSize; ++i) {
|
||||||
Atom atm = HashPtr->Entry;
|
HashPtr->Entry = AtomAdjust(HashPtr->Entry);
|
||||||
if (atm) {
|
RestoreAtomList(HashPtr->Entry);
|
||||||
AtomEntry *at;
|
|
||||||
HashPtr->Entry = atm = AtomAdjust(atm);
|
|
||||||
at = RepAtom(atm);
|
|
||||||
do {
|
|
||||||
#ifdef DEBUG_RESTORE2 /* useful during debug */
|
|
||||||
fprintf(errout, "Restoring %s\n", at->StrOfAE);
|
|
||||||
#endif
|
|
||||||
at->PropsOfAE = PropAdjust(at->PropsOfAE);
|
|
||||||
RestoreEntries(RepProp(at->PropsOfAE));
|
|
||||||
atm = at->NextOfAE = AtomAdjust(at->NextOfAE);
|
|
||||||
at = RepAtom(atm);
|
|
||||||
} while (!EndOfPAEntr(at));
|
|
||||||
}
|
|
||||||
HashPtr++;
|
HashPtr++;
|
||||||
}
|
}
|
||||||
HashPtr = WideHashChain;
|
HashPtr = WideHashChain;
|
||||||
for (i = 0; i < WideAtomHashTableSize; ++i) {
|
for (i = 0; i < WideAtomHashTableSize; ++i) {
|
||||||
Atom atm = HashPtr->Entry;
|
HashPtr->Entry = AtomAdjust(HashPtr->Entry);
|
||||||
if (atm) {
|
RestoreAtomList(HashPtr->Entry);
|
||||||
AtomEntry *at;
|
|
||||||
HashPtr->Entry = atm = AtomAdjust(atm);
|
|
||||||
at = RepAtom(atm);
|
|
||||||
do {
|
|
||||||
#ifdef DEBUG_RESTORE2 /* useful during debug */
|
|
||||||
fprintf(errout, "Restoring %s\n", at->StrOfAE);
|
|
||||||
#endif
|
|
||||||
at->PropsOfAE = PropAdjust(at->PropsOfAE);
|
|
||||||
RestoreEntries(RepProp(at->PropsOfAE));
|
|
||||||
atm = at->NextOfAE = AtomAdjust(at->NextOfAE);
|
|
||||||
at = RepAtom(atm);
|
|
||||||
} while (!EndOfPAEntr(at));
|
|
||||||
}
|
|
||||||
HashPtr++;
|
HashPtr++;
|
||||||
}
|
}
|
||||||
RestoreInvisibleAtoms();
|
INVISIBLECHAIN.Entry = AtomAdjust(INVISIBLECHAIN.Entry);
|
||||||
|
RestoreAtomList(INVISIBLECHAIN.Entry);
|
||||||
RestoreForeignCodeStructure();
|
RestoreForeignCodeStructure();
|
||||||
RestoreIOStructures();
|
RestoreIOStructures();
|
||||||
}
|
}
|
||||||
|
6
H/Heap.h
6
H/Heap.h
@ -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.112 2006-12-29 01:57:50 vsc Exp $ *
|
* version: $Id: Heap.h,v 1.113 2007-02-18 00:26:36 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/* information that can be stored in Code Space */
|
/* information that can be stored in Code Space */
|
||||||
@ -521,6 +521,8 @@ typedef struct various_codes {
|
|||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
struct reduction_counters call_counters;
|
struct reduction_counters call_counters;
|
||||||
char *yap_lib_dir;
|
char *yap_lib_dir;
|
||||||
|
UInt agc_last_call; /* amount of space recovered in all garbage collections */
|
||||||
|
UInt agc_threshold; /* amount of space recovered in all garbage collections */
|
||||||
Agc_hook agc_hook;
|
Agc_hook agc_hook;
|
||||||
void *foreign_code_loaded;
|
void *foreign_code_loaded;
|
||||||
ADDR foreign_code_base;
|
ADDR foreign_code_base;
|
||||||
@ -824,6 +826,8 @@ struct various_codes *Yap_heap_regs;
|
|||||||
#define PredEntriesCounterOn Yap_heap_regs->call_counters.reductions_retries_on
|
#define PredEntriesCounterOn Yap_heap_regs->call_counters.reductions_retries_on
|
||||||
#define RetriesCounterOn Yap_heap_regs->call_counters.retries_on
|
#define RetriesCounterOn Yap_heap_regs->call_counters.retries_on
|
||||||
#define Yap_LibDir Yap_heap_regs->yap_lib_dir
|
#define Yap_LibDir Yap_heap_regs->yap_lib_dir
|
||||||
|
#define AGcLastCall Yap_heap_regs->agc_last_call
|
||||||
|
#define AGcThreshold Yap_heap_regs->agc_threshold
|
||||||
#define AGCHook Yap_heap_regs->agc_hook
|
#define AGCHook Yap_heap_regs->agc_hook
|
||||||
#define ParserErrorStyle Yap_heap_regs->parser_error_style
|
#define ParserErrorStyle Yap_heap_regs->parser_error_style
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
|
6
H/Yap.h
6
H/Yap.h
@ -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.19 2007-01-29 10:18:15 vsc Exp $ *
|
* version: $Id: Yap.h,v 1.20 2007-02-18 00:26:36 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -515,6 +515,7 @@ typedef enum
|
|||||||
FAST_BOOT_FLAG = 16,
|
FAST_BOOT_FLAG = 16,
|
||||||
STACK_DUMP_ON_ERROR_FLAG = 17,
|
STACK_DUMP_ON_ERROR_FLAG = 17,
|
||||||
INDEXING_MODE_FLAG = 18,
|
INDEXING_MODE_FLAG = 18,
|
||||||
|
/* let this be the last one */
|
||||||
TABLING_MODE_FLAG = 19
|
TABLING_MODE_FLAG = 19
|
||||||
} yap_flags;
|
} yap_flags;
|
||||||
|
|
||||||
@ -555,7 +556,8 @@ typedef enum
|
|||||||
YAP_BREAK_SIGNAL = 0x2000, /* received break signal */
|
YAP_BREAK_SIGNAL = 0x2000, /* received break signal */
|
||||||
YAP_STACK_DUMP_SIGNAL = 0x4000, /* received stack dump signal */
|
YAP_STACK_DUMP_SIGNAL = 0x4000, /* received stack dump signal */
|
||||||
YAP_STATISTICS_SIGNAL = 0x8000, /* received statistics */
|
YAP_STATISTICS_SIGNAL = 0x8000, /* received statistics */
|
||||||
YAP_DELAY_CREEP_SIGNAL = 0x10000 /* received a creep but should not do it */
|
YAP_DELAY_CREEP_SIGNAL = 0x10000, /* received a creep but should not do it */
|
||||||
|
YAP_AGC_SIGNAL = 0x20000 /* call atom garbage collector asap */
|
||||||
} yap_signals;
|
} yap_signals;
|
||||||
|
|
||||||
#define NUMBER_OF_YAP_FLAGS TABLING_MODE_FLAG + 1
|
#define NUMBER_OF_YAP_FLAGS TABLING_MODE_FLAG + 1
|
||||||
|
23
H/rheap.h
23
H/rheap.h
@ -11,8 +11,12 @@
|
|||||||
* File: rheap.h *
|
* File: rheap.h *
|
||||||
* comments: walk through heap code *
|
* comments: walk through heap code *
|
||||||
* *
|
* *
|
||||||
* Last rev: $Date: 2007-01-08 08:27:19 $,$Author: vsc $ *
|
* Last rev: $Date: 2007-02-18 00:26:36 $,$Author: vsc $ *
|
||||||
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
||||||
|
* Revision 1.72 2007/01/08 08:27:19 vsc
|
||||||
|
* fix restore (Trevor)
|
||||||
|
* make indexing a bit faster on IDB
|
||||||
|
*
|
||||||
* Revision 1.71 2006/11/27 17:42:03 vsc
|
* Revision 1.71 2006/11/27 17:42:03 vsc
|
||||||
* support for UNICODE, and other bug fixes.
|
* support for UNICODE, and other bug fixes.
|
||||||
*
|
*
|
||||||
@ -896,8 +900,14 @@ RestoreBB(BlackBoardEntry *pp)
|
|||||||
{
|
{
|
||||||
Term t = pp->Element;
|
Term t = pp->Element;
|
||||||
if (t) {
|
if (t) {
|
||||||
if (!IsVarTerm(t) && !IsAtomicTerm(t)) {
|
if (!IsVarTerm(t)) {
|
||||||
RestoreLUClause((LogUpdClause *)DBRefOfTerm(t),NULL);
|
if (IsAtomicTerm(t)) {
|
||||||
|
if (IsAtomTerm(t)) {
|
||||||
|
pp->Element = AtomTermAdjust(t);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
RestoreLUClause((LogUpdClause *)DBRefOfTerm(t),NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pp->KeyOfBB = AtomAdjust(pp->KeyOfBB);
|
pp->KeyOfBB = AtomAdjust(pp->KeyOfBB);
|
||||||
@ -1209,8 +1219,8 @@ RestoreEntries(PropEntry *pp)
|
|||||||
{
|
{
|
||||||
DBEntry *de = (DBEntry *) pp;
|
DBEntry *de = (DBEntry *) pp;
|
||||||
de->NextOfPE =
|
de->NextOfPE =
|
||||||
PropAdjust(de->NextOfPE); if (HDiff)
|
PropAdjust(de->NextOfPE);
|
||||||
RestoreDB(de);
|
RestoreDB(de);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BBProperty:
|
case BBProperty:
|
||||||
@ -1218,8 +1228,7 @@ RestoreEntries(PropEntry *pp)
|
|||||||
BlackBoardEntry *bb = (BlackBoardEntry *) pp;
|
BlackBoardEntry *bb = (BlackBoardEntry *) pp;
|
||||||
bb->NextOfPE =
|
bb->NextOfPE =
|
||||||
PropAdjust(bb->NextOfPE);
|
PropAdjust(bb->NextOfPE);
|
||||||
if (HDiff)
|
RestoreBB(bb);
|
||||||
RestoreBB(bb);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GlobalProperty:
|
case GlobalProperty:
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
<h2>Yap-5.1.2:</h2>
|
<h2>Yap-5.1.2:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> FIXED: by default,allow defining infix+prefix/posfix instead of
|
||||||
|
using standard ISO.</li>
|
||||||
<li> NEW: --with-max-workers tells us how many threads we can have (request from Paulo Moura).</li>
|
<li> NEW: --with-max-workers tells us how many threads we can have (request from Paulo Moura).</li>
|
||||||
<li> FIXED: wchar_t in the WIN32 is unsigned and 16 bits.</li>
|
<li> FIXED: wchar_t in the WIN32 is unsigned and 16 bits.</li>
|
||||||
<li> FIXED: stack overflow when growing the delay stack.</li>
|
<li> FIXED: stack overflow when growing the delay stack.</li>
|
||||||
|
468
docs/yap.tex
468
docs/yap.tex
File diff suppressed because it is too large
Load Diff
@ -867,7 +867,9 @@ bootstrap(F) :-
|
|||||||
H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
|
H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
|
||||||
format(user_error, '~*|% ~w consulted ~w bytes in ~d msecs~n', [LC,F,H,T])
|
format(user_error, '~*|% ~w consulted ~w bytes in ~d msecs~n', [LC,F,H,T])
|
||||||
),
|
),
|
||||||
!.
|
!,
|
||||||
|
'$close'(Stream).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'$loop'(Stream,Status) :-
|
'$loop'(Stream,Status) :-
|
||||||
|
Reference in New Issue
Block a user