simplify frozen/2
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1140 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
3d308525e0
commit
0de365678a
14
C/absmi.c
14
C/absmi.c
@ -10,8 +10,11 @@
|
|||||||
* *
|
* *
|
||||||
* File: absmi.c *
|
* File: absmi.c *
|
||||||
* comments: Portable abstract machine interpreter *
|
* 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 $
|
* $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
|
* Revision 1.142 2004/08/11 16:14:51 vsc
|
||||||
* whole lot of fixes:
|
* whole lot of fixes:
|
||||||
* - memory leak in indexing
|
* - memory leak in indexing
|
||||||
@ -1389,11 +1392,20 @@ Yap_absmi(int inp)
|
|||||||
ASP = YREG;
|
ASP = YREG;
|
||||||
saveregs();
|
saveregs();
|
||||||
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) {
|
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) {
|
||||||
|
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)) {
|
if (!Yap_gc(3, ENV, CP)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!Yap_IUnify(ARG2, t)) {
|
if (!Yap_IUnify(ARG2, t)) {
|
||||||
setregs();
|
setregs();
|
||||||
FAIL();
|
FAIL();
|
||||||
|
20
C/arrays.c
20
C/arrays.c
@ -267,11 +267,20 @@ AccessNamedArray(Atom a, Int indx)
|
|||||||
READ_UNLOCK(ptr->ArRWLock);
|
READ_UNLOCK(ptr->ArRWLock);
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
while ((TRef = Yap_FetchTermFromDB(ref)) == 0L) {
|
while ((TRef = Yap_FetchTermFromDB(ref)) == 0L) {
|
||||||
|
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)) {
|
if (!Yap_gc(3, ENV, CP)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(TermNil);
|
return(TermNil);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
TRef = TermNil;
|
TRef = TermNil;
|
||||||
@ -1961,9 +1970,18 @@ p_static_array_to_term(void)
|
|||||||
|
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
while ((TRef = Yap_FetchTermFromDB(ref)) == 0L) {
|
while ((TRef = Yap_FetchTermFromDB(ref)) == 0L) {
|
||||||
|
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)) {
|
if (!Yap_gc(3, YENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(TermNil);
|
return TermNil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
33
C/bb.c
33
C/bb.c
@ -272,9 +272,18 @@ p_bb_get(void)
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
READ_LOCK(p->BBRWLock);
|
READ_LOCK(p->BBRWLock);
|
||||||
while ((out = Yap_FetchTermFromDB(p->Element)) == 0L) {
|
while ((out = Yap_FetchTermFromDB(p->Element)) == 0L) {
|
||||||
|
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)) {
|
if (!Yap_gc(2, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(TermNil);
|
return TermNil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
READ_UNLOCK(p->BBRWLock);
|
READ_UNLOCK(p->BBRWLock);
|
||||||
@ -292,9 +301,18 @@ p_bb_delete(void)
|
|||||||
if (p == NULL || p->Element == NULL)
|
if (p == NULL || p->Element == NULL)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
while ((out = Yap_FetchTermFromDB(p->Element)) == 0L) {
|
while ((out = Yap_FetchTermFromDB(p->Element)) == 0L) {
|
||||||
|
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)) {
|
if (!Yap_gc(2, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(TermNil);
|
return TermNil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WRITE_LOCK(p->BBRWLock);
|
WRITE_LOCK(p->BBRWLock);
|
||||||
@ -316,9 +334,18 @@ p_bb_update(void)
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
WRITE_LOCK(p->BBRWLock);
|
WRITE_LOCK(p->BBRWLock);
|
||||||
while ((out = Yap_FetchTermFromDB(p->Element)) == 0L) {
|
while ((out = Yap_FetchTermFromDB(p->Element)) == 0L) {
|
||||||
|
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)) {
|
if (!Yap_gc(3, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(TermNil);
|
return TermNil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Yap_unify(ARG2,out)) {
|
if (!Yap_unify(ARG2,out)) {
|
||||||
|
33
C/cdmgr.c
33
C/cdmgr.c
@ -11,8 +11,12 @@
|
|||||||
* File: cdmgr.c *
|
* File: cdmgr.c *
|
||||||
* comments: Code manager *
|
* 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 $
|
* $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
|
* Revision 1.130 2004/09/07 16:48:04 vsc
|
||||||
* fix bug in unwinding trail at amiops.h
|
* fix bug in unwinding trail at amiops.h
|
||||||
*
|
*
|
||||||
@ -3316,10 +3320,19 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya
|
|||||||
ARG5 = th;
|
ARG5 = th;
|
||||||
ARG6 = tb;
|
ARG6 = tb;
|
||||||
ARG7 = tr;
|
ARG7 = tr;
|
||||||
|
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)) {
|
if (!Yap_gc(7, YENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
th = ARG5;
|
th = ARG5;
|
||||||
tb = ARG6;
|
tb = ARG6;
|
||||||
tr = ARG7;
|
tr = ARG7;
|
||||||
@ -3427,10 +3440,19 @@ fetch_next_lu_clause0(PredEntry *pe, yamop *i_code, Term th, Term tb, yamop *cp_
|
|||||||
|
|
||||||
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) {
|
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) {
|
||||||
if (first_time) {
|
if (first_time) {
|
||||||
|
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)) {
|
if (!Yap_gc(4, YENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!Yap_gc(5, ENV, CP)) {
|
if (!Yap_gc(5, ENV, CP)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
@ -3527,10 +3549,19 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr
|
|||||||
|
|
||||||
while ((t = Yap_FetchTermFromDB(cl->usc.ClSource)) == 0L) {
|
while ((t = Yap_FetchTermFromDB(cl->usc.ClSource)) == 0L) {
|
||||||
if (first_time) {
|
if (first_time) {
|
||||||
|
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)) {
|
if (!Yap_gc(4, YENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!Yap_gc(5, ENV, CP)) {
|
if (!Yap_gc(5, ENV, CP)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
|
116
C/dbase.c
116
C/dbase.c
@ -21,6 +21,7 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
#include "clause.h"
|
#include "clause.h"
|
||||||
#include "yapio.h"
|
#include "yapio.h"
|
||||||
|
#include "attvar.h"
|
||||||
#include "heapgc.h"
|
#include "heapgc.h"
|
||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -2389,18 +2390,21 @@ p_still_variant(void)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
static void
|
static int
|
||||||
copy_attachments(CELL *ts)
|
copy_attachments(CELL *ts)
|
||||||
{
|
{
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
Term t;
|
|
||||||
|
attvar_record *orig = (attvar_record *)Yap_ReadTimedVar(DelayedVars);
|
||||||
/* store away in case there is an overflow */
|
/* store away in case there is an overflow */
|
||||||
*--ASP = ts[3];
|
if (attas[IntegerOfTerm(ts[2])].term_to_op(ts[1], ts[0]) == FALSE) {
|
||||||
attas[IntegerOfTerm(ts[2])].term_to_op(ts[1], ts[0]);
|
/* oops, we did not have enough space to copy the elements */
|
||||||
t = *ASP;
|
/* reset queue of woken up goals */
|
||||||
ASP++;
|
Yap_UpdateTimedVar(DelayedVars, (CELL)orig);
|
||||||
if (t == TermNil) return;
|
return FALSE;
|
||||||
ts = RepAppl(t)+1;
|
}
|
||||||
|
if (ts[3] == TermNil) return TRUE;
|
||||||
|
ts = RepAppl(ts[3])+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2505,6 +2509,7 @@ GetDBTerm(DBTerm *DBSP)
|
|||||||
fprintf(Yap_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n");
|
fprintf(Yap_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n");
|
||||||
Yap_exit( 1);
|
Yap_exit( 1);
|
||||||
} else {
|
} else {
|
||||||
|
Yap_Error_TYPE = OUT_OF_STACK_ERROR;
|
||||||
Yap_Error_Size = NOf*sizeof(CELL);
|
Yap_Error_Size = NOf*sizeof(CELL);
|
||||||
return (Term)0;
|
return (Term)0;
|
||||||
}
|
}
|
||||||
@ -2520,9 +2525,11 @@ GetDBTerm(DBTerm *DBSP)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
if (DBSP->attachments != 0L) {
|
if (DBSP->attachments != 0L) {
|
||||||
*--ASP = (CELL)HOld;
|
if (!copy_attachments((CELL *)AdjustIDBPtr(DBSP->attachments,(CELL)HOld-(CELL)(DBSP->Contents)))) {
|
||||||
copy_attachments((CELL *)AdjustIDBPtr(DBSP->attachments,(CELL)HOld-(CELL)(DBSP->Contents)));
|
Yap_Error_TYPE = OUT_OF_ATTVARS_ERROR;
|
||||||
HOld = CellPtr(*ASP++);
|
Yap_Error_Size = 0;
|
||||||
|
return (Term)0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return AdjustIDBPtr(t,Unsigned(HOld)-(CELL)(DBSP->Contents));
|
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! */
|
/* make sure the garbage collector sees what we want it to see! */
|
||||||
EXTRA_CBACK_ARG(3,1) = (CELL)ref;
|
EXTRA_CBACK_ARG(3,1) = (CELL)ref;
|
||||||
/* oops, we are in trouble, not enough stack space */
|
/* oops, we are in trouble, not enough stack space */
|
||||||
|
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)) {
|
if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Yap_Error_Size = 0;
|
||||||
twork = Deref(ARG2);
|
twork = Deref(ARG2);
|
||||||
t3 = Deref(ARG3);
|
t3 = Deref(ARG3);
|
||||||
}
|
}
|
||||||
@ -3175,10 +3192,19 @@ i_recorded(DBProp AtProp, Term t3)
|
|||||||
EXTRA_CBACK_ARG(3,2) = MkIntegerTerm(((Int)mask));
|
EXTRA_CBACK_ARG(3,2) = MkIntegerTerm(((Int)mask));
|
||||||
EXTRA_CBACK_ARG(3,3) = MkIntegerTerm(((Int)key));
|
EXTRA_CBACK_ARG(3,3) = MkIntegerTerm(((Int)key));
|
||||||
/* oops, we are in trouble, not enough stack space */
|
/* oops, we are in trouble, not enough stack space */
|
||||||
|
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)) {
|
if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
READ_LOCK(AtProp->DBRWLock);
|
READ_LOCK(AtProp->DBRWLock);
|
||||||
}
|
}
|
||||||
} while (TRUE);
|
} while (TRUE);
|
||||||
@ -3262,10 +3288,20 @@ c_recorded(int flags)
|
|||||||
/* make sure the garbage collector sees what we want it to see! */
|
/* make sure the garbage collector sees what we want it to see! */
|
||||||
EXTRA_CBACK_ARG(3,1) = (CELL)ref;
|
EXTRA_CBACK_ARG(3,1) = (CELL)ref;
|
||||||
/* oops, we are in trouble, not enough stack space */
|
/* oops, we are in trouble, not enough stack space */
|
||||||
|
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)) {
|
if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Yap_Error_Size = 0;
|
||||||
PreviousHeap = H;
|
PreviousHeap = H;
|
||||||
}
|
}
|
||||||
Yap_unify(ARG2, TermDB);
|
Yap_unify(ARG2, TermDB);
|
||||||
@ -3295,10 +3331,20 @@ c_recorded(int flags)
|
|||||||
/* make sure the garbage collector sees what we want it to see! */
|
/* make sure the garbage collector sees what we want it to see! */
|
||||||
EXTRA_CBACK_ARG(3,1) = (CELL)ref;
|
EXTRA_CBACK_ARG(3,1) = (CELL)ref;
|
||||||
/* oops, we are in trouble, not enough stack space */
|
/* oops, we are in trouble, not enough stack space */
|
||||||
|
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)) {
|
if (!Yap_gcl(Yap_Error_Size, 3, ENV, CP)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Yap_Error_Size = 0;
|
||||||
PreviousHeap = H;
|
PreviousHeap = H;
|
||||||
}
|
}
|
||||||
if (Yap_unify(ARG2, TermDB))
|
if (Yap_unify(ARG2, TermDB))
|
||||||
@ -3528,11 +3574,20 @@ p_first_instance(void)
|
|||||||
#endif
|
#endif
|
||||||
while ((TermDB = GetDBTermFromDBEntry(ref)) == (CELL)0) {
|
while ((TermDB = GetDBTermFromDBEntry(ref)) == (CELL)0) {
|
||||||
/* oops, we are in trouble, not enough stack space */
|
/* oops, we are in trouble, not enough stack space */
|
||||||
|
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)) {
|
if (!Yap_gcl(Yap_Error_Size, 3, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (IsVarTerm(TermDB)) {
|
if (IsVarTerm(TermDB)) {
|
||||||
Yap_unify(TermDB, ARG2);
|
Yap_unify(TermDB, ARG2);
|
||||||
} else {
|
} else {
|
||||||
@ -4428,11 +4483,20 @@ static_instance(StaticClause *cl)
|
|||||||
|
|
||||||
while ((TermDB = GetDBTerm(cl->usc.ClSource)) == 0L) {
|
while ((TermDB = GetDBTerm(cl->usc.ClSource)) == 0L) {
|
||||||
/* oops, we are in trouble, not enough stack space */
|
/* oops, we are in trouble, not enough stack space */
|
||||||
|
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)) {
|
if (!Yap_gcl(Yap_Error_Size, 2, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return Yap_unify(ARG2, TermDB);
|
return Yap_unify(ARG2, TermDB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4491,21 +4555,39 @@ p_instance(void)
|
|||||||
Term TermDB;
|
Term TermDB;
|
||||||
while ((TermDB = GetDBTerm(cl->ClSource)) == 0L) {
|
while ((TermDB = GetDBTerm(cl->ClSource)) == 0L) {
|
||||||
/* oops, we are in trouble, not enough stack space */
|
/* oops, we are in trouble, not enough stack space */
|
||||||
|
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)) {
|
if (!Yap_gcl(Yap_Error_Size, 2, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return Yap_unify(ARG2, TermDB);
|
return Yap_unify(ARG2, TermDB);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Term TermDB;
|
Term TermDB;
|
||||||
while ((TermDB = GetDBTermFromDBEntry(dbr)) == 0L) {
|
while ((TermDB = GetDBTermFromDBEntry(dbr)) == 0L) {
|
||||||
/* oops, we are in trouble, not enough stack space */
|
/* oops, we are in trouble, not enough stack space */
|
||||||
|
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)) {
|
if (!Yap_gcl(Yap_Error_Size, 2, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
t1 = Deref(ARG1);
|
t1 = Deref(ARG1);
|
||||||
}
|
}
|
||||||
return Yap_unify(ARG2, TermDB);
|
return Yap_unify(ARG2, TermDB);
|
||||||
@ -4908,11 +4990,20 @@ p_dequeue(void)
|
|||||||
father_key->FirstInQueue = cur_instance->next;
|
father_key->FirstInQueue = cur_instance->next;
|
||||||
WRITE_UNLOCK(father_key->QRWLock);
|
WRITE_UNLOCK(father_key->QRWLock);
|
||||||
while ((TDB = GetDBTerm(cur_instance->DBT)) == 0L) {
|
while ((TDB = GetDBTerm(cur_instance->DBT)) == 0L) {
|
||||||
|
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)) {
|
if (!Yap_gcl(Yap_Error_Size, 2, YENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* release space for cur_instance */
|
/* release space for cur_instance */
|
||||||
keepdbrefs(cur_instance->DBT);
|
keepdbrefs(cur_instance->DBT);
|
||||||
ErasePendingRefs(cur_instance->DBT);
|
ErasePendingRefs(cur_instance->DBT);
|
||||||
@ -5095,6 +5186,7 @@ Yap_InitDBPreds(void)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Yap_InitCPred("total_erased", 4, p_total_erased, SyncPredFlag);
|
Yap_InitCPred("total_erased", 4, p_total_erased, SyncPredFlag);
|
||||||
Yap_InitCPred("key_erased_statistics", 5, p_key_erased_statistics, 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);
|
Yap_InitCPred("heap_space_info", 3, p_heap_space_info, SyncPredFlag);
|
||||||
#endif
|
#endif
|
||||||
Yap_InitCPred("nth_instance", 3, p_nth_instance, SyncPredFlag);
|
Yap_InitCPred("nth_instance", 3, p_nth_instance, SyncPredFlag);
|
||||||
|
13
C/errors.c
13
C/errors.c
@ -950,6 +950,19 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
|
|||||||
serious = TRUE;
|
serious = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case OUT_OF_TRAIL_ERROR:
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -2806,7 +2806,6 @@ compact_heap(void)
|
|||||||
/* oops, we found a blob */
|
/* oops, we found a blob */
|
||||||
int nofcells = (UNMARK_CELL(*current)-EndSpecials) / sizeof(CELL);
|
int nofcells = (UNMARK_CELL(*current)-EndSpecials) / sizeof(CELL);
|
||||||
CELL *ptr = current - nofcells ;
|
CELL *ptr = current - nofcells ;
|
||||||
CELL func = ptr[0];
|
|
||||||
|
|
||||||
if (MARKED_PTR(ptr)) {
|
if (MARKED_PTR(ptr)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -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.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"
|
#include "config.h"
|
||||||
@ -466,6 +466,7 @@ typedef enum {
|
|||||||
OUT_OF_HEAP_ERROR,
|
OUT_OF_HEAP_ERROR,
|
||||||
OUT_OF_STACK_ERROR,
|
OUT_OF_STACK_ERROR,
|
||||||
OUT_OF_TRAIL_ERROR,
|
OUT_OF_TRAIL_ERROR,
|
||||||
|
OUT_OF_ATTVARS_ERROR,
|
||||||
PERMISSION_ERROR_ACCESS_PRIVATE_PROCEDURE,
|
PERMISSION_ERROR_ACCESS_PRIVATE_PROCEDURE,
|
||||||
PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM,
|
PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM,
|
||||||
PERMISSION_ERROR_CREATE_ARRAY,
|
PERMISSION_ERROR_CREATE_ARRAY,
|
||||||
|
@ -490,15 +490,11 @@ when(_,Goal) :-
|
|||||||
'$$compile'((S :- var(A), !, freeze(A, S)), (S :- var(A), !, freeze(A, S)), 5, M), fail.
|
'$$compile'((S :- var(A), !, freeze(A, S)), (S :- var(A), !, freeze(A, S)), 5, M), fail.
|
||||||
'$wait'(_).
|
'$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) :-
|
frozen(V, LG) :-
|
||||||
'$project'([V],[V],G),
|
'$project'([V],[V],Gs),
|
||||||
'$simplify_list_of_frozen_goals'(G,LG).
|
'$simplify_list_of_frozen_goals'(Gs,LG).
|
||||||
%write(vsc:G0), nl,
|
|
||||||
% '$purge_done_goals'(G0, GI),
|
|
||||||
% '$sort'(GI, GII),
|
|
||||||
%write(vsc:GII), nl,
|
|
||||||
% '$convert_list_of_frozen_goals'(GII, G).
|
|
||||||
|
|
||||||
'$simplify_list_of_frozen_goals'([],[]).
|
'$simplify_list_of_frozen_goals'([],[]).
|
||||||
'$simplify_list_of_frozen_goals'([(_-G)|Gs],[G|NGs]) :-
|
'$simplify_list_of_frozen_goals'([(_-G)|Gs],[G|NGs]) :-
|
||||||
@ -600,11 +596,10 @@ call_residue(Goal,Residue) :-
|
|||||||
|
|
||||||
|
|
||||||
'$project'([],_,[]).
|
'$project'([],_,[]).
|
||||||
'$project'([V|LAV],_,LGs) :-
|
'$project'(Vs,_,LGs) :-
|
||||||
% we don't have constraints yet, so we must be talking about delays.
|
% we don't have constraints yet, so we must be talking about delays.
|
||||||
'$undefined'(modules_with_attributes(LAV),attributes), !,
|
'$undefined'(modules_with_attributes(LAV),attributes), !,
|
||||||
attributes:all_attvars(NLAV),
|
'$fetch_delays'(Vs, LGs, []).
|
||||||
'$fetch_delays'(NLAV,LGs, []).
|
|
||||||
'$project'([V|LAV],LIV,LDs) :-
|
'$project'([V|LAV],LIV,LDs) :-
|
||||||
attributes:modules_with_attributes(LMods),
|
attributes:modules_with_attributes(LMods),
|
||||||
'$pick_vars_for_project'(LIV,NLIV),
|
'$pick_vars_for_project'(LIV,NLIV),
|
||||||
|
@ -11,8 +11,14 @@
|
|||||||
* File: errors.yap *
|
* File: errors.yap *
|
||||||
* comments: error messages for 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 $
|
* $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
|
* Revision 1.53 2004/06/23 17:24:20 vsc
|
||||||
* New comment-based message style
|
* New comment-based message style
|
||||||
* Fix thread support (at least don't deadlock with oneself)
|
* 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) :-
|
'$output_error_message'(out_of_trail_error, Where) :-
|
||||||
format(user_error,'% OUT OF TRAIL SPACE ERROR- ~w~n',
|
format(user_error,'% OUT OF TRAIL SPACE ERROR- ~w~n',
|
||||||
[Where]).
|
[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) :-
|
'$output_error_message'(permission_error(access,private_procedure,P), Where) :-
|
||||||
format(user_error,'% PERMISSION ERROR- ~w: cannot see clauses for ~w~n',
|
format(user_error,'% PERMISSION ERROR- ~w: cannot see clauses for ~w~n',
|
||||||
[Where,P]).
|
[Where,P]).
|
||||||
|
Reference in New Issue
Block a user