diff --git a/C/absmi.c b/C/absmi.c index aa9448861..8c304b920 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -10,8 +10,11 @@ * * * File: absmi.c * * comments: Portable abstract machine interpreter * -* Last rev: $Date: 2004-08-16 21:02:04 $,$Author: vsc $ * +* Last rev: $Date: 2004-09-17 19:34:49 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.143 2004/08/16 21:02:04 vsc +* more fixes for ! +* * Revision 1.142 2004/08/11 16:14:51 vsc * whole lot of fixes: * - memory leak in indexing @@ -1389,9 +1392,18 @@ Yap_absmi(int inp) ASP = YREG; saveregs(); while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { - if (!Yap_gc(3, ENV, CP)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - FAIL(); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + FAIL(); + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gc(3, ENV, CP)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + FAIL(); + } } } if (!Yap_IUnify(ARG2, t)) { diff --git a/C/arrays.c b/C/arrays.c index c005d47fc..010752cde 100644 --- a/C/arrays.c +++ b/C/arrays.c @@ -267,9 +267,18 @@ AccessNamedArray(Atom a, Int indx) READ_UNLOCK(ptr->ArRWLock); if (ref != NULL) { while ((TRef = Yap_FetchTermFromDB(ref)) == 0L) { - if (!Yap_gc(3, ENV, CP)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(TermNil); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return TermNil; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gc(3, ENV, CP)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return(TermNil); + } } } } else { @@ -1961,9 +1970,18 @@ p_static_array_to_term(void) if (ref != NULL) { while ((TRef = Yap_FetchTermFromDB(ref)) == 0L) { - if (!Yap_gc(3, YENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(TermNil); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return TermNil; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gc(3, YENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return TermNil; + } } } } else { diff --git a/C/bb.c b/C/bb.c index 49469d818..f6c180e22 100644 --- a/C/bb.c +++ b/C/bb.c @@ -272,9 +272,18 @@ p_bb_get(void) return(FALSE); READ_LOCK(p->BBRWLock); while ((out = Yap_FetchTermFromDB(p->Element)) == 0L) { - if (!Yap_gc(2, ENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(TermNil); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return TermNil; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gc(2, ENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return TermNil; + } } } READ_UNLOCK(p->BBRWLock); @@ -292,9 +301,18 @@ p_bb_delete(void) if (p == NULL || p->Element == NULL) return(FALSE); while ((out = Yap_FetchTermFromDB(p->Element)) == 0L) { - if (!Yap_gc(2, ENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(TermNil); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return TermNil; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gc(2, ENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return TermNil; + } } } WRITE_LOCK(p->BBRWLock); @@ -316,9 +334,18 @@ p_bb_update(void) return(FALSE); WRITE_LOCK(p->BBRWLock); while ((out = Yap_FetchTermFromDB(p->Element)) == 0L) { - if (!Yap_gc(3, ENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(TermNil); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return TermNil; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gc(3, ENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return TermNil; + } } } if (!Yap_unify(ARG2,out)) { diff --git a/C/cdmgr.c b/C/cdmgr.c index cb5103a1f..b4f485de0 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -11,8 +11,12 @@ * File: cdmgr.c * * comments: Code manager * * * -* Last rev: $Date: 2004-09-08 17:56:45 $,$Author: vsc $ * +* Last rev: $Date: 2004-09-17 19:34:51 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.131 2004/09/08 17:56:45 vsc +* source: a(X) :- true is a fact! +* fix use of value after possible overflow in IPred +* * Revision 1.130 2004/09/07 16:48:04 vsc * fix bug in unwinding trail at amiops.h * @@ -3316,9 +3320,18 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya ARG5 = th; ARG6 = tb; ARG7 = tr; - if (!Yap_gc(7, YENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return FALSE; + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gc(7, YENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } } th = ARG5; tb = ARG6; @@ -3427,9 +3440,18 @@ fetch_next_lu_clause0(PredEntry *pe, yamop *i_code, Term th, Term tb, yamop *cp_ while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { if (first_time) { - if (!Yap_gc(4, YENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return FALSE; + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gc(4, YENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } } } else { if (!Yap_gc(5, ENV, CP)) { @@ -3527,9 +3549,18 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr while ((t = Yap_FetchTermFromDB(cl->usc.ClSource)) == 0L) { if (first_time) { - if (!Yap_gc(4, YENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return FALSE; + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gc(4, YENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } } } else { if (!Yap_gc(5, ENV, CP)) { diff --git a/C/dbase.c b/C/dbase.c index c09be40db..0dd6e1dc6 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -21,6 +21,7 @@ static char SccsId[] = "%W% %G%"; #include "Yap.h" #include "clause.h" #include "yapio.h" +#include "attvar.h" #include "heapgc.h" #if HAVE_STRING_H #include @@ -2389,18 +2390,21 @@ p_still_variant(void) #ifdef COROUTINING -static void +static int copy_attachments(CELL *ts) { while (TRUE) { - Term t; + + attvar_record *orig = (attvar_record *)Yap_ReadTimedVar(DelayedVars); /* store away in case there is an overflow */ - *--ASP = ts[3]; - attas[IntegerOfTerm(ts[2])].term_to_op(ts[1], ts[0]); - t = *ASP; - ASP++; - if (t == TermNil) return; - ts = RepAppl(t)+1; + if (attas[IntegerOfTerm(ts[2])].term_to_op(ts[1], ts[0]) == FALSE) { + /* oops, we did not have enough space to copy the elements */ + /* reset queue of woken up goals */ + Yap_UpdateTimedVar(DelayedVars, (CELL)orig); + return FALSE; + } + if (ts[3] == TermNil) return TRUE; + ts = RepAppl(ts[3])+1; } } #endif @@ -2505,6 +2509,7 @@ GetDBTerm(DBTerm *DBSP) fprintf(Yap_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n"); Yap_exit( 1); } else { + Yap_Error_TYPE = OUT_OF_STACK_ERROR; Yap_Error_Size = NOf*sizeof(CELL); return (Term)0; } @@ -2520,9 +2525,11 @@ GetDBTerm(DBTerm *DBSP) #endif #ifdef COROUTINING if (DBSP->attachments != 0L) { - *--ASP = (CELL)HOld; - copy_attachments((CELL *)AdjustIDBPtr(DBSP->attachments,(CELL)HOld-(CELL)(DBSP->Contents))); - HOld = CellPtr(*ASP++); + if (!copy_attachments((CELL *)AdjustIDBPtr(DBSP->attachments,(CELL)HOld-(CELL)(DBSP->Contents)))) { + Yap_Error_TYPE = OUT_OF_ATTVARS_ERROR; + Yap_Error_Size = 0; + return (Term)0; + } } #endif return AdjustIDBPtr(t,Unsigned(HOld)-(CELL)(DBSP->Contents)); @@ -3113,10 +3120,20 @@ i_recorded(DBProp AtProp, Term t3) /* make sure the garbage collector sees what we want it to see! */ EXTRA_CBACK_ARG(3,1) = (CELL)ref; /* oops, we are in trouble, not enough stack space */ - if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } } + Yap_Error_Size = 0; twork = Deref(ARG2); t3 = Deref(ARG3); } @@ -3175,9 +3192,18 @@ i_recorded(DBProp AtProp, Term t3) EXTRA_CBACK_ARG(3,2) = MkIntegerTerm(((Int)mask)); EXTRA_CBACK_ARG(3,3) = MkIntegerTerm(((Int)key)); /* oops, we are in trouble, not enough stack space */ - if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return(FALSE); + } } READ_LOCK(AtProp->DBRWLock); } @@ -3262,10 +3288,20 @@ c_recorded(int flags) /* make sure the garbage collector sees what we want it to see! */ EXTRA_CBACK_ARG(3,1) = (CELL)ref; /* oops, we are in trouble, not enough stack space */ - if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return(FALSE); + } } + Yap_Error_Size = 0; PreviousHeap = H; } Yap_unify(ARG2, TermDB); @@ -3295,10 +3331,20 @@ c_recorded(int flags) /* make sure the garbage collector sees what we want it to see! */ EXTRA_CBACK_ARG(3,1) = (CELL)ref; /* oops, we are in trouble, not enough stack space */ - if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return(FALSE); + } } + Yap_Error_Size = 0; PreviousHeap = H; } if (Yap_unify(ARG2, TermDB)) @@ -3528,9 +3574,18 @@ p_first_instance(void) #endif while ((TermDB = GetDBTermFromDBEntry(ref)) == (CELL)0) { /* oops, we are in trouble, not enough stack space */ - if (!Yap_gcl(Yap_Error_Size, 3, ENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gcl(Yap_Error_Size, 3, ENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return(FALSE); + } } } if (IsVarTerm(TermDB)) { @@ -4428,9 +4483,18 @@ static_instance(StaticClause *cl) while ((TermDB = GetDBTerm(cl->usc.ClSource)) == 0L) { /* oops, we are in trouble, not enough stack space */ - if (!Yap_gcl(Yap_Error_Size, 2, ENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gcl(Yap_Error_Size, 2, ENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return(FALSE); + } } } return Yap_unify(ARG2, TermDB); @@ -4491,9 +4555,18 @@ p_instance(void) Term TermDB; while ((TermDB = GetDBTerm(cl->ClSource)) == 0L) { /* oops, we are in trouble, not enough stack space */ - if (!Yap_gcl(Yap_Error_Size, 2, ENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gcl(Yap_Error_Size, 2, ENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return(FALSE); + } } } return Yap_unify(ARG2, TermDB); @@ -4502,9 +4575,18 @@ p_instance(void) Term TermDB; while ((TermDB = GetDBTermFromDBEntry(dbr)) == 0L) { /* oops, we are in trouble, not enough stack space */ - if (!Yap_gcl(Yap_Error_Size, 2, ENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return(FALSE); + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gcl(Yap_Error_Size, 2, ENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return(FALSE); + } } t1 = Deref(ARG1); } @@ -4908,9 +4990,18 @@ p_dequeue(void) father_key->FirstInQueue = cur_instance->next; WRITE_UNLOCK(father_key->QRWLock); while ((TDB = GetDBTerm(cur_instance->DBT)) == 0L) { - if (!Yap_gcl(Yap_Error_Size, 2, YENV, P)) { - Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); - return FALSE; + if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_growglobal(NULL)) { + Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } + } else { + Yap_Error_TYPE = YAP_NO_ERROR; + if (!Yap_gcl(Yap_Error_Size, 2, YENV, P)) { + Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); + return FALSE; + } } } /* release space for cur_instance */ @@ -5095,6 +5186,7 @@ Yap_InitDBPreds(void) #ifdef DEBUG Yap_InitCPred("total_erased", 4, p_total_erased, SyncPredFlag); Yap_InitCPred("key_erased_statistics", 5, p_key_erased_statistics, SyncPredFlag); + Yap_InitCPred("predicate_erased_statistics", 5, p_predicate_erased_statistics, SyncPredFlag); Yap_InitCPred("heap_space_info", 3, p_heap_space_info, SyncPredFlag); #endif Yap_InitCPred("nth_instance", 3, p_nth_instance, SyncPredFlag); diff --git a/C/errors.c b/C/errors.c index 39b4d6e50..46b378dfc 100644 --- a/C/errors.c +++ b/C/errors.c @@ -950,6 +950,19 @@ Yap_Error(yap_error_number type, Term where, char *format,...) serious = TRUE; } break; + case OUT_OF_ATTVARS_ERROR: + { + int i; + + dump_stack(); + i = strlen(tmpbuf); + nt[0] = MkAtomTerm(Yap_LookupAtom("out_of_attvars_error")); + tp = tmpbuf+i; + psize -= i; + fun = Yap_MkFunctor(Yap_LookupAtom("error"),2); + serious = TRUE; + } + break; case OUT_OF_TRAIL_ERROR: { int i; diff --git a/C/heapgc.c b/C/heapgc.c index 810dbe44f..4747c377f 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -2806,7 +2806,6 @@ compact_heap(void) /* oops, we found a blob */ int nofcells = (UNMARK_CELL(*current)-EndSpecials) / sizeof(CELL); CELL *ptr = current - nofcells ; - CELL func = ptr[0]; if (MARKED_PTR(ptr)) { #ifdef DEBUG diff --git a/m4/Yap.h.m4 b/m4/Yap.h.m4 index 9dddb847f..98136b365 100644 --- a/m4/Yap.h.m4 +++ b/m4/Yap.h.m4 @@ -10,7 +10,7 @@ * File: Yap.h.m4 * * mods: * * comments: main header file for YAP * -* version: $Id: Yap.h.m4,v 1.64 2004-09-16 17:29:08 vsc Exp $ * +* version: $Id: Yap.h.m4,v 1.65 2004-09-17 19:34:52 vsc Exp $ * *************************************************************************/ #include "config.h" @@ -466,6 +466,7 @@ typedef enum { OUT_OF_HEAP_ERROR, OUT_OF_STACK_ERROR, OUT_OF_TRAIL_ERROR, + OUT_OF_ATTVARS_ERROR, PERMISSION_ERROR_ACCESS_PRIVATE_PROCEDURE, PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, PERMISSION_ERROR_CREATE_ARRAY, diff --git a/pl/corout.yap b/pl/corout.yap index abbac848d..a99f93539 100644 --- a/pl/corout.yap +++ b/pl/corout.yap @@ -490,15 +490,11 @@ when(_,Goal) :- '$$compile'((S :- var(A), !, freeze(A, S)), (S :- var(A), !, freeze(A, S)), 5, M), fail. '$wait'(_). -frozen(V, G) :- nonvar(V), !, G = true. +frozen(V, G) :- nonvar(V), !, + '$do_error'(type_error(variable,V),frozen(V,G)). frozen(V, LG) :- - '$project'([V],[V],G), - '$simplify_list_of_frozen_goals'(G,LG). -%write(vsc:G0), nl, -% '$purge_done_goals'(G0, GI), -% '$sort'(GI, GII), -%write(vsc:GII), nl, -% '$convert_list_of_frozen_goals'(GII, G). + '$project'([V],[V],Gs), + '$simplify_list_of_frozen_goals'(Gs,LG). '$simplify_list_of_frozen_goals'([],[]). '$simplify_list_of_frozen_goals'([(_-G)|Gs],[G|NGs]) :- @@ -600,11 +596,10 @@ call_residue(Goal,Residue) :- '$project'([],_,[]). -'$project'([V|LAV],_,LGs) :- +'$project'(Vs,_,LGs) :- % we don't have constraints yet, so we must be talking about delays. '$undefined'(modules_with_attributes(LAV),attributes), !, - attributes:all_attvars(NLAV), - '$fetch_delays'(NLAV,LGs, []). + '$fetch_delays'(Vs, LGs, []). '$project'([V|LAV],LIV,LDs) :- attributes:modules_with_attributes(LMods), '$pick_vars_for_project'(LIV,NLIV), diff --git a/pl/errors.yap b/pl/errors.yap index b92e023e2..64e0f1ca1 100644 --- a/pl/errors.yap +++ b/pl/errors.yap @@ -11,8 +11,14 @@ * File: errors.yap * * comments: error messages for YAP * * * -* Last rev: $Date: 2004-07-22 21:32:22 $,$Author: vsc $ * +* Last rev: $Date: 2004-09-17 19:34:53 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.54 2004/07/22 21:32:22 vsc +* debugger fixes +* initial support for JPL +* bad calls to garbage collector and gc +* debugger fixes +* * Revision 1.53 2004/06/23 17:24:20 vsc * New comment-based message style * Fix thread support (at least don't deadlock with oneself) @@ -472,6 +478,9 @@ print_message(Level, Mss) :- '$output_error_message'(out_of_trail_error, Where) :- format(user_error,'% OUT OF TRAIL SPACE ERROR- ~w~n', [Where]). +'$output_error_message'(out_of_attvars_error, Where) :- + format(user_error,'% OUT OF STACK SPACE ERROR- ~w~n', + [Where]). '$output_error_message'(permission_error(access,private_procedure,P), Where) :- format(user_error,'% PERMISSION ERROR- ~w: cannot see clauses for ~w~n', [Where,P]).