More bug fixes for overflow handling
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1165 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
c3e3a72583
commit
3de4d0c6a5
@ -10,8 +10,11 @@
|
||||
* *
|
||||
* File: absmi.c *
|
||||
* comments: Portable abstract machine interpreter *
|
||||
* Last rev: $Date: 2004-10-14 22:14:52 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2004-10-26 20:15:36 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.149 2004/10/14 22:14:52 vsc
|
||||
* don't use a cached version of ARG1 in choice-points
|
||||
*
|
||||
* Revision 1.148 2004/09/30 21:37:40 vsc
|
||||
* fixes for thread support
|
||||
*
|
||||
@ -6730,7 +6733,7 @@ Yap_absmi(int inp)
|
||||
#ifdef YAPOR
|
||||
Op(or_last, sla);
|
||||
#else
|
||||
Op(or_last, e);
|
||||
Op(or_last, p);
|
||||
#endif /* YAPOR */
|
||||
BEGCHO(pt0);
|
||||
pt0 = B;
|
||||
@ -6759,7 +6762,7 @@ Yap_absmi(int inp)
|
||||
#ifdef YAPOR
|
||||
PREG = NEXTOP(PREG, sla);
|
||||
#else
|
||||
PREG = NEXTOP(PREG, e);
|
||||
PREG = NEXTOP(PREG, p);
|
||||
#endif /* YAPOR */
|
||||
SET_BB(PROTECT_FROZEN_B(B));
|
||||
GONext();
|
||||
|
18
C/alloc.c
18
C/alloc.c
@ -12,7 +12,7 @@
|
||||
* Last rev: *
|
||||
* mods: *
|
||||
* comments: allocating space *
|
||||
* version:$Id: alloc.c,v 1.60 2004-09-30 19:51:53 vsc Exp $ *
|
||||
* version:$Id: alloc.c,v 1.61 2004-10-26 20:15:47 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
#ifdef SCCS
|
||||
static char SccsId[] = "%W% %G%";
|
||||
@ -563,8 +563,6 @@ Yap_ExpandPreAllocCodeSpace(UInt sz)
|
||||
/* #define MAX_WORKSPACE 0x40000000L */
|
||||
#define MAX_WORKSPACE 0x80000000L
|
||||
|
||||
#define ALLOC_SIZE (64*1024)
|
||||
|
||||
static LPVOID brk;
|
||||
|
||||
static int
|
||||
@ -573,11 +571,10 @@ ExtendWorkSpace(Int s, int fixed_allocation)
|
||||
LPVOID b = brk;
|
||||
prolog_exec_mode OldPrologMode = Yap_PrologMode;
|
||||
|
||||
s = ((s+ (ALLOC_SIZE-1))/ALLOC_SIZE)*ALLOC_SIZE;
|
||||
Yap_PrologMode = ExtendStackMode;
|
||||
if (fixed_allocation)
|
||||
if (fixed_allocation) {
|
||||
b = VirtualAlloc(b, s, MEM_RESERVE, PAGE_NOACCESS);
|
||||
else {
|
||||
} else {
|
||||
b = VirtualAlloc(NULL, s, MEM_RESERVE, PAGE_NOACCESS);
|
||||
if (b && b < brk) {
|
||||
return ExtendWorkSpace(s, fixed_allocation);
|
||||
@ -1337,7 +1334,6 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
|
||||
{
|
||||
#if USE_MMAP || defined(_WIN32)
|
||||
MALLOC_T WorkSpaceTop0 = WorkSpaceTop;
|
||||
|
||||
#if SIZEOF_INT_P==4
|
||||
while (WorkSpaceTop < (MALLOC_T)0xc0000000L) {
|
||||
/* progress 1 MB */
|
||||
@ -1348,16 +1344,16 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
|
||||
#if defined(_WIN32)
|
||||
/* 487 happens when you step over someone else's memory */
|
||||
if (GetLastError() != 487) {
|
||||
/* I could not manage to allocate the memory*/
|
||||
fprintf(stderr,"I am in trouble here\n");
|
||||
break;
|
||||
WorkSpaceTop = WorkSpaceTop0;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
WorkSpaceTop = WorkSpaceTop0;
|
||||
#endif
|
||||
if (ExtendWorkSpace(s, 0))
|
||||
if (ExtendWorkSpace(s, 0)) {
|
||||
return WorkSpaceTop-WorkSpaceTop0;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
@ -11,8 +11,11 @@
|
||||
* File: amasm.c *
|
||||
* comments: abstract machine assembler *
|
||||
* *
|
||||
* Last rev: $Date: 2004-09-30 21:37:40 $ *
|
||||
* Last rev: $Date: 2004-10-26 20:15:48 $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.64 2004/09/30 21:37:40 vsc
|
||||
* fixes for thread support
|
||||
*
|
||||
* Revision 1.63 2004/09/27 20:45:02 vsc
|
||||
* Mega clauses
|
||||
* Fixes to sizeof(expand_clauses) which was being overestimated
|
||||
@ -2803,7 +2806,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
} while (either_inst[either_cont]->opc != opcode(_either));
|
||||
}
|
||||
#else
|
||||
code_p = a_e(_or_last, code_p, pass_no);
|
||||
code_p = a_pl(_or_last, cip->CurrentPred, code_p, pass_no);
|
||||
#endif /* YAPOR */
|
||||
clinfo.dealloc_found = FALSE;
|
||||
break;
|
||||
|
49
C/cdmgr.c
49
C/cdmgr.c
@ -11,8 +11,11 @@
|
||||
* File: cdmgr.c *
|
||||
* comments: Code manager *
|
||||
* *
|
||||
* Last rev: $Date: 2004-10-22 16:53:19 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2004-10-26 20:15:51 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.137 2004/10/22 16:53:19 vsc
|
||||
* bug fixes
|
||||
*
|
||||
* Revision 1.136 2004/10/06 16:55:46 vsc
|
||||
* change configure to support big mem configs
|
||||
* get rid of extra globals
|
||||
@ -180,11 +183,7 @@ STATIC_PROTO(void kill_first_log_iblock,(LogUpdIndex *, LogUpdIndex *, PredEntr
|
||||
(CODEADDR)(P) < (CODEADDR)(B)+(SZ))
|
||||
|
||||
static PredEntry *
|
||||
PredForChoicePt(choiceptr cp) {
|
||||
yamop *p_code = cp->cp_ap;
|
||||
|
||||
if (cp == NULL)
|
||||
return NULL;
|
||||
PredForChoicePt(yamop *p_code) {
|
||||
while (TRUE) {
|
||||
op_numbers opnum = Yap_op_from_opcode(p_code->opc);
|
||||
switch(opnum) {
|
||||
@ -220,9 +219,9 @@ PredForChoicePt(choiceptr cp) {
|
||||
}
|
||||
case _or_last:
|
||||
#ifdef YAPOR
|
||||
return p_code->u.ldl.p;
|
||||
#else
|
||||
return p_code->u.sla.p0;
|
||||
#else
|
||||
return p_code->u.p.p;
|
||||
#endif
|
||||
break;
|
||||
case _trust_logical_pred:
|
||||
@ -242,7 +241,9 @@ PredForChoicePt(choiceptr cp) {
|
||||
|
||||
PredEntry *
|
||||
Yap_PredForChoicePt(choiceptr cp) {
|
||||
return PredForChoicePt(cp);
|
||||
if (cp == NULL)
|
||||
return NULL;
|
||||
return PredForChoicePt(cp->cp_ap);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
@ -2712,7 +2713,10 @@ search_for_static_predicate_in_use(PredEntry *p, int check_everything)
|
||||
}
|
||||
/* now mark the choicepoint */
|
||||
|
||||
pe = PredForChoicePt(b_ptr);
|
||||
if (b_ptr)
|
||||
pe = PredForChoicePt(b_ptr->cp_ap);
|
||||
else
|
||||
return NULL;
|
||||
if (pe == p) {
|
||||
if (check_everything)
|
||||
return TRUE;
|
||||
@ -2784,8 +2788,10 @@ do_toggle_static_predicates_in_use(int mask)
|
||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
||||
}
|
||||
/* now mark the choicepoint */
|
||||
if ((pe = PredForChoicePt(b_ptr))) {
|
||||
if ((b_ptr)) {
|
||||
if (pe = PredForChoicePt(b_ptr->cp_ap)) {
|
||||
mark_pred(mask, pe);
|
||||
}
|
||||
}
|
||||
env_ptr = b_ptr->cp_env;
|
||||
b_ptr = b_ptr->cp_b;
|
||||
@ -3068,8 +3074,25 @@ PredForCode(yamop *codeptr, Atom *pat, UInt *parity, Term *pmodule) {
|
||||
}
|
||||
|
||||
Int
|
||||
Yap_PredForCode(yamop *codeptr, Atom *pat, UInt *parity, Term *pmodule) {
|
||||
return PredForCode(codeptr, pat, parity, pmodule);
|
||||
Yap_PredForCode(yamop *codeptr, find_pred_type where_from, Atom *pat, UInt *parity, Term *pmodule) {
|
||||
PredEntry *p;
|
||||
|
||||
if (where_from == FIND_PRED_FROM_CP) {
|
||||
p = PredForChoicePt(codeptr);
|
||||
} else if (where_from == FIND_PRED_FROM_ENV) {
|
||||
p = EnvPreg(codeptr);
|
||||
} else {
|
||||
return PredForCode(codeptr, pat, parity, pmodule);
|
||||
}
|
||||
if (p == NULL) {
|
||||
return 0;
|
||||
}
|
||||
clause_was_found(p, pat, parity);
|
||||
if (p->ModuleOfPred == PROLOG_MODULE)
|
||||
*pmodule = ModuleName[0];
|
||||
else
|
||||
*pmodule = p->ModuleOfPred;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
24
C/dbase.c
24
C/dbase.c
@ -251,9 +251,7 @@ STATIC_PROTO(PredEntry *new_lu_int_key, (Int));
|
||||
STATIC_PROTO(PredEntry *find_lu_entry, (Term));
|
||||
STATIC_PROTO(DBProp find_int_key, (Int));
|
||||
|
||||
#if OS_HANDLES_TR_OVERFLOW
|
||||
#define db_check_trail(x)
|
||||
#elif USE_SYSTEM_MALLOC
|
||||
#if USE_SYSTEM_MALLOC
|
||||
#define db_check_trail(x) { \
|
||||
if (Unsigned(dbg->tofref) == Unsigned(x)) { \
|
||||
goto error_tr_overflow; \
|
||||
@ -262,9 +260,7 @@ STATIC_PROTO(DBProp find_int_key, (Int));
|
||||
#else
|
||||
#define db_check_trail(x) { \
|
||||
if (Unsigned(dbg->tofref) == Unsigned(x)) { \
|
||||
if(!Yap_growtrail (sizeof(CELL) * 16 * 1024L)) { \
|
||||
goto error_tr_overflow; \
|
||||
} \
|
||||
goto error_tr_overflow; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
@ -690,16 +686,16 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
||||
ap2 = RepAppl(d0);
|
||||
#ifdef RATIONAL_TREES
|
||||
if (ap2 >= tbase && ap2 < StoPoint) {
|
||||
db_check_trail(dbg->lr+1);
|
||||
*dbg->lr++ = ToSmall((CELL)(StoPoint)-(CELL)(tbase));
|
||||
db_check_trail(dbg->lr);
|
||||
*StoPoint++ = d0;
|
||||
++pt0;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifdef IDB_LINK_TABLE
|
||||
db_check_trail(dbg->lr+1);
|
||||
*dbg->lr++ = ToSmall((CELL)(StoPoint)-(CELL)(tbase));
|
||||
db_check_trail(dbg->lr);
|
||||
#endif
|
||||
f = (Functor)(*ap2);
|
||||
if (IsExtensionFunctor(f)) {
|
||||
@ -808,15 +804,15 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
||||
CELL *ap2 = RepPair(d0);
|
||||
if (ap2 >= tbase && ap2 < StoPoint) {
|
||||
*StoPoint++ = d0;
|
||||
db_check_trail(dbg->lr+1);
|
||||
*dbg->lr++ = ToSmall((CELL)(StoPoint)-(CELL)(tbase));
|
||||
db_check_trail(dbg->lr);
|
||||
++pt0;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifdef IDB_LINK_TABLE
|
||||
db_check_trail(dbg->lr+1);
|
||||
*dbg->lr++ = ToSmall((CELL)(StoPoint)-(CELL)(tbase));
|
||||
db_check_trail(dbg->lr);
|
||||
#endif
|
||||
#ifdef IDB_USE_MBIT
|
||||
*StoPoint++ =
|
||||
@ -901,8 +897,8 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
||||
/* the copy we keep will be the current displacement */
|
||||
*StoPoint = (CELL)StoPoint;
|
||||
StoPoint++;
|
||||
db_check_trail(dbg->lr+1);
|
||||
*dbg->lr++ = ToSmall(displacement);
|
||||
db_check_trail(dbg->lr);
|
||||
#endif
|
||||
#endif
|
||||
/* indicate we found variables */
|
||||
@ -933,8 +929,8 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
||||
} else {
|
||||
/* references need to be offset at read time */
|
||||
#ifdef IDB_LINK_TABLE
|
||||
db_check_trail(dbg->lr+1);
|
||||
*dbg->lr++ = ToSmall(displacement);
|
||||
db_check_trail(dbg->lr);
|
||||
#endif
|
||||
/* store the offset */
|
||||
#ifdef IDB_USE_MBIT
|
||||
@ -1077,8 +1073,8 @@ sf_include(SFKeep *sfp, struct db_globs *dbg)
|
||||
if (sfp->SFather != NIL)
|
||||
*(sfp->SFather) = AbsAppl(displacement);
|
||||
*StoPoint++ = FunctorOfTerm(Tm);
|
||||
db_check_trail(dbg->lr+1);
|
||||
*dbg->lr++ = ToSmall(displacement + 1);
|
||||
db_check_trail(dbg->lr);
|
||||
*StoPoint++ = (Term) (displacement + 1);
|
||||
while (*tp) {
|
||||
arg_no = *tp++;
|
||||
@ -1086,8 +1082,8 @@ sf_include(SFKeep *sfp, struct db_globs *dbg)
|
||||
if (IsVarTerm(tvalue)) {
|
||||
if (((VarKeep *) tvalue)->NOfVars != 0) {
|
||||
*StoPoint++ = arg_no;
|
||||
db_check_trail(dbg->lr+1);
|
||||
*dbg->lr++ = ToSmall(displacement + j);
|
||||
db_check_trail(dbg->lr);
|
||||
if (((VarKeep *) tvalue)->New == 0)
|
||||
*StoPoint++ = ((VarKeep *) tvalue)->New = Unsigned(displacement + j);
|
||||
else
|
||||
|
27
C/errors.c
27
C/errors.c
@ -34,7 +34,7 @@
|
||||
STATIC_PROTO (int hidden, (Atom));
|
||||
STATIC_PROTO (int legal_env, (CELL *));
|
||||
void STD_PROTO (DumpActiveGoals, (void));
|
||||
STATIC_PROTO (void detect_bug_location, (yamop *,char *, int));
|
||||
STATIC_PROTO (void detect_bug_location, (yamop *,find_pred_type,char *, int));
|
||||
|
||||
#define ONHEAP(ptr) (CellPtr(ptr) >= CellPtr(Yap_HeapBase) && CellPtr(ptr) < CellPtr(HeapTop))
|
||||
|
||||
@ -174,14 +174,14 @@ DumpActiveGoals (void)
|
||||
#endif /* DEBUG */
|
||||
|
||||
static void
|
||||
detect_bug_location(yamop *yap_pc, char *tp, int psize)
|
||||
detect_bug_location(yamop *yap_pc, find_pred_type where_from, char *tp, int psize)
|
||||
{
|
||||
Atom pred_name;
|
||||
UInt pred_arity;
|
||||
Term pred_module;
|
||||
Int cl;
|
||||
|
||||
if ((cl = Yap_PredForCode(yap_pc, &pred_name, &pred_arity, &pred_module))
|
||||
if ((cl = Yap_PredForCode(yap_pc, where_from, &pred_name, &pred_arity, &pred_module))
|
||||
== 0) {
|
||||
/* system predicate */
|
||||
#if HAVE_SNPRINTF
|
||||
@ -258,10 +258,10 @@ detect_bug_location(yamop *yap_pc, char *tp, int psize)
|
||||
}
|
||||
|
||||
static void
|
||||
cl_position(yamop *ptr)
|
||||
cl_position(yamop *ptr, find_pred_type where_from)
|
||||
{
|
||||
char tp[256];
|
||||
detect_bug_location(ptr, tp, 256);
|
||||
detect_bug_location(ptr, where_from, tp, 256);
|
||||
fprintf(stderr," %s\n", tp);
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ dump_stack(void)
|
||||
if (b_ptr != NULL) {
|
||||
fprintf(stderr," %% Goals with open alternatives:\n");
|
||||
while (b_ptr != NULL) {
|
||||
cl_position(b_ptr->cp_ap);
|
||||
cl_position(b_ptr->cp_ap, FIND_PRED_FROM_CP);
|
||||
b_ptr = b_ptr->cp_b;
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
@ -287,7 +287,7 @@ dump_stack(void)
|
||||
if (env_ptr != NULL) {
|
||||
fprintf(stderr," %% Goals left to continue:\n");
|
||||
while (env_ptr != NULL) {
|
||||
cl_position((yamop *)(env_ptr[E_CP]));
|
||||
cl_position((yamop *)(env_ptr[E_CP]), FIND_PRED_FROM_ENV);
|
||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
@ -307,16 +307,13 @@ error_exit_yap (int value)
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
static void
|
||||
bug_location(yamop *pc)
|
||||
void
|
||||
Yap_bug_location(yamop *pc)
|
||||
{
|
||||
detect_bug_location(pc, (char *)H, 256);
|
||||
detect_bug_location(pc, FIND_PRED_FROM_ANYWHERE, (char *)H, 256);
|
||||
fprintf(stderr,"%s\n",(char *)H);
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
/* This needs to be a static because I can't trust the stack (WIN32), and
|
||||
@ -427,7 +424,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
|
||||
{
|
||||
fprintf(stderr,"%% Internal YAP Error: %s exiting....\n",tmpbuf);
|
||||
serious = TRUE;
|
||||
detect_bug_location(P, tmpbuf, YAP_BUF_SIZE);
|
||||
detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, tmpbuf, YAP_BUF_SIZE);
|
||||
fprintf(stderr,"%% Bug found while executing %s\n",tmpbuf);
|
||||
error_exit_yap (1);
|
||||
}
|
||||
|
24
C/grow.c
24
C/grow.c
@ -552,7 +552,7 @@ static_growheap(long size, int fix_code, struct intermediates *cip)
|
||||
minimal_request = size;
|
||||
size = Yap_ExtendWorkSpaceThroughHole(size);
|
||||
if (size < 0) {
|
||||
strncat(Yap_ErrorMessage,": heap crashed against stacks", MAX_ERROR_MSG_SIZE);
|
||||
Yap_ErrorMessage = "Database crashed against Stacks";
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -560,8 +560,8 @@ static_growheap(long size, int fix_code, struct intermediates *cip)
|
||||
gc_verbose = Yap_is_gc_verbose();
|
||||
heap_overflows++;
|
||||
if (gc_verbose) {
|
||||
fprintf(Yap_stderr, "[HO] Heap overflow %d\n", heap_overflows);
|
||||
fprintf(Yap_stderr, "[HO] growing the heap %ld bytes\n", size);
|
||||
fprintf(Yap_stderr, "%% Database overflow %d\n", heap_overflows);
|
||||
fprintf(Yap_stderr, "%% growing the heap %ld bytes\n", size);
|
||||
}
|
||||
/* CreepFlag is set to force heap expansion */
|
||||
if (ActiveSignals == YAP_CDOVF_SIGNAL) {
|
||||
@ -592,8 +592,8 @@ static_growheap(long size, int fix_code, struct intermediates *cip)
|
||||
growth_time = Yap_cputime()-start_growth_time;
|
||||
total_heap_overflow_time += growth_time;
|
||||
if (gc_verbose) {
|
||||
fprintf(Yap_stderr, "[HO] took %g sec\n", (double)growth_time/1000);
|
||||
fprintf(Yap_stderr, "[HO] Total of %g sec expanding heap \n", (double)total_heap_overflow_time/1000);
|
||||
fprintf(Yap_stderr, "%% took %g sec\n", (double)growth_time/1000);
|
||||
fprintf(Yap_stderr, "%% Total of %g sec expanding Database\n", (double)total_heap_overflow_time/1000);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
@ -609,15 +609,15 @@ static_growglobal(long size, CELL **ptr)
|
||||
size = AdjustPageSize(size);
|
||||
Yap_ErrorMessage = NULL;
|
||||
if (!Yap_ExtendWorkSpace(size)) {
|
||||
strncat(Yap_ErrorMessage,": global crashed against local", MAX_ERROR_MSG_SIZE);
|
||||
Yap_ErrorMessage = "Global Stack crashed against Local Stack";
|
||||
return(FALSE);
|
||||
}
|
||||
start_growth_time = Yap_cputime();
|
||||
gc_verbose = Yap_is_gc_verbose();
|
||||
delay_overflows++;
|
||||
if (gc_verbose) {
|
||||
fprintf(Yap_stderr, "[DO] Delay overflow %d\n", delay_overflows);
|
||||
fprintf(Yap_stderr, "[DO] growing the stacks %ld bytes\n", size);
|
||||
fprintf(Yap_stderr, "%% DO Delay overflow %d\n", delay_overflows);
|
||||
fprintf(Yap_stderr, "%% DO growing the stacks %ld bytes\n", size);
|
||||
}
|
||||
ASP -= 256;
|
||||
YAPEnterCriticalSection();
|
||||
@ -635,8 +635,8 @@ static_growglobal(long size, CELL **ptr)
|
||||
growth_time = Yap_cputime()-start_growth_time;
|
||||
total_delay_overflow_time += growth_time;
|
||||
if (gc_verbose) {
|
||||
fprintf(Yap_stderr, "[DO] took %g sec\n", (double)growth_time/1000);
|
||||
fprintf(Yap_stderr, "[DO] Total of %g sec expanding stacks \n", (double)total_delay_overflow_time/1000);
|
||||
fprintf(Yap_stderr, "%% DO took %g sec\n", (double)growth_time/1000);
|
||||
fprintf(Yap_stderr, "%% DO Total of %g sec expanding stacks \n", (double)total_delay_overflow_time/1000);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
@ -985,7 +985,7 @@ execute_growstack(long size0, int from_trail)
|
||||
|
||||
size = Yap_ExtendWorkSpaceThroughHole(minimal_request);
|
||||
if (size < 0) {
|
||||
strncat(Yap_ErrorMessage,": heap crashed against stacks", MAX_ERROR_MSG_SIZE);
|
||||
Yap_ErrorMessage = "Database crashed against stacks";
|
||||
return FALSE;
|
||||
}
|
||||
YAPEnterCriticalSection();
|
||||
@ -1173,7 +1173,7 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
|
||||
size = AdjustPageSize(size);
|
||||
Yap_ErrorMessage = NULL;
|
||||
if (!Yap_ExtendWorkSpace(size)) {
|
||||
strncat(Yap_ErrorMessage,": parser stack overflowed", MAX_ERROR_MSG_SIZE);
|
||||
Yap_ErrorMessage = "Parser stack overflowed";
|
||||
return(FALSE);
|
||||
}
|
||||
start_growth_time = Yap_cputime();
|
||||
|
@ -1040,7 +1040,7 @@ SearchForTrailFault(void)
|
||||
/* my_signal_info(SIGSEGV, HandleSIGSEGV); */
|
||||
} else
|
||||
#endif /* OS_HANDLES_TR_OVERFLOW */
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil,
|
||||
Yap_Error(FATAL_ERROR, TermNil,
|
||||
"likely bug in YAP, segmentation violation");
|
||||
}
|
||||
|
||||
@ -1048,8 +1048,7 @@ static RETSIGTYPE
|
||||
HandleSIGSEGV(int sig)
|
||||
{
|
||||
if (Yap_PrologMode & ExtendStackMode) {
|
||||
fprintf(stderr, "%% YAP FATAL ERROR: OS memory allocation crashed: bailing out~n");
|
||||
exit(1);
|
||||
Yap_Error(FATAL_ERROR, TermNil, "OS memory allocation crashed at address %p, bailing out\n",Yap_TrailTop);
|
||||
}
|
||||
SearchForTrailFault();
|
||||
}
|
||||
|
@ -11,8 +11,17 @@
|
||||
* File: YapOpcodes.h *
|
||||
* comments: Central Table with all YAP opcodes *
|
||||
* *
|
||||
* Last rev: $Date: 2004-09-27 20:45:04 $ *
|
||||
* Last rev: $Date: 2004-10-26 20:16:04 $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.24 2004/09/27 20:45:04 vsc
|
||||
* Mega clauses
|
||||
* Fixes to sizeof(expand_clauses) which was being overestimated
|
||||
* Fixes to profiling+indexing
|
||||
* Fixes to reallocation of memory after restoring
|
||||
* Make sure all clauses, even for C, end in _Ystop
|
||||
* Don't reuse space for Streams
|
||||
* Fix Stream_F on StreaNo+1
|
||||
*
|
||||
* Revision 1.23 2004/03/31 01:03:10 vsc
|
||||
* support expand group of clauses
|
||||
*
|
||||
@ -152,7 +161,7 @@
|
||||
#ifdef YAPOR
|
||||
OPCODE(or_last ,sla),
|
||||
#else
|
||||
OPCODE(or_last ,e),
|
||||
OPCODE(or_last ,p),
|
||||
#endif /* YAPOR */
|
||||
OPCODE(call_cpred ,sla),
|
||||
OPCODE(call_usercpred ,sla),
|
||||
|
@ -10,7 +10,7 @@
|
||||
* File: Yap.proto *
|
||||
* mods: *
|
||||
* comments: Function declarations for YAP *
|
||||
* version: $Id: Yapproto.h,v 1.56 2004-09-27 20:45:04 vsc Exp $ *
|
||||
* version: $Id: Yapproto.h,v 1.57 2004-10-26 20:16:15 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/* prototype file for Yap */
|
||||
@ -107,7 +107,6 @@ Int STD_PROTO(YAP_Execute,(struct pred_entry *, CPredicate));
|
||||
/* cdmgr.c */
|
||||
Term STD_PROTO(Yap_all_calls,(void));
|
||||
Atom STD_PROTO(Yap_ConsultingFile,(void));
|
||||
Int STD_PROTO(Yap_PredForCode,(yamop *, Atom *, UInt *, Term *));
|
||||
struct pred_entry *STD_PROTO(Yap_PredForChoicePt,(choiceptr));
|
||||
void STD_PROTO(Yap_InitCdMgr,(void));
|
||||
#if EMACS
|
||||
|
@ -78,9 +78,16 @@ typedef struct FREEB {
|
||||
#define ALIGN_SIZE(X,SIZE) (((CELL)(X)+((SIZE)-1)) & ~((SIZE)-1))
|
||||
|
||||
/* I'll assume page size is always a power of two */
|
||||
#if _WIN32
|
||||
/* in WIN32 VirtualAlloc works in multiples of 64K */
|
||||
#define ALLOC_SIZE (64*1024)
|
||||
|
||||
#define AdjustPageSize(X) (((X)+ (ALLOC_SIZE-1))/ALLOC_SIZE)*ALLOC_SIZE;
|
||||
#else
|
||||
#define AdjustPageSize(X) ((X) & (Yap_page_size-1) ? \
|
||||
((X) + Yap_page_size) & (~(Yap_page_size-1)) : \
|
||||
(X) )
|
||||
#endif
|
||||
|
||||
#define BlockTrailer(b) ((YAP_SEG_SIZE *)b)[((BlockHeader *) b)->b_size]
|
||||
|
||||
|
14
H/clause.h
14
H/clause.h
@ -299,3 +299,17 @@ Yap_MegaClausePredicateFromTerm(Term t)
|
||||
return (PredEntry *)IntegerOfTerm(ArgOfTerm(1,t));
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
FIND_PRED_FROM_ANYWHERE,
|
||||
FIND_PRED_FROM_CP,
|
||||
FIND_PRED_FROM_ENV
|
||||
} find_pred_type;
|
||||
|
||||
Int STD_PROTO(Yap_PredForCode,(yamop *, find_pred_type, Atom *, UInt *, Term *));
|
||||
#ifdef DEBUG
|
||||
void STD_PROTO(Yap_bug_location,(yamop *));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
15
H/rheap.h
15
H/rheap.h
@ -11,8 +11,13 @@
|
||||
* File: rheap.h *
|
||||
* comments: walk through heap code *
|
||||
* *
|
||||
* Last rev: $Date: 2004-10-06 16:55:47 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2004-10-26 20:16:18 $,$Author: vsc $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.44 2004/10/06 16:55:47 vsc
|
||||
* change configure to support big mem configs
|
||||
* get rid of extra globals
|
||||
* fix trouble with multifile preds
|
||||
*
|
||||
* Revision 1.43 2004/09/27 20:45:04 vsc
|
||||
* Mega clauses
|
||||
* Fixes to sizeof(expand_clauses) which was being overestimated
|
||||
@ -648,7 +653,10 @@ restore_opcodes(yamop *pc)
|
||||
pc->u.Ill.l2 = PtoOpAdjust(pc->u.Ill.l2);
|
||||
pc = pc->u.Ill.l1;
|
||||
break;
|
||||
/* instructions type l */
|
||||
/* instructions type p */
|
||||
#if !defined(YAPOR)
|
||||
case _or_last:
|
||||
#endif
|
||||
case _enter_profiling:
|
||||
case _retry_profiled:
|
||||
case _lock_lu:
|
||||
@ -701,9 +709,6 @@ restore_opcodes(yamop *pc)
|
||||
case _write_void:
|
||||
case _write_list:
|
||||
case _write_l_list:
|
||||
#if !defined(YAPOR)
|
||||
case _or_last:
|
||||
#endif
|
||||
case _pop:
|
||||
case _index_pred:
|
||||
#if THREADS
|
||||
|
Reference in New Issue
Block a user