Windows fixes, mainly H -> HB
This commit is contained in:
parent
e1201fc468
commit
6b2e1973ab
6
C/agc.c
6
C/agc.c
@ -220,7 +220,7 @@ static void init_reg_copies(USES_REGS1)
|
|||||||
LOCAL_OldLCL0 = LCL0;
|
LOCAL_OldLCL0 = LCL0;
|
||||||
LOCAL_OldTR = TR;
|
LOCAL_OldTR = TR;
|
||||||
LOCAL_OldGlobalBase = (CELL *)LOCAL_GlobalBase;
|
LOCAL_OldGlobalBase = (CELL *)LOCAL_GlobalBase;
|
||||||
LOCAL_OldH = H;
|
LOCAL_OldH = HR;
|
||||||
LOCAL_OldH0 = H0;
|
LOCAL_OldH0 = H0;
|
||||||
LOCAL_OldTrailBase = LOCAL_TrailBase;
|
LOCAL_OldTrailBase = LOCAL_TrailBase;
|
||||||
LOCAL_OldTrailTop = LOCAL_TrailTop;
|
LOCAL_OldTrailTop = LOCAL_TrailTop;
|
||||||
@ -319,7 +319,7 @@ mark_global_cell(CELL *pt)
|
|||||||
/* skip bitmaps */
|
/* skip bitmaps */
|
||||||
switch(reg) {
|
switch(reg) {
|
||||||
case (CELL)FunctorDouble:
|
case (CELL)FunctorDouble:
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
return pt + 4;
|
return pt + 4;
|
||||||
#else
|
#else
|
||||||
return pt + 3;
|
return pt + 3;
|
||||||
@ -378,7 +378,7 @@ mark_global(USES_REGS1)
|
|||||||
* the code
|
* the code
|
||||||
*/
|
*/
|
||||||
pt = H0;
|
pt = H0;
|
||||||
while (pt < H) {
|
while (pt < HR) {
|
||||||
pt = mark_global_cell(pt);
|
pt = mark_global_cell(pt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
C/amasm.c
18
C/amasm.c
@ -3601,7 +3601,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
|||||||
if (!pass_no) {
|
if (!pass_no) {
|
||||||
#if !USE_SYSTEM_MALLOC
|
#if !USE_SYSTEM_MALLOC
|
||||||
if (CellPtr(cip->label_offset+cip->cpc->rnd1) > ASP-256) {
|
if (CellPtr(cip->label_offset+cip->cpc->rnd1) > ASP-256) {
|
||||||
LOCAL_Error_Size = 256+((char *)(cip->label_offset+cip->cpc->rnd1) - (char *)H);
|
LOCAL_Error_Size = 256+((char *)(cip->label_offset+cip->cpc->rnd1) - (char *)HR);
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cip->CompilerBotch, 3);
|
siglongjmp(cip->CompilerBotch, 3);
|
||||||
}
|
}
|
||||||
@ -3791,7 +3791,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
|||||||
break;
|
break;
|
||||||
case align_float_op:
|
case align_float_op:
|
||||||
/* install a blob */
|
/* install a blob */
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
if (!((CELL)code_p & 0x4))
|
if (!((CELL)code_p & 0x4))
|
||||||
GONEXT(e);
|
GONEXT(e);
|
||||||
#endif
|
#endif
|
||||||
@ -3842,18 +3842,18 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
|||||||
static DBTerm *
|
static DBTerm *
|
||||||
fetch_clause_space(Term* tp, UInt size, struct intermediates *cip, UInt *osizep USES_REGS)
|
fetch_clause_space(Term* tp, UInt size, struct intermediates *cip, UInt *osizep USES_REGS)
|
||||||
{
|
{
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
DBTerm *x;
|
DBTerm *x;
|
||||||
|
|
||||||
/* This stuff should be just about fetching the space from the data-base,
|
/* This stuff should be just about fetching the space from the data-base,
|
||||||
unfortunately we have to do all sorts of error handling :-( */
|
unfortunately we have to do all sorts of error handling :-( */
|
||||||
H = (CELL *)cip->freep;
|
HR = (CELL *)cip->freep;
|
||||||
while ((x = Yap_StoreTermInDBPlusExtraSpace(*tp, size, osizep)) == NULL) {
|
while ((x = Yap_StoreTermInDBPlusExtraSpace(*tp, size, osizep)) == NULL) {
|
||||||
|
|
||||||
H = h0;
|
HR = h0;
|
||||||
switch (LOCAL_Error_TYPE) {
|
switch (LOCAL_Error_TYPE) {
|
||||||
case OUT_OF_STACK_ERROR:
|
case OUT_OF_STACK_ERROR:
|
||||||
LOCAL_Error_Size = 256+((char *)cip->freep - (char *)H);
|
LOCAL_Error_Size = 256+((char *)cip->freep - (char *)HR);
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cip->CompilerBotch,3);
|
siglongjmp(cip->CompilerBotch,3);
|
||||||
case OUT_OF_TRAIL_ERROR:
|
case OUT_OF_TRAIL_ERROR:
|
||||||
@ -3885,10 +3885,10 @@ fetch_clause_space(Term* tp, UInt size, struct intermediates *cip, UInt *osizep
|
|||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
h0 = H;
|
h0 = HR;
|
||||||
H = (CELL *)cip->freep;
|
HR = (CELL *)cip->freep;
|
||||||
}
|
}
|
||||||
H = h0;
|
HR = h0;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,12 +138,12 @@ eval0(Int fi) {
|
|||||||
RINT(((CELL *)TR)-LCL0);
|
RINT(((CELL *)TR)-LCL0);
|
||||||
#endif
|
#endif
|
||||||
case op_stackfree:
|
case op_stackfree:
|
||||||
RINT(Unsigned(ASP) - Unsigned(H));
|
RINT(Unsigned(ASP) - Unsigned(HR));
|
||||||
case op_globalsp:
|
case op_globalsp:
|
||||||
#if YAPOR_SBA
|
#if YAPOR_SBA
|
||||||
RINT((Int)H);
|
RINT((Int)HR);
|
||||||
#else
|
#else
|
||||||
RINT(H - H0);
|
RINT(HR - H0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
RERROR();
|
RERROR();
|
||||||
|
@ -152,7 +152,7 @@ lsb(Int inp USES_REGS) /* calculate the least significant bit for an integer */
|
|||||||
}
|
}
|
||||||
if (inp==0)
|
if (inp==0)
|
||||||
return 0L;
|
return 0L;
|
||||||
#if SIZEOF_LONG_INT == 8
|
#if SIZEOF_INT_P == 8
|
||||||
if (!(inp & 0xffffffffLL)) {inp >>= 32; out += 32;}
|
if (!(inp & 0xffffffffLL)) {inp >>= 32; out += 32;}
|
||||||
#endif
|
#endif
|
||||||
if (!(inp & 0xffffL)) {inp >>= 16; out += 16;}
|
if (!(inp & 0xffffL)) {inp >>= 16; out += 16;}
|
||||||
@ -373,10 +373,10 @@ eval1(Int fi, Term t USES_REGS) {
|
|||||||
}
|
}
|
||||||
case op_lgamma:
|
case op_lgamma:
|
||||||
{
|
{
|
||||||
|
#if HAVE_LGAMMA
|
||||||
Float dbl;
|
Float dbl;
|
||||||
|
|
||||||
dbl = get_float(t);
|
dbl = get_float(t);
|
||||||
#if HAVE_LGAMMA
|
|
||||||
RFLOAT(lgamma(dbl));
|
RFLOAT(lgamma(dbl));
|
||||||
#else
|
#else
|
||||||
RERROR();
|
RERROR();
|
||||||
@ -384,8 +384,8 @@ eval1(Int fi, Term t USES_REGS) {
|
|||||||
}
|
}
|
||||||
case op_erf:
|
case op_erf:
|
||||||
{
|
{
|
||||||
Float dbl = get_float(t), out;
|
|
||||||
#if HAVE_ERF
|
#if HAVE_ERF
|
||||||
|
Float dbl = get_float(t), out;
|
||||||
out = erf(dbl);
|
out = erf(dbl);
|
||||||
RFLOAT(out);
|
RFLOAT(out);
|
||||||
#else
|
#else
|
||||||
@ -394,8 +394,8 @@ eval1(Int fi, Term t USES_REGS) {
|
|||||||
}
|
}
|
||||||
case op_erfc:
|
case op_erfc:
|
||||||
{
|
{
|
||||||
Float dbl = get_float(t), out;
|
|
||||||
#if HAVE_ERF
|
#if HAVE_ERF
|
||||||
|
Float dbl = get_float(t), out;
|
||||||
out = erfc(dbl);
|
out = erfc(dbl);
|
||||||
RFLOAT(out);
|
RFLOAT(out);
|
||||||
#else
|
#else
|
||||||
|
90
C/arrays.c
90
C/arrays.c
@ -545,14 +545,14 @@ InitNamedArray(ArrayEntry * p, Int dim USES_REGS)
|
|||||||
/* Leave a pointer so that we can reclaim array space when
|
/* Leave a pointer so that we can reclaim array space when
|
||||||
* we backtrack or when we abort */
|
* we backtrack or when we abort */
|
||||||
/* place terms in reverse order */
|
/* place terms in reverse order */
|
||||||
Bind_Global(&(p->ValueOfVE),AbsAppl(H));
|
Bind_Global(&(p->ValueOfVE),AbsAppl(HR));
|
||||||
tp = H;
|
tp = HR;
|
||||||
tp[0] = (CELL)Yap_MkFunctor(AtomArray, dim);
|
tp[0] = (CELL)Yap_MkFunctor(AtomArray, dim);
|
||||||
tp++;
|
tp++;
|
||||||
p->ArrayEArity = dim;
|
p->ArrayEArity = dim;
|
||||||
/* Initialise the array as a set of variables */
|
/* Initialise the array as a set of variables */
|
||||||
H = tp+dim;
|
HR = tp+dim;
|
||||||
for (; tp < H; tp++) {
|
for (; tp < HR; tp++) {
|
||||||
RESET_VARIABLE(tp);
|
RESET_VARIABLE(tp);
|
||||||
}
|
}
|
||||||
WRITE_UNLOCK(p->ArRWLock);
|
WRITE_UNLOCK(p->ArRWLock);
|
||||||
@ -887,13 +887,13 @@ p_create_array( USES_REGS1 )
|
|||||||
Functor farray;
|
Functor farray;
|
||||||
|
|
||||||
farray = Yap_MkFunctor(AtomArray, size);
|
farray = Yap_MkFunctor(AtomArray, size);
|
||||||
if (H+1+size > ASP-1024) {
|
if (HR+1+size > ASP-1024) {
|
||||||
if (!Yap_gcl((1+size)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl((1+size)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
} else {
|
} else {
|
||||||
if (H+1+size > ASP-1024) {
|
if (HR+1+size > ASP-1024) {
|
||||||
if (!Yap_growstack( sizeof(CELL) * (size+1-(H-ASP-1024)))) {
|
if (!Yap_growstack( sizeof(CELL) * (size+1-(HR-ASP-1024)))) {
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -901,11 +901,11 @@ p_create_array( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
t = AbsAppl(H);
|
t = AbsAppl(HR);
|
||||||
*H++ = (CELL) farray;
|
*HR++ = (CELL) farray;
|
||||||
for (; size >= 0; size--) {
|
for (; size >= 0; size--) {
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
H++;
|
HR++;
|
||||||
}
|
}
|
||||||
return (Yap_unify(t, ARG1));
|
return (Yap_unify(t, ARG1));
|
||||||
}
|
}
|
||||||
@ -924,7 +924,7 @@ p_create_array( USES_REGS1 )
|
|||||||
)
|
)
|
||||||
pp = RepProp(pp->NextOfPE);
|
pp = RepProp(pp->NextOfPE);
|
||||||
if (EndOfPAEntr(pp)) {
|
if (EndOfPAEntr(pp)) {
|
||||||
if (H+1+size > ASP-1024) {
|
if (HR+1+size > ASP-1024) {
|
||||||
WRITE_UNLOCK(ae->ARWLock);
|
WRITE_UNLOCK(ae->ARWLock);
|
||||||
if (!Yap_gcl((1+size)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl((1+size)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
||||||
@ -946,7 +946,7 @@ p_create_array( USES_REGS1 )
|
|||||||
Yap_Error(PERMISSION_ERROR_CREATE_ARRAY,t,"create_array",
|
Yap_Error(PERMISSION_ERROR_CREATE_ARRAY,t,"create_array",
|
||||||
ae->StrOfAE);
|
ae->StrOfAE);
|
||||||
} else {
|
} else {
|
||||||
if (H+1+size > ASP-1024) {
|
if (HR+1+size > ASP-1024) {
|
||||||
if (!Yap_gcl((1+size)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl((1+size)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
@ -1411,7 +1411,7 @@ loop:
|
|||||||
}
|
}
|
||||||
else if (IsPairTerm(d0)) {
|
else if (IsPairTerm(d0)) {
|
||||||
/* store the terms to visit */
|
/* store the terms to visit */
|
||||||
*ptn++ = AbsPair(H);
|
*ptn++ = AbsPair(HR);
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
to_visit[0] = pt0;
|
to_visit[0] = pt0;
|
||||||
to_visit[1] = pt0_end;
|
to_visit[1] = pt0_end;
|
||||||
@ -1430,8 +1430,8 @@ loop:
|
|||||||
pt0 = RepPair(d0) - 1;
|
pt0 = RepPair(d0) - 1;
|
||||||
pt0_end = RepPair(d0) + 1;
|
pt0_end = RepPair(d0) + 1;
|
||||||
/* write the head and tail of the list */
|
/* write the head and tail of the list */
|
||||||
ptn = H;
|
ptn = HR;
|
||||||
H += 2;
|
HR += 2;
|
||||||
}
|
}
|
||||||
else if (IsApplTerm(d0)) {
|
else if (IsApplTerm(d0)) {
|
||||||
register Functor f;
|
register Functor f;
|
||||||
@ -1444,7 +1444,7 @@ loop:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*ptn++ = AbsAppl(H);
|
*ptn++ = AbsAppl(HR);
|
||||||
/* store the terms to visit */
|
/* store the terms to visit */
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
to_visit[0] = pt0;
|
to_visit[0] = pt0;
|
||||||
@ -1465,9 +1465,9 @@ loop:
|
|||||||
d0 = ArityOfFunctor(f);
|
d0 = ArityOfFunctor(f);
|
||||||
pt0_end = pt0 + d0;
|
pt0_end = pt0 + d0;
|
||||||
/* start writing the compound term */
|
/* start writing the compound term */
|
||||||
ptn = H;
|
ptn = HR;
|
||||||
*ptn++ = (CELL) f;
|
*ptn++ = (CELL) f;
|
||||||
H += d0 + 1;
|
HR += d0 + 1;
|
||||||
}
|
}
|
||||||
else { /* AtomOrInt */
|
else { /* AtomOrInt */
|
||||||
*ptn++ = d0;
|
*ptn++ = d0;
|
||||||
@ -1516,19 +1516,19 @@ replace_array_references(Term t0 USES_REGS)
|
|||||||
return (MkPairTerm(t, TermNil));
|
return (MkPairTerm(t, TermNil));
|
||||||
} else if (IsPairTerm(t)) {
|
} else if (IsPairTerm(t)) {
|
||||||
Term VList = MkVarTerm();
|
Term VList = MkVarTerm();
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
|
|
||||||
H += 2;
|
HR += 2;
|
||||||
replace_array_references_complex(RepPair(t) - 1, RepPair(t) + 1, h0,
|
replace_array_references_complex(RepPair(t) - 1, RepPair(t) + 1, h0,
|
||||||
VList PASS_REGS);
|
VList PASS_REGS);
|
||||||
return MkPairTerm(AbsPair(h0), VList);
|
return MkPairTerm(AbsPair(h0), VList);
|
||||||
} else {
|
} else {
|
||||||
Term VList = MkVarTerm();
|
Term VList = MkVarTerm();
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
Functor f = FunctorOfTerm(t);
|
Functor f = FunctorOfTerm(t);
|
||||||
|
|
||||||
*H++ = (CELL) (f);
|
*HR++ = (CELL) (f);
|
||||||
H += ArityOfFunctor(f);
|
HR += ArityOfFunctor(f);
|
||||||
replace_array_references_complex(RepAppl(t),
|
replace_array_references_complex(RepAppl(t),
|
||||||
RepAppl(t) + ArityOfFunctor(FunctorOfTerm(t)), h0 + 1,
|
RepAppl(t) + ArityOfFunctor(FunctorOfTerm(t)), h0 + 1,
|
||||||
VList PASS_REGS);
|
VList PASS_REGS);
|
||||||
@ -2263,13 +2263,13 @@ p_static_array_to_term( USES_REGS1 )
|
|||||||
Int dim = pp->ArrayEArity, indx;
|
Int dim = pp->ArrayEArity, indx;
|
||||||
CELL *base;
|
CELL *base;
|
||||||
|
|
||||||
while (H+1+dim > ASP-1024) {
|
while (HR+1+dim > ASP-1024) {
|
||||||
if (!Yap_gcl((1+dim)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl((1+dim)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
} else {
|
} else {
|
||||||
if (H+1+dim > ASP-1024) {
|
if (HR+1+dim > ASP-1024) {
|
||||||
if (!Yap_growstack( sizeof(CELL) * (dim+1-(H-ASP-1024)))) {
|
if (!Yap_growstack( sizeof(CELL) * (dim+1-(HR-ASP-1024)))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -2278,13 +2278,13 @@ p_static_array_to_term( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
READ_LOCK(pp->ArRWLock);
|
READ_LOCK(pp->ArRWLock);
|
||||||
READ_UNLOCK(ae->ARWLock);
|
READ_UNLOCK(ae->ARWLock);
|
||||||
base = H;
|
base = HR;
|
||||||
*H++ = (CELL)Yap_MkFunctor(AbsAtom(ae),dim);
|
*HR++ = (CELL)Yap_MkFunctor(AbsAtom(ae),dim);
|
||||||
switch(tp) {
|
switch(tp) {
|
||||||
case array_of_ints:
|
case array_of_ints:
|
||||||
{
|
{
|
||||||
CELL *sptr = H;
|
CELL *sptr = HR;
|
||||||
H += dim;
|
HR += dim;
|
||||||
for (indx=0; indx < dim; indx++) {
|
for (indx=0; indx < dim; indx++) {
|
||||||
*sptr++ = MkIntegerTerm(pp->ValueOfVE.ints[indx]);
|
*sptr++ = MkIntegerTerm(pp->ValueOfVE.ints[indx]);
|
||||||
}
|
}
|
||||||
@ -2311,13 +2311,13 @@ p_static_array_to_term( USES_REGS1 )
|
|||||||
} else {
|
} else {
|
||||||
TRef = TermNil;
|
TRef = TermNil;
|
||||||
}
|
}
|
||||||
*H++ = TRef;
|
*HR++ = TRef;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case array_of_doubles:
|
case array_of_doubles:
|
||||||
{
|
{
|
||||||
CELL *sptr = H;
|
CELL *sptr = HR;
|
||||||
H += dim;
|
HR += dim;
|
||||||
for (indx=0; indx < dim; indx++) {
|
for (indx=0; indx < dim; indx++) {
|
||||||
*sptr++ = MkEvalFl(pp->ValueOfVE.floats[indx]);
|
*sptr++ = MkEvalFl(pp->ValueOfVE.floats[indx]);
|
||||||
}
|
}
|
||||||
@ -2325,8 +2325,8 @@ p_static_array_to_term( USES_REGS1 )
|
|||||||
break;
|
break;
|
||||||
case array_of_ptrs:
|
case array_of_ptrs:
|
||||||
{
|
{
|
||||||
CELL *sptr = H;
|
CELL *sptr = HR;
|
||||||
H += dim;
|
HR += dim;
|
||||||
for (indx=0; indx < dim; indx++) {
|
for (indx=0; indx < dim; indx++) {
|
||||||
*sptr++ = MkIntegerTerm((Int)(pp->ValueOfVE.ptrs[indx]));
|
*sptr++ = MkIntegerTerm((Int)(pp->ValueOfVE.ptrs[indx]));
|
||||||
}
|
}
|
||||||
@ -2334,8 +2334,8 @@ p_static_array_to_term( USES_REGS1 )
|
|||||||
break;
|
break;
|
||||||
case array_of_chars:
|
case array_of_chars:
|
||||||
{
|
{
|
||||||
CELL *sptr = H;
|
CELL *sptr = HR;
|
||||||
H += dim;
|
HR += dim;
|
||||||
for (indx=0; indx < dim; indx++) {
|
for (indx=0; indx < dim; indx++) {
|
||||||
*sptr++ = MkIntegerTerm((Int)(pp->ValueOfVE.chars[indx]));
|
*sptr++ = MkIntegerTerm((Int)(pp->ValueOfVE.chars[indx]));
|
||||||
}
|
}
|
||||||
@ -2343,8 +2343,8 @@ p_static_array_to_term( USES_REGS1 )
|
|||||||
break;
|
break;
|
||||||
case array_of_uchars:
|
case array_of_uchars:
|
||||||
{
|
{
|
||||||
CELL *sptr = H;
|
CELL *sptr = HR;
|
||||||
H += dim;
|
HR += dim;
|
||||||
for (indx=0; indx < dim; indx++) {
|
for (indx=0; indx < dim; indx++) {
|
||||||
*sptr++ = MkIntegerTerm((Int)(pp->ValueOfVE.uchars[indx]));
|
*sptr++ = MkIntegerTerm((Int)(pp->ValueOfVE.uchars[indx]));
|
||||||
}
|
}
|
||||||
@ -2352,8 +2352,8 @@ p_static_array_to_term( USES_REGS1 )
|
|||||||
break;
|
break;
|
||||||
case array_of_terms:
|
case array_of_terms:
|
||||||
{
|
{
|
||||||
CELL *sptr = H;
|
CELL *sptr = HR;
|
||||||
H += dim;
|
HR += dim;
|
||||||
for (indx=0; indx < dim; indx++) {
|
for (indx=0; indx < dim; indx++) {
|
||||||
/* The object is now in use */
|
/* The object is now in use */
|
||||||
DBTerm *ref = pp->ValueOfVE.terms[indx];
|
DBTerm *ref = pp->ValueOfVE.terms[indx];
|
||||||
@ -2370,8 +2370,8 @@ p_static_array_to_term( USES_REGS1 )
|
|||||||
break;
|
break;
|
||||||
case array_of_nb_terms:
|
case array_of_nb_terms:
|
||||||
{
|
{
|
||||||
CELL *sptr = H;
|
CELL *sptr = HR;
|
||||||
H += dim;
|
HR += dim;
|
||||||
for (indx=0; indx < dim; indx++) {
|
for (indx=0; indx < dim; indx++) {
|
||||||
/* The object is now in use */
|
/* The object is now in use */
|
||||||
Term To = GetNBTerm(pp->ValueOfVE.lterms, indx PASS_REGS);
|
Term To = GetNBTerm(pp->ValueOfVE.lterms, indx PASS_REGS);
|
||||||
@ -2390,7 +2390,7 @@ p_static_array_to_term( USES_REGS1 )
|
|||||||
out = pp->ValueOfVE.atoms[indx];
|
out = pp->ValueOfVE.atoms[indx];
|
||||||
if (out == 0L)
|
if (out == 0L)
|
||||||
out = TermNil;
|
out = TermNil;
|
||||||
*H++ = out;
|
*HR++ = out;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
16
C/atomic.c
16
C/atomic.c
@ -1083,8 +1083,8 @@ p_atom_split( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
at = AtomOfTerm(t1);
|
at = AtomOfTerm(t1);
|
||||||
if (IsWideAtom(at)) {
|
if (IsWideAtom(at)) {
|
||||||
wchar_t *ws, *ws1 = (wchar_t *)H;
|
wchar_t *ws, *ws1 = (wchar_t *)HR;
|
||||||
char *s1 = (char *)H;
|
char *s1 = (char *)HR;
|
||||||
size_t wlen;
|
size_t wlen;
|
||||||
|
|
||||||
ws = (wchar_t *)RepAtom(at)->StrOfAE;
|
ws = (wchar_t *)RepAtom(at)->StrOfAE;
|
||||||
@ -1112,12 +1112,12 @@ p_atom_split( USES_REGS1 )
|
|||||||
if (is_wide(ws+len)) {
|
if (is_wide(ws+len)) {
|
||||||
to2 = MkAtomTerm(Yap_LookupWideAtom(ws+len));
|
to2 = MkAtomTerm(Yap_LookupWideAtom(ws+len));
|
||||||
} else {
|
} else {
|
||||||
char *s2 = (char *)H;
|
char *s2 = (char *)HR;
|
||||||
if (s2+(wlen-len) > (char *)ASP-1024)
|
if (s2+(wlen-len) > (char *)ASP-1024)
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,t1,"$atom_split/4");
|
Yap_Error(OUT_OF_STACK_ERROR,t1,"$atom_split/4");
|
||||||
ws += len;
|
ws += len;
|
||||||
while ((*s2++ = *ws++));
|
while ((*s2++ = *ws++));
|
||||||
to2 = MkAtomTerm(Yap_LookupAtom((char *)H));
|
to2 = MkAtomTerm(Yap_LookupAtom((char *)HR));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s1[len] = '\0';
|
s1[len] = '\0';
|
||||||
@ -1126,7 +1126,7 @@ p_atom_split( USES_REGS1 )
|
|||||||
to2 = MkAtomTerm(Yap_LookupWideAtom(ws+len));
|
to2 = MkAtomTerm(Yap_LookupWideAtom(ws+len));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *s, *s1 = (char *)H;
|
char *s, *s1 = (char *)HR;
|
||||||
|
|
||||||
s = RepAtom(at)->StrOfAE;
|
s = RepAtom(at)->StrOfAE;
|
||||||
if (len > (Int)strlen(s)) return(FALSE);
|
if (len > (Int)strlen(s)) return(FALSE);
|
||||||
@ -1203,8 +1203,8 @@ p_string_number( USES_REGS1 )
|
|||||||
|
|
||||||
static void *
|
static void *
|
||||||
alloc_tmp_stack(size_t sz USES_REGS) {
|
alloc_tmp_stack(size_t sz USES_REGS) {
|
||||||
void *pt = (void *)H;
|
void *pt = (void *)HR;
|
||||||
while (H > ASP-(1044+sz/sizeof(CELL))) {
|
while (HR > ASP-(1044+sz/sizeof(CELL))) {
|
||||||
if (!Yap_gc(5, ENV, gc_P(P,CP))) {
|
if (!Yap_gc(5, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "sub_atom/5");
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "sub_atom/5");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -1245,7 +1245,7 @@ build_new_atomic(int mask, wchar_t *wp, char *p, size_t min, size_t len USES_REG
|
|||||||
char *cp = src, *buf, *lim = cp+strlen(cp);
|
char *cp = src, *buf, *lim = cp+strlen(cp);
|
||||||
|
|
||||||
LOCAL_TERM_ERROR( 4*(len+1) );
|
LOCAL_TERM_ERROR( 4*(len+1) );
|
||||||
buf = buf_from_tstring(H);
|
buf = buf_from_tstring(HR);
|
||||||
while (cp < lim) {
|
while (cp < lim) {
|
||||||
int chr;
|
int chr;
|
||||||
cp = utf8_get_char(cp, &chr);
|
cp = utf8_get_char(cp, &chr);
|
||||||
|
82
C/attvar.c
82
C/attvar.c
@ -73,8 +73,8 @@ BuildNewAttVar( USES_REGS1 )
|
|||||||
attvar_record *newv;
|
attvar_record *newv;
|
||||||
|
|
||||||
/* add a new attributed variable */
|
/* add a new attributed variable */
|
||||||
newv = (attvar_record *)H;
|
newv = (attvar_record *)HR;
|
||||||
H = (CELL *)(newv+1);
|
HR = (CELL *)(newv+1);
|
||||||
newv->AttFunc = FunctorAttVar;
|
newv->AttFunc = FunctorAttVar;
|
||||||
RESET_VARIABLE(&(newv->Value));
|
RESET_VARIABLE(&(newv->Value));
|
||||||
RESET_VARIABLE(&(newv->Done));
|
RESET_VARIABLE(&(newv->Done));
|
||||||
@ -97,9 +97,9 @@ CopyAttVar(CELL *orig, struct cp_frame **to_visit_ptr, CELL *res USES_REGS)
|
|||||||
to_visit->start_cp = vt-1;
|
to_visit->start_cp = vt-1;
|
||||||
to_visit->end_cp = vt;
|
to_visit->end_cp = vt;
|
||||||
if (IsVarTerm(attv->Atts)) {
|
if (IsVarTerm(attv->Atts)) {
|
||||||
Bind_Global_NonAtt(&newv->Atts, (CELL)H);
|
Bind_Global_NonAtt(&newv->Atts, (CELL)HR);
|
||||||
to_visit->to = H;
|
to_visit->to = HR;
|
||||||
H++;
|
HR++;
|
||||||
} else {
|
} else {
|
||||||
to_visit->to = &(newv->Atts);
|
to_visit->to = &(newv->Atts);
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ WakeAttVar(CELL* pt1, CELL reg2 USES_REGS)
|
|||||||
|
|
||||||
/* if bound to someone else, follow until we find the last one */
|
/* if bound to someone else, follow until we find the last one */
|
||||||
attvar_record *attv = RepAttVar(pt1);
|
attvar_record *attv = RepAttVar(pt1);
|
||||||
CELL *myH = H;
|
CELL *myH = HR;
|
||||||
CELL *bind_ptr;
|
CELL *bind_ptr;
|
||||||
|
|
||||||
if (IsVarTerm(Deref(attv->Atts))) {
|
if (IsVarTerm(Deref(attv->Atts))) {
|
||||||
@ -201,9 +201,9 @@ WakeAttVar(CELL* pt1, CELL reg2 USES_REGS)
|
|||||||
bind_ptr = AddToQueue(attv PASS_REGS);
|
bind_ptr = AddToQueue(attv PASS_REGS);
|
||||||
if (IsNonVarTerm(reg2)) {
|
if (IsNonVarTerm(reg2)) {
|
||||||
if (IsPairTerm(reg2) && RepPair(reg2) == myH)
|
if (IsPairTerm(reg2) && RepPair(reg2) == myH)
|
||||||
reg2 = AbsPair(H);
|
reg2 = AbsPair(HR);
|
||||||
else if (IsApplTerm(reg2) && RepAppl(reg2) == myH)
|
else if (IsApplTerm(reg2) && RepAppl(reg2) == myH)
|
||||||
reg2 = AbsAppl(H);
|
reg2 = AbsAppl(HR);
|
||||||
}
|
}
|
||||||
*bind_ptr = reg2;
|
*bind_ptr = reg2;
|
||||||
Bind_Global_NonAtt(&(attv->Value), reg2);
|
Bind_Global_NonAtt(&(attv->Value), reg2);
|
||||||
@ -227,19 +227,19 @@ mark_attvar(CELL *orig)
|
|||||||
static Term
|
static Term
|
||||||
BuildAttTerm(Functor mfun, UInt ar USES_REGS)
|
BuildAttTerm(Functor mfun, UInt ar USES_REGS)
|
||||||
{
|
{
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
UInt i;
|
UInt i;
|
||||||
|
|
||||||
if (H+(1024+ar) > ASP) {
|
if (HR+(1024+ar) > ASP) {
|
||||||
LOCAL_Error_Size=ar*sizeof(CELL);
|
LOCAL_Error_Size=ar*sizeof(CELL);
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
H[0] = (CELL)mfun;
|
HR[0] = (CELL)mfun;
|
||||||
RESET_VARIABLE(H+1);
|
RESET_VARIABLE(HR+1);
|
||||||
H += 2;
|
HR += 2;
|
||||||
for (i = 1; i< ar; i++) {
|
for (i = 1; i< ar; i++) {
|
||||||
*H = TermVoidAtt;
|
*HR = TermVoidAtt;
|
||||||
H++;
|
HR++;
|
||||||
}
|
}
|
||||||
return AbsAppl(h0);
|
return AbsAppl(h0);
|
||||||
}
|
}
|
||||||
@ -390,7 +390,7 @@ DelAtts(attvar_record *attv, Term oatt USES_REGS)
|
|||||||
static void
|
static void
|
||||||
PutAtt(Int pos, Term atts, Term att USES_REGS)
|
PutAtt(Int pos, Term atts, Term att USES_REGS)
|
||||||
{
|
{
|
||||||
if (IsVarTerm(att) && VarOfTerm(att) > H && VarOfTerm(att) < LCL0) {
|
if (IsVarTerm(att) && VarOfTerm(att) > HR && VarOfTerm(att) < LCL0) {
|
||||||
/* globalise locals */
|
/* globalise locals */
|
||||||
Term tnew = MkVarTerm();
|
Term tnew = MkVarTerm();
|
||||||
Bind_NonAtt(VarOfTerm(att), tnew);
|
Bind_NonAtt(VarOfTerm(att), tnew);
|
||||||
@ -850,23 +850,23 @@ p_modules_with_atts( USES_REGS1 ) {
|
|||||||
if (IsVarTerm(inp)) {
|
if (IsVarTerm(inp)) {
|
||||||
if (IsAttachedTerm(inp)) {
|
if (IsAttachedTerm(inp)) {
|
||||||
attvar_record *attv = RepAttVar(VarOfTerm(inp));
|
attvar_record *attv = RepAttVar(VarOfTerm(inp));
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
Term tatt;
|
Term tatt;
|
||||||
|
|
||||||
if (IsVarTerm(tatt = attv->Atts))
|
if (IsVarTerm(tatt = attv->Atts))
|
||||||
return Yap_unify(ARG2,TermNil);
|
return Yap_unify(ARG2,TermNil);
|
||||||
while (!IsVarTerm(tatt)) {
|
while (!IsVarTerm(tatt)) {
|
||||||
Functor f = FunctorOfTerm(tatt);
|
Functor f = FunctorOfTerm(tatt);
|
||||||
if (H != h0)
|
if (HR != h0)
|
||||||
H[-1] = AbsPair(H);
|
HR[-1] = AbsPair(HR);
|
||||||
if (ActiveAtt(tatt, ArityOfFunctor(f))) {
|
if (ActiveAtt(tatt, ArityOfFunctor(f))) {
|
||||||
*H = MkAtomTerm(NameOfFunctor(f));
|
*HR = MkAtomTerm(NameOfFunctor(f));
|
||||||
H+=2;
|
HR+=2;
|
||||||
}
|
}
|
||||||
tatt = ArgOfTerm(1,tatt);
|
tatt = ArgOfTerm(1,tatt);
|
||||||
}
|
}
|
||||||
if (h0 != H) {
|
if (h0 != HR) {
|
||||||
H[-1] = TermNil;
|
HR[-1] = TermNil;
|
||||||
return Yap_unify(ARG2,AbsPair(h0));
|
return Yap_unify(ARG2,AbsPair(h0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -887,7 +887,7 @@ p_swi_all_atts( USES_REGS1 ) {
|
|||||||
if (IsVarTerm(inp)) {
|
if (IsVarTerm(inp)) {
|
||||||
if (IsAttachedTerm(inp)) {
|
if (IsAttachedTerm(inp)) {
|
||||||
attvar_record *attv = RepAttVar(VarOfTerm(inp));
|
attvar_record *attv = RepAttVar(VarOfTerm(inp));
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
Term tatt;
|
Term tatt;
|
||||||
|
|
||||||
if (IsVarTerm(tatt = attv->Atts))
|
if (IsVarTerm(tatt = attv->Atts))
|
||||||
@ -896,21 +896,21 @@ p_swi_all_atts( USES_REGS1 ) {
|
|||||||
Functor f = FunctorOfTerm(tatt);
|
Functor f = FunctorOfTerm(tatt);
|
||||||
UInt ar = ArityOfFunctor(f);
|
UInt ar = ArityOfFunctor(f);
|
||||||
|
|
||||||
if (H != h0)
|
if (HR != h0)
|
||||||
H[-1] = AbsAppl(H);
|
HR[-1] = AbsAppl(HR);
|
||||||
H[0] = (CELL) attf;
|
HR[0] = (CELL) attf;
|
||||||
H[1] = MkAtomTerm(NameOfFunctor(f));
|
HR[1] = MkAtomTerm(NameOfFunctor(f));
|
||||||
/* SWI */
|
/* SWI */
|
||||||
if (ar == 2)
|
if (ar == 2)
|
||||||
H[2] = ArgOfTerm(2,tatt);
|
HR[2] = ArgOfTerm(2,tatt);
|
||||||
else
|
else
|
||||||
H[2] = tatt;
|
HR[2] = tatt;
|
||||||
H += 4;
|
HR += 4;
|
||||||
H[-1] = AbsAppl(H);
|
HR[-1] = AbsAppl(HR);
|
||||||
tatt = ArgOfTerm(1,tatt);
|
tatt = ArgOfTerm(1,tatt);
|
||||||
}
|
}
|
||||||
if (h0 != H) {
|
if (h0 != HR) {
|
||||||
H[-1] = TermNil;
|
HR[-1] = TermNil;
|
||||||
return Yap_unify(ARG2,AbsAppl(h0));
|
return Yap_unify(ARG2,AbsAppl(h0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -925,17 +925,17 @@ p_swi_all_atts( USES_REGS1 ) {
|
|||||||
static Term
|
static Term
|
||||||
AllAttVars( USES_REGS1 ) {
|
AllAttVars( USES_REGS1 ) {
|
||||||
CELL *pt = H0;
|
CELL *pt = H0;
|
||||||
CELL *myH = H;
|
CELL *myH = HR;
|
||||||
|
|
||||||
while (pt < myH) {
|
while (pt < myH) {
|
||||||
switch(*pt) {
|
switch(*pt) {
|
||||||
case (CELL)FunctorAttVar:
|
case (CELL)FunctorAttVar:
|
||||||
if (IsUnboundVar(pt+1)) {
|
if (IsUnboundVar(pt+1)) {
|
||||||
if (ASP - myH < 1024) {
|
if (ASP - myH < 1024) {
|
||||||
LOCAL_Error_Size = (ASP-H)*sizeof(CELL);
|
LOCAL_Error_Size = (ASP-HR)*sizeof(CELL);
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
if (myH != H) {
|
if (myH != HR) {
|
||||||
myH[-1] = AbsPair(myH);
|
myH[-1] = AbsPair(myH);
|
||||||
}
|
}
|
||||||
myH[0] = AbsAttVar((attvar_record *)pt);
|
myH[0] = AbsAttVar((attvar_record *)pt);
|
||||||
@ -944,7 +944,7 @@ AllAttVars( USES_REGS1 ) {
|
|||||||
pt += (1+ATT_RECORD_ARITY);
|
pt += (1+ATT_RECORD_ARITY);
|
||||||
break;
|
break;
|
||||||
case (CELL)FunctorDouble:
|
case (CELL)FunctorDouble:
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
pt += 4;
|
pt += 4;
|
||||||
#else
|
#else
|
||||||
pt += 3;
|
pt += 3;
|
||||||
@ -968,10 +968,10 @@ AllAttVars( USES_REGS1 ) {
|
|||||||
pt++;
|
pt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (myH != H) {
|
if (myH != HR) {
|
||||||
Term out = AbsPair(H);
|
Term out = AbsPair(HR);
|
||||||
myH[-1] = TermNil;
|
myH[-1] = TermNil;
|
||||||
H = myH;
|
HR = myH;
|
||||||
return out;
|
return out;
|
||||||
} else {
|
} else {
|
||||||
return TermNil;
|
return TermNil;
|
||||||
|
48
C/bignum.c
48
C/bignum.c
@ -38,8 +38,8 @@ Yap_MkBigIntTerm(MP_INT *big)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Int nlimbs;
|
Int nlimbs;
|
||||||
MP_INT *dst = (MP_INT *)(H+2);
|
MP_INT *dst = (MP_INT *)(HR+2);
|
||||||
CELL *ret = H;
|
CELL *ret = HR;
|
||||||
Int bytes;
|
Int bytes;
|
||||||
|
|
||||||
if (mpz_fits_slong_p(big)) {
|
if (mpz_fits_slong_p(big)) {
|
||||||
@ -54,15 +54,15 @@ Yap_MkBigIntTerm(MP_INT *big)
|
|||||||
if (nlimbs > (ASP-ret)-1024) {
|
if (nlimbs > (ASP-ret)-1024) {
|
||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
H[0] = (CELL)FunctorBigInt;
|
HR[0] = (CELL)FunctorBigInt;
|
||||||
H[1] = BIG_INT;
|
HR[1] = BIG_INT;
|
||||||
|
|
||||||
dst->_mp_size = big->_mp_size;
|
dst->_mp_size = big->_mp_size;
|
||||||
dst->_mp_alloc = nlimbs*(CellSize/sizeof(mp_limb_t));
|
dst->_mp_alloc = nlimbs*(CellSize/sizeof(mp_limb_t));
|
||||||
memmove((void *)(dst+1), (const void *)(big->_mp_d), bytes);
|
memmove((void *)(dst+1), (const void *)(big->_mp_d), bytes);
|
||||||
H = (CELL *)(dst+1)+nlimbs;
|
HR = (CELL *)(dst+1)+nlimbs;
|
||||||
H[0] = EndSpecials;
|
HR[0] = EndSpecials;
|
||||||
H++;
|
HR++;
|
||||||
return AbsAppl(ret);
|
return AbsAppl(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,19 +81,19 @@ Yap_MkBigRatTerm(MP_RAT *big)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Int nlimbs;
|
Int nlimbs;
|
||||||
MP_INT *dst = (MP_INT *)(H+2);
|
MP_INT *dst = (MP_INT *)(HR+2);
|
||||||
MP_INT *num = mpq_numref(big);
|
MP_INT *num = mpq_numref(big);
|
||||||
MP_INT *den = mpq_denref(big);
|
MP_INT *den = mpq_denref(big);
|
||||||
MP_RAT *rat;
|
MP_RAT *rat;
|
||||||
CELL *ret = H;
|
CELL *ret = HR;
|
||||||
|
|
||||||
if (mpz_cmp_si(den, 1) == 0)
|
if (mpz_cmp_si(den, 1) == 0)
|
||||||
return Yap_MkBigIntTerm(num);
|
return Yap_MkBigIntTerm(num);
|
||||||
if ((num->_mp_alloc+den->_mp_alloc)*(sizeof(mp_limb_t)/CellSize) > (ASP-ret)-1024) {
|
if ((num->_mp_alloc+den->_mp_alloc)*(sizeof(mp_limb_t)/CellSize) > (ASP-ret)-1024) {
|
||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
H[0] = (CELL)FunctorBigInt;
|
HR[0] = (CELL)FunctorBigInt;
|
||||||
H[1] = BIG_RATIONAL;
|
HR[1] = BIG_RATIONAL;
|
||||||
dst->_mp_size = 0;
|
dst->_mp_size = 0;
|
||||||
rat = (MP_RAT *)(dst+1);
|
rat = (MP_RAT *)(dst+1);
|
||||||
rat->_mp_num._mp_size = num->_mp_size;
|
rat->_mp_num._mp_size = num->_mp_size;
|
||||||
@ -102,13 +102,13 @@ Yap_MkBigRatTerm(MP_RAT *big)
|
|||||||
memmove((void *)(rat+1), (const void *)(num->_mp_d), nlimbs*CellSize);
|
memmove((void *)(rat+1), (const void *)(num->_mp_d), nlimbs*CellSize);
|
||||||
rat->_mp_den._mp_size = den->_mp_size;
|
rat->_mp_den._mp_size = den->_mp_size;
|
||||||
rat->_mp_den._mp_alloc = den->_mp_alloc;
|
rat->_mp_den._mp_alloc = den->_mp_alloc;
|
||||||
H = (CELL *)(rat+1)+nlimbs;
|
HR = (CELL *)(rat+1)+nlimbs;
|
||||||
nlimbs = (den->_mp_alloc)*(sizeof(mp_limb_t)/CellSize);
|
nlimbs = (den->_mp_alloc)*(sizeof(mp_limb_t)/CellSize);
|
||||||
memmove((void *)(H), (const void *)(den->_mp_d), nlimbs*CellSize);
|
memmove((void *)(HR), (const void *)(den->_mp_d), nlimbs*CellSize);
|
||||||
H += nlimbs;
|
HR += nlimbs;
|
||||||
dst->_mp_alloc = (H-(CELL *)(dst+1));
|
dst->_mp_alloc = (HR-(CELL *)(dst+1));
|
||||||
H[0] = EndSpecials;
|
HR[0] = EndSpecials;
|
||||||
H++;
|
HR++;
|
||||||
return AbsAppl(ret);
|
return AbsAppl(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,20 +142,20 @@ Yap_AllocExternalDataInStack(CELL tag, size_t bytes)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Int nlimbs;
|
Int nlimbs;
|
||||||
MP_INT *dst = (MP_INT *)(H+2);
|
MP_INT *dst = (MP_INT *)(HR+2);
|
||||||
CELL *ret = H;
|
CELL *ret = HR;
|
||||||
|
|
||||||
nlimbs = ALIGN_YAPTYPE(bytes,CELL)/CellSize;
|
nlimbs = ALIGN_YAPTYPE(bytes,CELL)/CellSize;
|
||||||
if (nlimbs > (ASP-ret)-1024) {
|
if (nlimbs > (ASP-ret)-1024) {
|
||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
H[0] = (CELL)FunctorBigInt;
|
HR[0] = (CELL)FunctorBigInt;
|
||||||
H[1] = tag;
|
HR[1] = tag;
|
||||||
dst->_mp_size = 0;
|
dst->_mp_size = 0;
|
||||||
dst->_mp_alloc = nlimbs;
|
dst->_mp_alloc = nlimbs;
|
||||||
H = (CELL *)(dst+1)+nlimbs;
|
HR = (CELL *)(dst+1)+nlimbs;
|
||||||
H[0] = EndSpecials;
|
HR[0] = EndSpecials;
|
||||||
H++;
|
HR++;
|
||||||
if (tag != EXTERNAL_BLOB) {
|
if (tag != EXTERNAL_BLOB) {
|
||||||
TrailTerm(TR) = AbsPair(ret);
|
TrailTerm(TR) = AbsPair(ret);
|
||||||
TR++;
|
TR++;
|
||||||
|
@ -379,8 +379,6 @@
|
|||||||
|
|
||||||
#if defined(_MSC_VER) && defined(YAP_EXPORTS)
|
#if defined(_MSC_VER) && defined(YAP_EXPORTS)
|
||||||
#define X_API __declspec(dllexport)
|
#define X_API __declspec(dllexport)
|
||||||
#else
|
|
||||||
#define X_API
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
X_API Term YAP_A(int);
|
X_API Term YAP_A(int);
|
||||||
@ -802,21 +800,21 @@ YAP_MkBlobTerm(unsigned int sz)
|
|||||||
MP_INT *dst;
|
MP_INT *dst;
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
|
|
||||||
while (H+(sz+sizeof(MP_INT)/sizeof(CELL)+2) > ASP-1024) {
|
while (HR+(sz+sizeof(MP_INT)/sizeof(CELL)+2) > ASP-1024) {
|
||||||
if (!doexpand((sz+sizeof(MP_INT)/sizeof(CELL)+2)*sizeof(CELL))) {
|
if (!doexpand((sz+sizeof(MP_INT)/sizeof(CELL)+2)*sizeof(CELL))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "YAP failed to grow the stack while constructing a blob: %s", LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "YAP failed to grow the stack while constructing a blob: %s", LOCAL_ErrorMessage);
|
||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
I = AbsAppl(H);
|
I = AbsAppl(HR);
|
||||||
H[0] = (CELL)FunctorBigInt;
|
HR[0] = (CELL)FunctorBigInt;
|
||||||
H[1] = ARRAY_INT;
|
HR[1] = ARRAY_INT;
|
||||||
dst = (MP_INT *)(H+2);
|
dst = (MP_INT *)(HR+2);
|
||||||
dst->_mp_size = 0L;
|
dst->_mp_size = 0L;
|
||||||
dst->_mp_alloc = sz;
|
dst->_mp_alloc = sz;
|
||||||
H += (2+sizeof(MP_INT)/sizeof(CELL));
|
HR += (2+sizeof(MP_INT)/sizeof(CELL));
|
||||||
H[sz] = EndSpecials;
|
HR[sz] = EndSpecials;
|
||||||
H += sz+1;
|
HR += sz+1;
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
|
|
||||||
return I;
|
return I;
|
||||||
@ -982,7 +980,7 @@ YAP_MkPairTerm(Term t1, Term t2)
|
|||||||
Term t;
|
Term t;
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
|
|
||||||
while (H > ASP-1024) {
|
while (HR > ASP-1024) {
|
||||||
Int sl1 = Yap_InitSlot(t1 PASS_REGS);
|
Int sl1 = Yap_InitSlot(t1 PASS_REGS);
|
||||||
Int sl2 = Yap_InitSlot(t2 PASS_REGS);
|
Int sl2 = Yap_InitSlot(t2 PASS_REGS);
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
@ -1008,7 +1006,7 @@ YAP_MkListFromTerms(Term *ta, Int sz)
|
|||||||
if (sz == 0)
|
if (sz == 0)
|
||||||
return TermNil;
|
return TermNil;
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
while (H+sz*2 > ASP-1024) {
|
while (HR+sz*2 > ASP-1024) {
|
||||||
Int sl1 = Yap_InitSlot((CELL)ta PASS_REGS);
|
Int sl1 = Yap_InitSlot((CELL)ta PASS_REGS);
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
if (!Yap_dogc( 0, NULL PASS_REGS )) {
|
if (!Yap_dogc( 0, NULL PASS_REGS )) {
|
||||||
@ -1018,7 +1016,7 @@ YAP_MkListFromTerms(Term *ta, Int sz)
|
|||||||
ta = (CELL *)Yap_GetFromSlot(sl1 PASS_REGS);
|
ta = (CELL *)Yap_GetFromSlot(sl1 PASS_REGS);
|
||||||
Yap_RecoverSlots(1 PASS_REGS);
|
Yap_RecoverSlots(1 PASS_REGS);
|
||||||
}
|
}
|
||||||
h = H;
|
h = HR;
|
||||||
t = AbsPair(h);
|
t = AbsPair(h);
|
||||||
while (sz--) {
|
while (sz--) {
|
||||||
Term ti = *ta++;
|
Term ti = *ta++;
|
||||||
@ -1032,7 +1030,7 @@ YAP_MkListFromTerms(Term *ta, Int sz)
|
|||||||
h += 2;
|
h += 2;
|
||||||
}
|
}
|
||||||
h[-1] = TermNil;
|
h[-1] = TermNil;
|
||||||
H = h;
|
HR = h;
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -1044,7 +1042,7 @@ YAP_MkNewPairTerm()
|
|||||||
Term t;
|
Term t;
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
|
|
||||||
if (H > ASP-1024)
|
if (HR > ASP-1024)
|
||||||
t = TermNil;
|
t = TermNil;
|
||||||
else
|
else
|
||||||
t = Yap_MkNewPairTerm();
|
t = Yap_MkNewPairTerm();
|
||||||
@ -1102,7 +1100,7 @@ YAP_MkApplTerm(Functor f,UInt arity, Term args[])
|
|||||||
Term t;
|
Term t;
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
|
|
||||||
if (H+arity > ASP-1024)
|
if (HR+arity > ASP-1024)
|
||||||
t = TermNil;
|
t = TermNil;
|
||||||
else
|
else
|
||||||
t = Yap_MkApplTerm(f, arity, args);
|
t = Yap_MkApplTerm(f, arity, args);
|
||||||
@ -1118,7 +1116,7 @@ YAP_MkNewApplTerm(Functor f,UInt arity)
|
|||||||
Term t;
|
Term t;
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
|
|
||||||
if (H+arity > ASP-1024)
|
if (HR+arity > ASP-1024)
|
||||||
t = TermNil;
|
t = TermNil;
|
||||||
else
|
else
|
||||||
t = Yap_MkNewApplTerm(f, arity);
|
t = Yap_MkNewApplTerm(f, arity);
|
||||||
@ -1193,7 +1191,7 @@ YAP_ExtraSpace(void)
|
|||||||
|
|
||||||
/* find a pointer to extra space allocable */
|
/* find a pointer to extra space allocable */
|
||||||
ptr = (void *)((CELL *)(B+1)+P->u.OtapFs.s);
|
ptr = (void *)((CELL *)(B+1)+P->u.OtapFs.s);
|
||||||
B->cp_h = H;
|
B->cp_h = HR;
|
||||||
|
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
RECOVER_B();
|
RECOVER_B();
|
||||||
@ -2466,7 +2464,7 @@ YAP_LeaveGoal(int backtrack, YAP_dogoalinfo *dgi)
|
|||||||
P = FAILCODE;
|
P = FAILCODE;
|
||||||
Yap_exec_absmi(TRUE);
|
Yap_exec_absmi(TRUE);
|
||||||
/* recover stack space */
|
/* recover stack space */
|
||||||
H = B->cp_h;
|
HR = B->cp_h;
|
||||||
TR = B->cp_tr;
|
TR = B->cp_tr;
|
||||||
#ifdef DEPTH_LIMIT
|
#ifdef DEPTH_LIMIT
|
||||||
DEPTH = B->cp_depth;
|
DEPTH = B->cp_depth;
|
||||||
@ -2702,7 +2700,7 @@ YAP_ShutdownGoal(int backtrack)
|
|||||||
P = FAILCODE;
|
P = FAILCODE;
|
||||||
Yap_exec_absmi(TRUE);
|
Yap_exec_absmi(TRUE);
|
||||||
/* recover stack space */
|
/* recover stack space */
|
||||||
H = cut_pt->cp_h;
|
HR = cut_pt->cp_h;
|
||||||
TR = cut_pt->cp_tr;
|
TR = cut_pt->cp_tr;
|
||||||
}
|
}
|
||||||
/* we can always recover the stack */
|
/* we can always recover the stack */
|
||||||
@ -3381,9 +3379,6 @@ YAP_Reset(void)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
int res = TRUE;
|
int res = TRUE;
|
||||||
#if !defined(YAPOR) && !defined(THREADS)
|
|
||||||
int worker_id = 0;
|
|
||||||
#endif
|
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
|
|
||||||
YAP_ClearExceptions();
|
YAP_ClearExceptions();
|
||||||
@ -3707,8 +3702,8 @@ YAP_FloatsToList(double *dblp, size_t sz)
|
|||||||
|
|
||||||
if (!sz)
|
if (!sz)
|
||||||
return TermNil;
|
return TermNil;
|
||||||
while (ASP-1024 < H + sz*(2+2+SIZEOF_DOUBLE/SIZEOF_LONG_INT)) {
|
while (ASP-1024 < HR + sz*(2+2+SIZEOF_DOUBLE/SIZEOF_INT_P)) {
|
||||||
if ((CELL *)dblp > H0 && (CELL *)dblp < H) {
|
if ((CELL *)dblp > H0 && (CELL *)dblp < HR) {
|
||||||
/* we are in trouble */
|
/* we are in trouble */
|
||||||
LOCAL_OpenArray = (CELL *)dblp;
|
LOCAL_OpenArray = (CELL *)dblp;
|
||||||
}
|
}
|
||||||
@ -3719,12 +3714,12 @@ YAP_FloatsToList(double *dblp, size_t sz)
|
|||||||
dblp = (double *)LOCAL_OpenArray;
|
dblp = (double *)LOCAL_OpenArray;
|
||||||
LOCAL_OpenArray = NULL;
|
LOCAL_OpenArray = NULL;
|
||||||
}
|
}
|
||||||
t = AbsPair(H);
|
t = AbsPair(HR);
|
||||||
while (sz) {
|
while (sz) {
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
H +=2;
|
HR +=2;
|
||||||
oldH[0] = MkFloatTerm(*dblp++);
|
oldH[0] = MkFloatTerm(*dblp++);
|
||||||
oldH[1] = AbsPair(H);
|
oldH[1] = AbsPair(HR);
|
||||||
sz--;
|
sz--;
|
||||||
}
|
}
|
||||||
oldH[1] = TermNil;
|
oldH[1] = TermNil;
|
||||||
@ -3779,8 +3774,8 @@ YAP_IntsToList(Int *dblp, size_t sz)
|
|||||||
|
|
||||||
if (!sz)
|
if (!sz)
|
||||||
return TermNil;
|
return TermNil;
|
||||||
while (ASP-1024 < H + sz*3) {
|
while (ASP-1024 < HR + sz*3) {
|
||||||
if ((CELL *)dblp > H0 && (CELL *)dblp < H) {
|
if ((CELL *)dblp > H0 && (CELL *)dblp < HR) {
|
||||||
/* we are in trouble */
|
/* we are in trouble */
|
||||||
LOCAL_OpenArray = (CELL *)dblp;
|
LOCAL_OpenArray = (CELL *)dblp;
|
||||||
}
|
}
|
||||||
@ -3791,12 +3786,12 @@ YAP_IntsToList(Int *dblp, size_t sz)
|
|||||||
dblp = (Int *)LOCAL_OpenArray;
|
dblp = (Int *)LOCAL_OpenArray;
|
||||||
LOCAL_OpenArray = NULL;
|
LOCAL_OpenArray = NULL;
|
||||||
}
|
}
|
||||||
t = AbsPair(H);
|
t = AbsPair(HR);
|
||||||
while (sz) {
|
while (sz) {
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
H +=2;
|
HR +=2;
|
||||||
oldH[0] = MkIntegerTerm(*dblp++);
|
oldH[0] = MkIntegerTerm(*dblp++);
|
||||||
oldH[1] = AbsPair(H);
|
oldH[1] = AbsPair(HR);
|
||||||
sz--;
|
sz--;
|
||||||
}
|
}
|
||||||
oldH[1] = TermNil;
|
oldH[1] = TermNil;
|
||||||
@ -3835,14 +3830,14 @@ YAP_OpenList(int n)
|
|||||||
Term t;
|
Term t;
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
|
|
||||||
while (H+2*n > ASP-1024) {
|
while (HR+2*n > ASP-1024) {
|
||||||
if (!Yap_dogc( 0, NULL PASS_REGS )) {
|
if (!Yap_dogc( 0, NULL PASS_REGS )) {
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t = AbsPair(H);
|
t = AbsPair(HR);
|
||||||
H += 2*n;
|
HR += 2*n;
|
||||||
|
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
return t;
|
return t;
|
||||||
@ -4055,7 +4050,7 @@ YAP_SetYAPFlag(yap_flag_t flag, int val)
|
|||||||
Int YAP_VarSlotToNumber(Int s) {
|
Int YAP_VarSlotToNumber(Int s) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Term *t = (CELL *)Deref(Yap_GetFromSlot(s PASS_REGS));
|
Term *t = (CELL *)Deref(Yap_GetFromSlot(s PASS_REGS));
|
||||||
if (t < H)
|
if (t < HR)
|
||||||
return t-H0;
|
return t-H0;
|
||||||
return t-LCL0;
|
return t-LCL0;
|
||||||
}
|
}
|
||||||
@ -4265,11 +4260,11 @@ YAP_RequiresExtraStack(size_t sz) {
|
|||||||
|
|
||||||
if (sz < 16*1024)
|
if (sz < 16*1024)
|
||||||
sz = 16*1024;
|
sz = 16*1024;
|
||||||
if (H <= ASP-sz) {
|
if (HR <= ASP-sz) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
while (H > ASP-sz) {
|
while (HR > ASP-sz) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
if (!Yap_dogc( 0, NULL PASS_REGS )) {
|
if (!Yap_dogc( 0, NULL PASS_REGS )) {
|
||||||
|
38
C/cdmgr.c
38
C/cdmgr.c
@ -3520,26 +3520,26 @@ Yap_find_owner_index(yamop *ipc, PredEntry *ap)
|
|||||||
static Term
|
static Term
|
||||||
all_envs(CELL *env_ptr USES_REGS)
|
all_envs(CELL *env_ptr USES_REGS)
|
||||||
{
|
{
|
||||||
Term tf = AbsPair(H);
|
Term tf = AbsPair(HR);
|
||||||
CELL *start = H;
|
CELL *start = HR;
|
||||||
CELL *bp = NULL;
|
CELL *bp = NULL;
|
||||||
|
|
||||||
/* walk the environment chain */
|
/* walk the environment chain */
|
||||||
while (env_ptr) {
|
while (env_ptr) {
|
||||||
bp = H;
|
bp = HR;
|
||||||
H += 2;
|
HR += 2;
|
||||||
/* notice that MkIntegerTerm may increase the Heap */
|
/* notice that MkIntegerTerm may increase the Heap */
|
||||||
bp[0] = MkIntegerTerm(LCL0-env_ptr);
|
bp[0] = MkIntegerTerm(LCL0-env_ptr);
|
||||||
if (H >= ASP-1024) {
|
if (HR >= ASP-1024) {
|
||||||
H = start;
|
HR = start;
|
||||||
LOCAL_Error_Size = (ASP-1024)-H;
|
LOCAL_Error_Size = (ASP-1024)-HR;
|
||||||
while (env_ptr) {
|
while (env_ptr) {
|
||||||
LOCAL_Error_Size += 2;
|
LOCAL_Error_Size += 2;
|
||||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
env_ptr = (CELL *)(env_ptr[E_E]);
|
||||||
}
|
}
|
||||||
return 0L;
|
return 0L;
|
||||||
} else {
|
} else {
|
||||||
bp[1] = AbsPair(H);
|
bp[1] = AbsPair(HR);
|
||||||
}
|
}
|
||||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
env_ptr = (CELL *)(env_ptr[E_E]);
|
||||||
}
|
}
|
||||||
@ -3551,24 +3551,24 @@ static Term
|
|||||||
all_cps(choiceptr b_ptr USES_REGS)
|
all_cps(choiceptr b_ptr USES_REGS)
|
||||||
{
|
{
|
||||||
CELL *bp = NULL;
|
CELL *bp = NULL;
|
||||||
CELL *start = H;
|
CELL *start = HR;
|
||||||
Term tf = AbsPair(H);
|
Term tf = AbsPair(HR);
|
||||||
|
|
||||||
while (b_ptr) {
|
while (b_ptr) {
|
||||||
bp = H;
|
bp = HR;
|
||||||
H += 2;
|
HR += 2;
|
||||||
/* notice that MkIntegerTerm may increase the Heap */
|
/* notice that MkIntegerTerm may increase the Heap */
|
||||||
bp[0] = MkIntegerTerm((Int)(LCL0-(CELL *)b_ptr));
|
bp[0] = MkIntegerTerm((Int)(LCL0-(CELL *)b_ptr));
|
||||||
if (H >= ASP-1024) {
|
if (HR >= ASP-1024) {
|
||||||
H = start;
|
HR = start;
|
||||||
LOCAL_Error_Size = (ASP-1024)-H;
|
LOCAL_Error_Size = (ASP-1024)-HR;
|
||||||
while (b_ptr) {
|
while (b_ptr) {
|
||||||
LOCAL_Error_Size += 2;
|
LOCAL_Error_Size += 2;
|
||||||
b_ptr = b_ptr->cp_b;
|
b_ptr = b_ptr->cp_b;
|
||||||
}
|
}
|
||||||
return 0L;
|
return 0L;
|
||||||
} else {
|
} else {
|
||||||
bp[1] = AbsPair(H);
|
bp[1] = AbsPair(HR);
|
||||||
}
|
}
|
||||||
b_ptr = b_ptr->cp_b;
|
b_ptr = b_ptr->cp_b;
|
||||||
}
|
}
|
||||||
@ -4992,7 +4992,7 @@ Yap_UpdateTimestamps(PredEntry *ap)
|
|||||||
if (bptr->cp_ap->u.OtaLl.d->ClPred == ap) {
|
if (bptr->cp_ap->u.OtaLl.d->ClPred == ap) {
|
||||||
UInt ts = IntegerOfTerm(bptr->cp_args[ar]);
|
UInt ts = IntegerOfTerm(bptr->cp_args[ar]);
|
||||||
if (ts != arp[0]) {
|
if (ts != arp[0]) {
|
||||||
if (arp-H < 1024) {
|
if (arp-HR < 1024) {
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
/* be thrifty, have this in case there is a hole */
|
/* be thrifty, have this in case there is a hole */
|
||||||
@ -5010,7 +5010,7 @@ Yap_UpdateTimestamps(PredEntry *ap)
|
|||||||
((PredEntry *)IntegerOfTerm(bptr->cp_args[0]) == ap)) {
|
((PredEntry *)IntegerOfTerm(bptr->cp_args[0]) == ap)) {
|
||||||
UInt ts = IntegerOfTerm(bptr->cp_args[5]);
|
UInt ts = IntegerOfTerm(bptr->cp_args[5]);
|
||||||
if (ts != arp[0]) {
|
if (ts != arp[0]) {
|
||||||
if (arp-H < 1024) {
|
if (arp-HR < 1024) {
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
if (ts != arp[0]-1) {
|
if (ts != arp[0]-1) {
|
||||||
@ -5562,7 +5562,7 @@ BuildActivePred(PredEntry *ap, CELL *vect)
|
|||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
CELL *pt = VarOfTerm(t);
|
CELL *pt = VarOfTerm(t);
|
||||||
/* one stack */
|
/* one stack */
|
||||||
if (pt > H) {
|
if (pt > HR) {
|
||||||
Term nt = MkVarTerm();
|
Term nt = MkVarTerm();
|
||||||
Yap_unify(t, nt);
|
Yap_unify(t, nt);
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,14 @@ mk_blob(int sz USES_REGS)
|
|||||||
{
|
{
|
||||||
MP_INT *dst;
|
MP_INT *dst;
|
||||||
|
|
||||||
H[0] = (CELL)FunctorBigInt;
|
HR[0] = (CELL)FunctorBigInt;
|
||||||
H[1] = CLAUSE_LIST;
|
HR[1] = CLAUSE_LIST;
|
||||||
dst = (MP_INT *)(H+2);
|
dst = (MP_INT *)(HR+2);
|
||||||
dst->_mp_size = 0L;
|
dst->_mp_size = 0L;
|
||||||
dst->_mp_alloc = sz;
|
dst->_mp_alloc = sz;
|
||||||
H += (1+sizeof(MP_INT)/sizeof(CELL));
|
HR += (1+sizeof(MP_INT)/sizeof(CELL));
|
||||||
H[sz] = EndSpecials;
|
HR[sz] = EndSpecials;
|
||||||
H += sz+1;
|
HR += sz+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CELL *
|
static CELL *
|
||||||
@ -29,14 +29,14 @@ extend_blob(CELL *start, int sz USES_REGS)
|
|||||||
UInt osize;
|
UInt osize;
|
||||||
MP_INT *dst;
|
MP_INT *dst;
|
||||||
|
|
||||||
if (H + sz > ASP)
|
if (HR + sz > ASP)
|
||||||
return NULL;
|
return NULL;
|
||||||
dst = (MP_INT *)(start+2);
|
dst = (MP_INT *)(start+2);
|
||||||
osize = dst->_mp_alloc;
|
osize = dst->_mp_alloc;
|
||||||
start += (1+sizeof(MP_INT)/sizeof(CELL));
|
start += (1+sizeof(MP_INT)/sizeof(CELL));
|
||||||
start[sz+osize] = EndSpecials;
|
start[sz+osize] = EndSpecials;
|
||||||
dst->_mp_alloc += sz;
|
dst->_mp_alloc += sz;
|
||||||
H += sz;
|
HR += sz;
|
||||||
return start+osize;
|
return start+osize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,9 +46,9 @@ Yap_ClauseListInit(clause_list_t in)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
in->n = 0;
|
in->n = 0;
|
||||||
in->start = H;
|
in->start = HR;
|
||||||
mk_blob(0 PASS_REGS);
|
mk_blob(0 PASS_REGS);
|
||||||
in->end = H;
|
in->end = HR;
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ Yap_ClauseListExtend(clause_list_t cl, void * clause, void *pred)
|
|||||||
PredEntry *ap = (PredEntry *)pred;
|
PredEntry *ap = (PredEntry *)pred;
|
||||||
|
|
||||||
/* fprintf(stderr,"cl=%p\n",clause); */
|
/* fprintf(stderr,"cl=%p\n",clause); */
|
||||||
if (cl->end != H)
|
if (cl->end != HR)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (cl->n == 0) {
|
if (cl->n == 0) {
|
||||||
void **ptr;
|
void **ptr;
|
||||||
@ -112,7 +112,7 @@ Yap_ClauseListExtend(clause_list_t cl, void * clause, void *pred)
|
|||||||
code_p = PREVOP(code_p,Otapl);
|
code_p = PREVOP(code_p,Otapl);
|
||||||
code_p->opc = Yap_opcode(_retry);
|
code_p->opc = Yap_opcode(_retry);
|
||||||
}
|
}
|
||||||
cl->end = H;
|
cl->end = HR;
|
||||||
cl->n++;
|
cl->n++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -129,9 +129,9 @@ X_API int
|
|||||||
Yap_ClauseListDestroy(clause_list_t cl)
|
Yap_ClauseListDestroy(clause_list_t cl)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
if (cl->end != H)
|
if (cl->end != HR)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
H = cl->start;
|
HR = cl->start;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ Yap_ClauseListToClause(clause_list_t cl)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
void **ptr;
|
void **ptr;
|
||||||
if (cl->end != H)
|
if (cl->end != HR)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (cl->n != 1)
|
if (cl->n != 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -82,7 +82,7 @@ static int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
|||||||
CELL *pt1)
|
CELL *pt1)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
register CELL **to_visit = (CELL **)H;
|
register CELL **to_visit = (CELL **)HR;
|
||||||
register int out = 0;
|
register int out = 0;
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
@ -289,7 +289,7 @@ static int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Do we still have compound terms to visit */
|
/* Do we still have compound terms to visit */
|
||||||
if (to_visit > (CELL **)H) {
|
if (to_visit > (CELL **)HR) {
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
to_visit -= 4;
|
to_visit -= 4;
|
||||||
pt0 = to_visit[0];
|
pt0 = to_visit[0];
|
||||||
@ -308,7 +308,7 @@ static int compare_complex(register CELL *pt0, register CELL *pt0_end, register
|
|||||||
done:
|
done:
|
||||||
/* failure */
|
/* failure */
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
while (to_visit > (CELL **)H) {
|
while (to_visit > (CELL **)HR) {
|
||||||
to_visit -= 4;
|
to_visit -= 4;
|
||||||
pt0 = to_visit[0];
|
pt0 = to_visit[0];
|
||||||
pt0_end = to_visit[1];
|
pt0_end = to_visit[1];
|
||||||
|
76
C/compiler.c
76
C/compiler.c
@ -510,10 +510,10 @@ optimize_ce(Term t, unsigned int arity, unsigned int level, compiler_struct *cgl
|
|||||||
if (IsApplTerm(t) && IsExtensionFunctor(FunctorOfTerm(t)))
|
if (IsApplTerm(t) && IsExtensionFunctor(FunctorOfTerm(t)))
|
||||||
return (t);
|
return (t);
|
||||||
while (p != NULL) {
|
while (p != NULL) {
|
||||||
CELL *oldH = H;
|
CELL *oldH = HR;
|
||||||
H = (CELL *)cglobs->cint.freep;
|
HR = (CELL *)cglobs->cint.freep;
|
||||||
cmp = Yap_compare_terms(t, (p->TermOfCE));
|
cmp = Yap_compare_terms(t, (p->TermOfCE));
|
||||||
H = oldH;
|
HR = oldH;
|
||||||
|
|
||||||
if (cmp) {
|
if (cmp) {
|
||||||
p = p->NextCE;
|
p = p->NextCE;
|
||||||
@ -533,7 +533,7 @@ optimize_ce(Term t, unsigned int arity, unsigned int level, compiler_struct *cgl
|
|||||||
|
|
||||||
p->TermOfCE = t;
|
p->TermOfCE = t;
|
||||||
p->VarOfCE = MkVarTerm();
|
p->VarOfCE = MkVarTerm();
|
||||||
if (H >= (CELL *)cglobs->cint.freep0) {
|
if (HR >= (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
@ -614,7 +614,7 @@ try_store_as_dbterm(Term t, Int argno, unsigned int arity, int level, compiler_s
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
DBTerm *dbt;
|
DBTerm *dbt;
|
||||||
int g;
|
int g;
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
|
|
||||||
while ((g=Yap_SizeGroundTerm(t,TRUE)) < 0) {
|
while ((g=Yap_SizeGroundTerm(t,TRUE)) < 0) {
|
||||||
/* oops, too deep a term */
|
/* oops, too deep a term */
|
||||||
@ -625,9 +625,9 @@ try_store_as_dbterm(Term t, Int argno, unsigned int arity, int level, compiler_s
|
|||||||
if (g < 16)
|
if (g < 16)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* store ground term away */
|
/* store ground term away */
|
||||||
H = CellPtr(cglobs->cint.freep);
|
HR = CellPtr(cglobs->cint.freep);
|
||||||
if ((dbt = Yap_StoreTermInDB(t, -1)) == NULL) {
|
if ((dbt = Yap_StoreTermInDB(t, -1)) == NULL) {
|
||||||
H = h0;
|
HR = h0;
|
||||||
switch(LOCAL_Error_TYPE) {
|
switch(LOCAL_Error_TYPE) {
|
||||||
case OUT_OF_STACK_ERROR:
|
case OUT_OF_STACK_ERROR:
|
||||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||||
@ -645,7 +645,7 @@ try_store_as_dbterm(Term t, Int argno, unsigned int arity, int level, compiler_s
|
|||||||
siglongjmp(cglobs->cint.CompilerBotch,COMPILER_ERR_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,COMPILER_ERR_BOTCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
H = h0;
|
HR = h0;
|
||||||
if (level == 0)
|
if (level == 0)
|
||||||
Yap_emit((cglobs->onhead ? get_dbterm_op : put_dbterm_op), dbt->Entry, argno, &cglobs->cint);
|
Yap_emit((cglobs->onhead ? get_dbterm_op : put_dbterm_op), dbt->Entry, argno, &cglobs->cint);
|
||||||
else
|
else
|
||||||
@ -1123,29 +1123,29 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
|||||||
if (i2 == 0)
|
if (i2 == 0)
|
||||||
c_eq(t1, t3, cglobs);
|
c_eq(t1, t3, cglobs);
|
||||||
else {
|
else {
|
||||||
CELL *hi = H;
|
CELL *hi = HR;
|
||||||
Int i;
|
Int i;
|
||||||
|
|
||||||
if (t1 == TermDot && i2 == 2) {
|
if (t1 == TermDot && i2 == 2) {
|
||||||
if (H+2 >= (CELL *)cglobs->cint.freep0) {
|
if (HR+2 >= (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
}
|
}
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
RESET_VARIABLE(H+1);
|
RESET_VARIABLE(HR+1);
|
||||||
H += 2;
|
HR += 2;
|
||||||
c_eq(AbsPair(H-2),t3, cglobs);
|
c_eq(AbsPair(HR-2),t3, cglobs);
|
||||||
} else if (i2 < 256 && IsAtomTerm(t1)) {
|
} else if (i2 < 256 && IsAtomTerm(t1)) {
|
||||||
*H++ = (CELL)Yap_MkFunctor(AtomOfTerm(t1),i2);
|
*HR++ = (CELL)Yap_MkFunctor(AtomOfTerm(t1),i2);
|
||||||
for (i=0; i < i2; i++) {
|
for (i=0; i < i2; i++) {
|
||||||
if (H >= (CELL *)cglobs->cint.freep0) {
|
if (HR >= (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
}
|
}
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
H++;
|
HR++;
|
||||||
}
|
}
|
||||||
c_eq(AbsAppl(hi),t3, cglobs);
|
c_eq(AbsAppl(hi),t3, cglobs);
|
||||||
} else {
|
} else {
|
||||||
@ -1267,16 +1267,16 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
|||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,1);
|
siglongjmp(cglobs->cint.CompilerBotch,1);
|
||||||
}
|
}
|
||||||
if (H+1+arity >= (CELL *)cglobs->cint.freep0) {
|
if (HR+1+arity >= (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
}
|
}
|
||||||
tnew = AbsAppl(H);
|
tnew = AbsAppl(HR);
|
||||||
*H++ = (CELL)Yap_MkFunctor(AtomOfTerm(t1),arity);
|
*HR++ = (CELL)Yap_MkFunctor(AtomOfTerm(t1),arity);
|
||||||
while (arity--) {
|
while (arity--) {
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
H++;
|
HR++;
|
||||||
}
|
}
|
||||||
c_eq(tnew, t3, cglobs);
|
c_eq(tnew, t3, cglobs);
|
||||||
} else {
|
} else {
|
||||||
@ -1316,7 +1316,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
|
|||||||
if (!IsVarTerm(t3)) {
|
if (!IsVarTerm(t3)) {
|
||||||
if (Op == _arg) {
|
if (Op == _arg) {
|
||||||
Term tmpvar = MkVarTerm();
|
Term tmpvar = MkVarTerm();
|
||||||
if (H == (CELL *)cglobs->cint.freep0) {
|
if (HR == (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
@ -1716,7 +1716,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
cglobs->goalno = savegoalno;
|
cglobs->goalno = savegoalno;
|
||||||
commitflag = cglobs->labelno;
|
commitflag = cglobs->labelno;
|
||||||
commitvar = MkVarTerm();
|
commitvar = MkVarTerm();
|
||||||
if (H == (CELL *)cglobs->cint.freep0) {
|
if (HR == (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
@ -1800,7 +1800,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
/* for now */
|
/* for now */
|
||||||
cglobs->needs_env = TRUE;
|
cglobs->needs_env = TRUE;
|
||||||
commitvar = MkVarTerm();
|
commitvar = MkVarTerm();
|
||||||
if (H == (CELL *)cglobs->cint.freep0) {
|
if (HR == (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
@ -1836,7 +1836,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
int save = cglobs->onlast;
|
int save = cglobs->onlast;
|
||||||
|
|
||||||
commitvar = MkVarTerm();
|
commitvar = MkVarTerm();
|
||||||
if (H == (CELL *)cglobs->cint.freep0) {
|
if (HR == (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
@ -1963,7 +1963,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Term t2 = MkVarTerm();
|
Term t2 = MkVarTerm();
|
||||||
if (H == (CELL *)cglobs->cint.freep0) {
|
if (HR == (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
@ -1976,7 +1976,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
} else {
|
} else {
|
||||||
Term a2 = ArgOfTerm(2,Goal);
|
Term a2 = ArgOfTerm(2,Goal);
|
||||||
Term t1 = MkVarTerm();
|
Term t1 = MkVarTerm();
|
||||||
if (H == (CELL *)cglobs->cint.freep0) {
|
if (HR == (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
@ -1990,7 +1990,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Term t2 = MkVarTerm();
|
Term t2 = MkVarTerm();
|
||||||
if (H == (CELL *)cglobs->cint.freep0) {
|
if (HR == (CELL *)cglobs->cint.freep0) {
|
||||||
/* oops, too many new variables */
|
/* oops, too many new variables */
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH);
|
||||||
@ -3416,7 +3416,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
|||||||
case OUT_OF_STACK_BOTCH:
|
case OUT_OF_STACK_BOTCH:
|
||||||
/* out of local stack, just duplicate the stack */
|
/* out of local stack, just duplicate the stack */
|
||||||
{
|
{
|
||||||
Int osize = 2*sizeof(CELL)*(ASP-H);
|
Int osize = 2*sizeof(CELL)*(ASP-HR);
|
||||||
ARG1 = inp_clause;
|
ARG1 = inp_clause;
|
||||||
ARG3 = src;
|
ARG3 = src;
|
||||||
|
|
||||||
@ -3425,8 +3425,8 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
|||||||
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
|
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
|
||||||
LOCAL_Error_Term = inp_clause;
|
LOCAL_Error_Term = inp_clause;
|
||||||
}
|
}
|
||||||
if (osize > ASP-H) {
|
if (osize > ASP-HR) {
|
||||||
if (!Yap_growstack(2*sizeof(CELL)*(ASP-H))) {
|
if (!Yap_growstack(2*sizeof(CELL)*(ASP-HR))) {
|
||||||
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
|
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
|
||||||
LOCAL_Error_Term = inp_clause;
|
LOCAL_Error_Term = inp_clause;
|
||||||
}
|
}
|
||||||
@ -3490,7 +3490,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
my_clause = inp_clause;
|
my_clause = inp_clause;
|
||||||
HB = H;
|
HB = HR;
|
||||||
LOCAL_ErrorMessage = NULL;
|
LOCAL_ErrorMessage = NULL;
|
||||||
LOCAL_Error_Size = 0;
|
LOCAL_Error_Size = 0;
|
||||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||||
@ -3503,7 +3503,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
|||||||
cglobs.cint.label_offset = NULL;
|
cglobs.cint.label_offset = NULL;
|
||||||
cglobs.cint.freep =
|
cglobs.cint.freep =
|
||||||
cglobs.cint.freep0 =
|
cglobs.cint.freep0 =
|
||||||
(char *) (H + maxvnum+(sizeof(Int)/sizeof(CELL))*MaxTemps+MaxTemps);
|
(char *) (HR + maxvnum+(sizeof(Int)/sizeof(CELL))*MaxTemps+MaxTemps);
|
||||||
cglobs.cint.success_handler = 0L;
|
cglobs.cint.success_handler = 0L;
|
||||||
if (ASP <= CellPtr (cglobs.cint.freep) + 256) {
|
if (ASP <= CellPtr (cglobs.cint.freep) + 256) {
|
||||||
cglobs.vtable = NULL;
|
cglobs.vtable = NULL;
|
||||||
@ -3511,8 +3511,8 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
|||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(cglobs.cint.CompilerBotch,3);
|
siglongjmp(cglobs.cint.CompilerBotch,3);
|
||||||
}
|
}
|
||||||
cglobs.Uses = (Int *)(H+maxvnum);
|
cglobs.Uses = (Int *)(HR+maxvnum);
|
||||||
cglobs.Contents = (Term *)(H+maxvnum+(sizeof(Int)/sizeof(CELL))*MaxTemps);
|
cglobs.Contents = (Term *)(HR+maxvnum+(sizeof(Int)/sizeof(CELL))*MaxTemps);
|
||||||
cglobs.curbranch = cglobs.onbranch = 0;
|
cglobs.curbranch = cglobs.onbranch = 0;
|
||||||
cglobs.branch_pointer = cglobs.parent_branches;
|
cglobs.branch_pointer = cglobs.parent_branches;
|
||||||
cglobs.or_found = FALSE;
|
cglobs.or_found = FALSE;
|
||||||
@ -3627,7 +3627,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset_vars(cglobs.vtable);
|
reset_vars(cglobs.vtable);
|
||||||
H = HB;
|
HR = HB;
|
||||||
if (B != NULL) {
|
if (B != NULL) {
|
||||||
HB = B->cp_h;
|
HB = B->cp_h;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ static int can_unify_complex(register CELL *pt0,
|
|||||||
saved_TR = TR;
|
saved_TR = TR;
|
||||||
saved_B = B;
|
saved_B = B;
|
||||||
saved_HB = HB;
|
saved_HB = HB;
|
||||||
HB = H;
|
HB = HR;
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
while (pt0 < pt0_end) {
|
while (pt0 < pt0_end) {
|
||||||
|
52
C/dbase.c
52
C/dbase.c
@ -584,14 +584,14 @@ copy_double(CELL *st, CELL *pt)
|
|||||||
/* first thing, store a link to the list before we move on */
|
/* first thing, store a link to the list before we move on */
|
||||||
st[0] = (CELL)FunctorDouble;
|
st[0] = (CELL)FunctorDouble;
|
||||||
st[1] = pt[1];
|
st[1] = pt[1];
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
st[2] = pt[2];
|
st[2] = pt[2];
|
||||||
st[3] = EndSpecials;
|
st[3] = EndSpecials;
|
||||||
#else
|
#else
|
||||||
st[2] = EndSpecials;
|
st[2] = EndSpecials;
|
||||||
#endif
|
#endif
|
||||||
/* now reserve space */
|
/* now reserve space */
|
||||||
return st+(2+SIZEOF_DOUBLE/SIZEOF_LONG_INT);
|
return st+(2+SIZEOF_DOUBLE/SIZEOF_INT_P);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CELL *
|
static CELL *
|
||||||
@ -645,13 +645,13 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
#endif
|
#endif
|
||||||
register visitel *visited = (visitel *)AuxSp;
|
register visitel *visited = (visitel *)AuxSp;
|
||||||
/* store this in H */
|
/* store this in H */
|
||||||
register CELL **to_visit = (CELL **)H;
|
register CELL **to_visit = (CELL **)HR;
|
||||||
CELL **to_visit_base = to_visit;
|
CELL **to_visit_base = to_visit;
|
||||||
/* where we are going to add a new pair */
|
/* where we are going to add a new pair */
|
||||||
int vars_found = 0;
|
int vars_found = 0;
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
Term ConstraintsTerm = TermNil;
|
Term ConstraintsTerm = TermNil;
|
||||||
CELL *origH = H;
|
CELL *origH = HR;
|
||||||
#endif
|
#endif
|
||||||
CELL *CodeMaxBase = CodeMax;
|
CELL *CodeMaxBase = CodeMax;
|
||||||
|
|
||||||
@ -919,7 +919,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
Term t[4];
|
Term t[4];
|
||||||
int sz = to_visit-to_visit_base;
|
int sz = to_visit-to_visit_base;
|
||||||
|
|
||||||
H = (CELL *)to_visit;
|
HR = (CELL *)to_visit;
|
||||||
/* store the constraint away for: we need a back pointer to
|
/* store the constraint away for: we need a back pointer to
|
||||||
the variable, the constraint in some cannonical form, what type
|
the variable, the constraint in some cannonical form, what type
|
||||||
of constraint, and a list pointer */
|
of constraint, and a list pointer */
|
||||||
@ -928,11 +928,11 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
t[2] = MkIntegerTerm(ExtFromCell(ptd0));
|
t[2] = MkIntegerTerm(ExtFromCell(ptd0));
|
||||||
t[3] = ConstraintsTerm;
|
t[3] = ConstraintsTerm;
|
||||||
ConstraintsTerm = Yap_MkApplTerm(FunctorClist, 4, t);
|
ConstraintsTerm = Yap_MkApplTerm(FunctorClist, 4, t);
|
||||||
if (H+sz >= ASP) {
|
if (HR+sz >= ASP) {
|
||||||
goto error2;
|
goto error2;
|
||||||
}
|
}
|
||||||
memcpy((void *)H, (void *)(to_visit_base), sz*sizeof(CELL *));
|
memcpy((void *)HR, (void *)(to_visit_base), sz*sizeof(CELL *));
|
||||||
to_visit_base = (CELL **)H;
|
to_visit_base = (CELL **)HR;
|
||||||
to_visit = to_visit_base+sz;
|
to_visit = to_visit_base+sz;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -988,7 +988,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
*vars_foundp = vars_found;
|
*vars_foundp = vars_found;
|
||||||
DB_UNWIND_CUNIF();
|
DB_UNWIND_CUNIF();
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
H = origH;
|
HR = origH;
|
||||||
#endif
|
#endif
|
||||||
return CodeMax;
|
return CodeMax;
|
||||||
|
|
||||||
@ -1007,7 +1007,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
#endif
|
#endif
|
||||||
DB_UNWIND_CUNIF();
|
DB_UNWIND_CUNIF();
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
H = origH;
|
HR = origH;
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -1025,7 +1025,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
#endif
|
#endif
|
||||||
DB_UNWIND_CUNIF();
|
DB_UNWIND_CUNIF();
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
H = origH;
|
HR = origH;
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -1043,7 +1043,7 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end,
|
|||||||
#endif
|
#endif
|
||||||
DB_UNWIND_CUNIF();
|
DB_UNWIND_CUNIF();
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
H = origH;
|
HR = origH;
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
#if THREADS
|
#if THREADS
|
||||||
@ -2502,7 +2502,7 @@ GetDBTerm(DBTerm *DBSP, int src USES_REGS)
|
|||||||
} else if (IsAtomOrIntTerm(t)) {
|
} else if (IsAtomOrIntTerm(t)) {
|
||||||
return t;
|
return t;
|
||||||
} else {
|
} else {
|
||||||
CELL *HOld = H;
|
CELL *HOld = HR;
|
||||||
CELL *HeapPtr;
|
CELL *HeapPtr;
|
||||||
CELL *pt;
|
CELL *pt;
|
||||||
CELL NOf;
|
CELL NOf;
|
||||||
@ -2512,9 +2512,9 @@ GetDBTerm(DBTerm *DBSP, int src USES_REGS)
|
|||||||
}
|
}
|
||||||
pt = CellPtr(DBSP->Contents);
|
pt = CellPtr(DBSP->Contents);
|
||||||
CalculateStackGap( PASS_REGS1 );
|
CalculateStackGap( PASS_REGS1 );
|
||||||
if (H+NOf > ASP-EventFlag/sizeof(CELL)) {
|
if (HR+NOf > ASP-EventFlag/sizeof(CELL)) {
|
||||||
if (LOCAL_PrologMode & InErrorMode) {
|
if (LOCAL_PrologMode & InErrorMode) {
|
||||||
if (H+NOf > ASP)
|
if (HR+NOf > ASP)
|
||||||
fprintf(GLOBAL_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n");
|
fprintf(GLOBAL_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n");
|
||||||
Yap_exit( 1);
|
Yap_exit( 1);
|
||||||
} else {
|
} else {
|
||||||
@ -2525,7 +2525,7 @@ GetDBTerm(DBTerm *DBSP, int src USES_REGS)
|
|||||||
}
|
}
|
||||||
HeapPtr = cpcells(HOld, pt, NOf);
|
HeapPtr = cpcells(HOld, pt, NOf);
|
||||||
pt += HeapPtr - HOld;
|
pt += HeapPtr - HOld;
|
||||||
H = HeapPtr;
|
HR = HeapPtr;
|
||||||
{
|
{
|
||||||
link_entry *lp = (link_entry *)pt;
|
link_entry *lp = (link_entry *)pt;
|
||||||
linkblk(lp, HOld-1, (CELL)HOld-(CELL)(DBSP->Contents));
|
linkblk(lp, HOld-1, (CELL)HOld-(CELL)(DBSP->Contents));
|
||||||
@ -2533,7 +2533,7 @@ GetDBTerm(DBTerm *DBSP, int src USES_REGS)
|
|||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
if (DBSP->ag.attachments != 0L && !src) {
|
if (DBSP->ag.attachments != 0L && !src) {
|
||||||
if (!copy_attachments((CELL *)AdjustIDBPtr(DBSP->ag.attachments,(CELL)HOld-(CELL)(DBSP->Contents)) PASS_REGS)) {
|
if (!copy_attachments((CELL *)AdjustIDBPtr(DBSP->ag.attachments,(CELL)HOld-(CELL)(DBSP->Contents)) PASS_REGS)) {
|
||||||
H = HOld;
|
HR = HOld;
|
||||||
LOCAL_Error_TYPE = OUT_OF_ATTVARS_ERROR;
|
LOCAL_Error_TYPE = OUT_OF_ATTVARS_ERROR;
|
||||||
LOCAL_Error_Size = 0;
|
LOCAL_Error_Size = 0;
|
||||||
return (Term)0;
|
return (Term)0;
|
||||||
@ -3069,7 +3069,7 @@ i_recorded(DBProp AtProp, Term t3 USES_REGS)
|
|||||||
if (IsVarTerm(twork)) {
|
if (IsVarTerm(twork)) {
|
||||||
EXTRA_CBACK_ARG(3,2) = MkIntegerTerm(0);
|
EXTRA_CBACK_ARG(3,2) = MkIntegerTerm(0);
|
||||||
EXTRA_CBACK_ARG(3,3) = MkIntegerTerm(0);
|
EXTRA_CBACK_ARG(3,3) = MkIntegerTerm(0);
|
||||||
B->cp_h = H;
|
B->cp_h = HR;
|
||||||
while ((TermDB = GetDBTermFromDBEntry(ref PASS_REGS)) == (CELL)0) {
|
while ((TermDB = GetDBTermFromDBEntry(ref PASS_REGS)) == (CELL)0) {
|
||||||
/* 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;
|
||||||
@ -3097,7 +3097,7 @@ i_recorded(DBProp AtProp, Term t3 USES_REGS)
|
|||||||
} else if (IsAtomOrIntTerm(twork)) {
|
} else if (IsAtomOrIntTerm(twork)) {
|
||||||
EXTRA_CBACK_ARG(3,2) = MkIntegerTerm(0);
|
EXTRA_CBACK_ARG(3,2) = MkIntegerTerm(0);
|
||||||
EXTRA_CBACK_ARG(3,3) = MkIntegerTerm((Int)twork);
|
EXTRA_CBACK_ARG(3,3) = MkIntegerTerm((Int)twork);
|
||||||
B->cp_h = H;
|
B->cp_h = HR;
|
||||||
READ_LOCK(AtProp->DBRWLock);
|
READ_LOCK(AtProp->DBRWLock);
|
||||||
do {
|
do {
|
||||||
if (((twork == ref->DBT.Entry) || IsVarTerm(ref->DBT.Entry)) &&
|
if (((twork == ref->DBT.Entry) || IsVarTerm(ref->DBT.Entry)) &&
|
||||||
@ -3114,7 +3114,7 @@ i_recorded(DBProp AtProp, Term t3 USES_REGS)
|
|||||||
CELL key;
|
CELL key;
|
||||||
CELL mask = EvalMasks(twork, &key);
|
CELL mask = EvalMasks(twork, &key);
|
||||||
|
|
||||||
B->cp_h = H;
|
B->cp_h = HR;
|
||||||
READ_LOCK(AtProp->DBRWLock);
|
READ_LOCK(AtProp->DBRWLock);
|
||||||
do {
|
do {
|
||||||
while ((mask & ref->Key) != (key & ref->Mask) && !DEAD_REF(ref)) {
|
while ((mask & ref->Key) != (key & ref->Mask) && !DEAD_REF(ref)) {
|
||||||
@ -3129,7 +3129,7 @@ i_recorded(DBProp AtProp, Term t3 USES_REGS)
|
|||||||
/* success */
|
/* success */
|
||||||
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));
|
||||||
B->cp_h = H;
|
B->cp_h = HR;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
while ((ref = NextDBRef(ref)) != NULL
|
while ((ref = NextDBRef(ref)) != NULL
|
||||||
@ -3187,7 +3187,7 @@ c_recorded(int flags USES_REGS)
|
|||||||
{
|
{
|
||||||
Term TermDB, TRef;
|
Term TermDB, TRef;
|
||||||
Register DBRef ref, ref0;
|
Register DBRef ref, ref0;
|
||||||
CELL *PreviousHeap = H;
|
CELL *PreviousHeap = HR;
|
||||||
CELL mask, key;
|
CELL mask, key;
|
||||||
Term t1;
|
Term t1;
|
||||||
|
|
||||||
@ -3256,7 +3256,7 @@ c_recorded(int flags USES_REGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOCAL_Error_Size = 0;
|
LOCAL_Error_Size = 0;
|
||||||
PreviousHeap = H;
|
PreviousHeap = HR;
|
||||||
}
|
}
|
||||||
Yap_unify(ARG2, TermDB);
|
Yap_unify(ARG2, TermDB);
|
||||||
} else if (mask == 0) { /* ARG2 is a constant */
|
} else if (mask == 0) { /* ARG2 is a constant */
|
||||||
@ -3272,7 +3272,7 @@ c_recorded(int flags USES_REGS)
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
do { /* ARG2 is a structure */
|
do { /* ARG2 is a structure */
|
||||||
H = PreviousHeap;
|
HR = PreviousHeap;
|
||||||
while ((mask & ref->Key) != (key & ref->Mask)) {
|
while ((mask & ref->Key) != (key & ref->Mask)) {
|
||||||
while ((ref = NextDBRef(ref)) != NIL
|
while ((ref = NextDBRef(ref)) != NIL
|
||||||
&& DEAD_REF(ref));
|
&& DEAD_REF(ref));
|
||||||
@ -3299,7 +3299,7 @@ c_recorded(int flags USES_REGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOCAL_Error_Size = 0;
|
LOCAL_Error_Size = 0;
|
||||||
PreviousHeap = H;
|
PreviousHeap = HR;
|
||||||
}
|
}
|
||||||
if (Yap_unify(ARG2, TermDB))
|
if (Yap_unify(ARG2, TermDB))
|
||||||
break;
|
break;
|
||||||
@ -4927,7 +4927,7 @@ cont_current_key( USES_REGS1 )
|
|||||||
term = AtT = MkAtomTerm(a);
|
term = AtT = MkAtomTerm(a);
|
||||||
} else {
|
} else {
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
CELL *p = H;
|
CELL *p = HR;
|
||||||
|
|
||||||
for (j = 0; j < arity; j++) {
|
for (j = 0; j < arity; j++) {
|
||||||
p[j] = MkVarTerm();
|
p[j] = MkVarTerm();
|
||||||
|
49
C/errors.c
49
C/errors.c
@ -29,22 +29,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "Foreign.h"
|
#include "Foreign.h"
|
||||||
|
|
||||||
static Term
|
|
||||||
gen_syntax_error(Atom InpAtom, char *s)
|
|
||||||
{
|
|
||||||
CACHE_REGS
|
|
||||||
Term ts[7], ti[2];
|
|
||||||
ti[0] = ARG1;
|
|
||||||
ti[1] = ARG2;
|
|
||||||
ts[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom(s),2),2,ti);
|
|
||||||
ts[1] = ts[4] = ts[5] = MkIntTerm(0);
|
|
||||||
ts[2] = MkAtomTerm(AtomExpectedNumber);
|
|
||||||
ts[3] = TermNil;
|
|
||||||
ts[6] = MkAtomTerm(InpAtom);
|
|
||||||
return(Yap_MkApplTerm(FunctorSyntaxError,7,ts));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Yap_HandleError( const char *s, ... ) {
|
int Yap_HandleError( const char *s, ... ) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
yap_error_number err = LOCAL_Error_TYPE;
|
yap_error_number err = LOCAL_Error_TYPE;
|
||||||
@ -141,7 +125,7 @@ static void detect_bug_location(yamop *,find_pred_type,char *, int);
|
|||||||
|
|
||||||
#define ONHEAP(ptr) (CellPtr(ptr) >= CellPtr(Yap_HeapBase) && CellPtr(ptr) < CellPtr(HeapTop))
|
#define ONHEAP(ptr) (CellPtr(ptr) >= CellPtr(Yap_HeapBase) && CellPtr(ptr) < CellPtr(HeapTop))
|
||||||
|
|
||||||
#define ONLOCAL(ptr) (CellPtr(ptr) > CellPtr(H) && CellPtr(ptr) < CellPtr(LOCAL_LocalBase))
|
#define ONLOCAL(ptr) (CellPtr(ptr) > CellPtr(HR) && CellPtr(ptr) < CellPtr(LOCAL_LocalBase))
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hidden (Atom at)
|
hidden (Atom at)
|
||||||
@ -379,13 +363,13 @@ dump_stack( USES_REGS1 )
|
|||||||
if (handled_exception( PASS_REGS1 ))
|
if (handled_exception( PASS_REGS1 ))
|
||||||
return;
|
return;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
fprintf(stderr,"%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",P,CP,ASP,H,TR,HeapTop);
|
fprintf(stderr,"%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",P,CP,ASP,HR,TR,HeapTop);
|
||||||
fprintf(stderr,"%% YAP mode: %ux\n",(unsigned int)LOCAL_PrologMode);
|
fprintf(stderr,"%% YAP mode: %ux\n",(unsigned int)LOCAL_PrologMode);
|
||||||
if (LOCAL_ErrorMessage)
|
if (LOCAL_ErrorMessage)
|
||||||
fprintf(stderr,"%% LOCAL_ErrorMessage: %s\n",LOCAL_ErrorMessage);
|
fprintf(stderr,"%% LOCAL_ErrorMessage: %s\n",LOCAL_ErrorMessage);
|
||||||
#endif
|
#endif
|
||||||
if (H > ASP || H > LCL0) {
|
if (HR > ASP || HR > LCL0) {
|
||||||
fprintf(stderr,"%% YAP ERROR: Global Collided against Local (%p--%p)\n",H,ASP);
|
fprintf(stderr,"%% YAP ERROR: Global Collided against Local (%p--%p)\n",HR,ASP);
|
||||||
} else if (HeapTop > (ADDR)LOCAL_GlobalBase) {
|
} else if (HeapTop > (ADDR)LOCAL_GlobalBase) {
|
||||||
fprintf(stderr,"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n", HeapTop, LOCAL_GlobalBase);
|
fprintf(stderr,"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n", HeapTop, LOCAL_GlobalBase);
|
||||||
} else {
|
} else {
|
||||||
@ -402,11 +386,11 @@ dump_stack( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, (char *)H, 256);
|
detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
||||||
fprintf (stderr,"%%\n%% PC: %s\n",(char *)H);
|
fprintf (stderr,"%%\n%% PC: %s\n",(char *)HR);
|
||||||
detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, (char *)H, 256);
|
detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
||||||
fprintf (stderr,"%% Continuation: %s\n",(char *)H);
|
fprintf (stderr,"%% Continuation: %s\n",(char *)HR);
|
||||||
fprintf (stderr,"%% %luKB of Global Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(H-H0))/1024,H0,H);
|
fprintf (stderr,"%% %luKB of Global Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(HR-H0))/1024,H0,HR);
|
||||||
fprintf (stderr,"%% %luKB of Local Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(LCL0-ASP))/1024,ASP,LCL0);
|
fprintf (stderr,"%% %luKB of Local Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(LCL0-ASP))/1024,ASP,LCL0);
|
||||||
fprintf (stderr,"%% %luKB of Trail (%p--%p)\n",(unsigned long int)((ADDR)TR-LOCAL_TrailBase)/1024,LOCAL_TrailBase,TR);
|
fprintf (stderr,"%% %luKB of Trail (%p--%p)\n",(unsigned long int)((ADDR)TR-LOCAL_TrailBase)/1024,LOCAL_TrailBase,TR);
|
||||||
fprintf (stderr,"%% Performed %ld garbage collections\n", (unsigned long int)LOCAL_GcCalls);
|
fprintf (stderr,"%% Performed %ld garbage collections\n", (unsigned long int)LOCAL_GcCalls);
|
||||||
@ -484,8 +468,8 @@ void
|
|||||||
Yap_bug_location(yamop *pc)
|
Yap_bug_location(yamop *pc)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
detect_bug_location(pc, FIND_PRED_FROM_ANYWHERE, (char *)H, 256);
|
detect_bug_location(pc, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
||||||
fprintf(stderr,"%s\n",(char *)H);
|
fprintf(stderr,"%s\n",(char *)HR);
|
||||||
dump_stack( PASS_REGS1 );
|
dump_stack( PASS_REGS1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,10 +567,10 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
|
|||||||
fprintf(stderr,"%% YAP OOOPS: %s.\n",tmpbuf);
|
fprintf(stderr,"%% YAP OOOPS: %s.\n",tmpbuf);
|
||||||
fprintf(stderr,"%%\n%%\n");
|
fprintf(stderr,"%%\n%%\n");
|
||||||
}
|
}
|
||||||
detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, (char *)H, 256);
|
detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
||||||
fprintf (stderr,"%%\n%% PC: %s\n",(char *)H);
|
fprintf (stderr,"%%\n%% PC: %s\n",(char *)HR);
|
||||||
detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, (char *)H, 256);
|
detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
||||||
fprintf (stderr,"%% Continuation: %s\n",(char *)H);
|
fprintf (stderr,"%% Continuation: %s\n",(char *)HR);
|
||||||
DumpActiveGoals( PASS_REGS1 );
|
DumpActiveGoals( PASS_REGS1 );
|
||||||
error_exit_yap (1);
|
error_exit_yap (1);
|
||||||
}
|
}
|
||||||
@ -1557,11 +1541,8 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
|
|||||||
case SYNTAX_ERROR:
|
case SYNTAX_ERROR:
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Term ti[1];
|
|
||||||
|
|
||||||
i = strlen(tmpbuf);
|
i = strlen(tmpbuf);
|
||||||
ti[0] = MkAtomTerm(AtomSyntaxError);
|
|
||||||
nt[0] = gen_syntax_error(AtomNil, tmpbuf);
|
|
||||||
psize -= i;
|
psize -= i;
|
||||||
fun = FunctorError;
|
fun = FunctorError;
|
||||||
serious = TRUE;
|
serious = TRUE;
|
||||||
|
4
C/eval.c
4
C/eval.c
@ -366,7 +366,7 @@ static Int cont_between( USES_REGS1 )
|
|||||||
i1 = IntegerOfTerm(t1);
|
i1 = IntegerOfTerm(t1);
|
||||||
tn = add_int(i1, 1 PASS_REGS);
|
tn = add_int(i1, 1 PASS_REGS);
|
||||||
EXTRA_CBACK_ARG(3,1) = tn;
|
EXTRA_CBACK_ARG(3,1) = tn;
|
||||||
HB = B->cp_h = H;
|
HB = B->cp_h = HR;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
Term t[2];
|
Term t[2];
|
||||||
@ -380,7 +380,7 @@ static Int cont_between( USES_REGS1 )
|
|||||||
t[1] = MkIntTerm(1);
|
t[1] = MkIntTerm(1);
|
||||||
tn = Eval(Yap_MkApplTerm(FunctorPlus, 2, t) PASS_REGS);
|
tn = Eval(Yap_MkApplTerm(FunctorPlus, 2, t) PASS_REGS);
|
||||||
EXTRA_CBACK_ARG(3,1) = tn;
|
EXTRA_CBACK_ARG(3,1) = tn;
|
||||||
HB = B->cp_h = H;
|
HB = B->cp_h = HR;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
46
C/exec.c
46
C/exec.c
@ -255,34 +255,34 @@ do_execute(Term t, Term mod USES_REGS)
|
|||||||
static Term
|
static Term
|
||||||
copy_execn_to_heap(Functor f, CELL *pt, unsigned int n, unsigned int arity, Term mod USES_REGS)
|
copy_execn_to_heap(Functor f, CELL *pt, unsigned int n, unsigned int arity, Term mod USES_REGS)
|
||||||
{
|
{
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
Term tf;
|
Term tf;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (arity == 2 &&
|
if (arity == 2 &&
|
||||||
NameOfFunctor(f) == AtomDot) {
|
NameOfFunctor(f) == AtomDot) {
|
||||||
for (i = 0; i<arity-n;i++) {
|
for (i = 0; i<arity-n;i++) {
|
||||||
*H++ = pt[i];
|
*HR++ = pt[i];
|
||||||
}
|
}
|
||||||
for (i=0; i< n; i++) {
|
for (i=0; i< n; i++) {
|
||||||
*H++ = h0[(int)(i-n)];
|
*HR++ = h0[(int)(i-n)];
|
||||||
}
|
}
|
||||||
tf = AbsPair(h0);
|
tf = AbsPair(h0);
|
||||||
} else {
|
} else {
|
||||||
*H++ = (CELL)f;
|
*HR++ = (CELL)f;
|
||||||
for (i = 0; i<arity-n;i++) {
|
for (i = 0; i<arity-n;i++) {
|
||||||
*H++ = pt[i];
|
*HR++ = pt[i];
|
||||||
}
|
}
|
||||||
for (i=0; i< n; i++) {
|
for (i=0; i< n; i++) {
|
||||||
*H++ = h0[(int)(i-n)];
|
*HR++ = h0[(int)(i-n)];
|
||||||
}
|
}
|
||||||
tf = AbsAppl(h0);
|
tf = AbsAppl(h0);
|
||||||
}
|
}
|
||||||
if (mod != CurrentModule) {
|
if (mod != CurrentModule) {
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
*H++ = (CELL)FunctorModule;
|
*HR++ = (CELL)FunctorModule;
|
||||||
*H++ = mod;
|
*HR++ = mod;
|
||||||
*H++ = tf;
|
*HR++ = tf;
|
||||||
tf = AbsAppl(h0);
|
tf = AbsAppl(h0);
|
||||||
}
|
}
|
||||||
return tf;
|
return tf;
|
||||||
@ -375,7 +375,7 @@ do_execute_n(Term t, Term mod, unsigned int n USES_REGS)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
for (i = arity-n+1; i <= arity; i++,j++) {
|
for (i = arity-n+1; i <= arity; i++,j++) {
|
||||||
XREGS[i] = H[j];
|
XREGS[i] = HR[j];
|
||||||
}
|
}
|
||||||
return CallPredicate(pen, B, pen->CodeOfPred PASS_REGS);
|
return CallPredicate(pen, B, pen->CodeOfPred PASS_REGS);
|
||||||
}
|
}
|
||||||
@ -422,15 +422,15 @@ static void
|
|||||||
heap_store(Term t USES_REGS)
|
heap_store(Term t USES_REGS)
|
||||||
{
|
{
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
if (VarOfTerm(t) < H) {
|
if (VarOfTerm(t) < HR) {
|
||||||
*H++ = t;
|
*HR++ = t;
|
||||||
} else {
|
} else {
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
Bind_Local(VarOfTerm(t), (CELL)H);
|
Bind_Local(VarOfTerm(t), (CELL)HR);
|
||||||
H++;
|
HR++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*H++ = t;
|
*HR++ = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,7 +1163,7 @@ Yap_PrepGoal(UInt arity, CELL *pt, choiceptr saved_b USES_REGS)
|
|||||||
}
|
}
|
||||||
B = (choiceptr)ASP;
|
B = (choiceptr)ASP;
|
||||||
B--;
|
B--;
|
||||||
B->cp_h = H;
|
B->cp_h = HR;
|
||||||
B->cp_tr = TR;
|
B->cp_tr = TR;
|
||||||
B->cp_cp = CP;
|
B->cp_cp = CP;
|
||||||
B->cp_ap = NOCODE;
|
B->cp_ap = NOCODE;
|
||||||
@ -1174,7 +1174,7 @@ Yap_PrepGoal(UInt arity, CELL *pt, choiceptr saved_b USES_REGS)
|
|||||||
#endif /* DEPTH_LIMIT */
|
#endif /* DEPTH_LIMIT */
|
||||||
YENV = ASP = (CELL *)B;
|
YENV = ASP = (CELL *)B;
|
||||||
YENV[E_CB] = (CELL)B;
|
YENV[E_CB] = (CELL)B;
|
||||||
HB = H;
|
HB = HR;
|
||||||
CP = YESCODE;
|
CP = YESCODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1272,7 +1272,7 @@ execute_pred(PredEntry *ppe, CELL *pt USES_REGS)
|
|||||||
} else if (out == 0) {
|
} else if (out == 0) {
|
||||||
P = saved_p;
|
P = saved_p;
|
||||||
CP = saved_cp;
|
CP = saved_cp;
|
||||||
H = B->cp_h;
|
HR = B->cp_h;
|
||||||
#ifdef DEPTH_LIMIT
|
#ifdef DEPTH_LIMIT
|
||||||
DEPTH= B->cp_depth;
|
DEPTH= B->cp_depth;
|
||||||
#endif
|
#endif
|
||||||
@ -1338,7 +1338,7 @@ Yap_trust_last(void)
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
ASP = B->cp_env;
|
ASP = B->cp_env;
|
||||||
CP = B->cp_cp;
|
CP = B->cp_cp;
|
||||||
H = B->cp_h;
|
HR = B->cp_h;
|
||||||
#ifdef DEPTH_LIMIT
|
#ifdef DEPTH_LIMIT
|
||||||
DEPTH= B->cp_depth;
|
DEPTH= B->cp_depth;
|
||||||
#endif
|
#endif
|
||||||
@ -1757,7 +1757,7 @@ Yap_InitYaamRegs( int myworker_id )
|
|||||||
Yap_ResetExceptionTerm ( myworker_id );
|
Yap_ResetExceptionTerm ( myworker_id );
|
||||||
Yap_PutValue (AtomBreak, MkIntTerm (0));
|
Yap_PutValue (AtomBreak, MkIntTerm (0));
|
||||||
TR = (tr_fr_ptr)REMOTE_TrailBase(myworker_id);
|
TR = (tr_fr_ptr)REMOTE_TrailBase(myworker_id);
|
||||||
H = H0 = ((CELL *) REMOTE_GlobalBase(myworker_id))+1; // +1: hack to ensure the gc does not try to mark mistakenly
|
HR = H0 = ((CELL *) REMOTE_GlobalBase(myworker_id))+1; // +1: hack to ensure the gc does not try to mark mistakenly
|
||||||
LCL0 = ASP = (CELL *) REMOTE_LocalBase(myworker_id);
|
LCL0 = ASP = (CELL *) REMOTE_LocalBase(myworker_id);
|
||||||
CurrentTrailTop = (tr_fr_ptr)(REMOTE_TrailTop(myworker_id)-MinTrailGap);
|
CurrentTrailTop = (tr_fr_ptr)(REMOTE_TrailTop(myworker_id)-MinTrailGap);
|
||||||
/* notice that an initial choice-point and environment
|
/* notice that an initial choice-point and environment
|
||||||
@ -1770,7 +1770,7 @@ Yap_InitYaamRegs( int myworker_id )
|
|||||||
#endif
|
#endif
|
||||||
STATIC_PREDICATES_MARKED = FALSE;
|
STATIC_PREDICATES_MARKED = FALSE;
|
||||||
#ifdef FROZEN_STACKS
|
#ifdef FROZEN_STACKS
|
||||||
H_FZ = H;
|
H_FZ = HR;
|
||||||
#ifdef YAPOR_SBA
|
#ifdef YAPOR_SBA
|
||||||
BSEG =
|
BSEG =
|
||||||
#endif /* YAPOR_SBA */
|
#endif /* YAPOR_SBA */
|
||||||
|
10
C/exo.c
10
C/exo.c
@ -407,7 +407,7 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
|
|||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
bzero(base, dsz);
|
memset(base, 0, dsz);
|
||||||
}
|
}
|
||||||
i->size = sz+dsz+sizeof(struct index_t);
|
i->size = sz+dsz+sizeof(struct index_t);
|
||||||
i->key = (BITS32 *)base;
|
i->key = (BITS32 *)base;
|
||||||
@ -430,7 +430,7 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
|
|||||||
}
|
}
|
||||||
if (base != (CELL *)Yap_ReallocCodeSpace((char *)base, sz))
|
if (base != (CELL *)Yap_ReallocCodeSpace((char *)base, sz))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
bzero(base, sz);
|
memset(base, 0, sz);
|
||||||
i->key = (BITS32 *)base;
|
i->key = (BITS32 *)base;
|
||||||
i->links = (BITS32 *)(base+i->hsize);
|
i->links = (BITS32 *)(base+i->hsize);
|
||||||
i->ncollisions = i->nentries = i->ntrys = 0;
|
i->ncollisions = i->nentries = i->ntrys = 0;
|
||||||
@ -455,7 +455,7 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
|
|||||||
}
|
}
|
||||||
if (base != (CELL *)Yap_ReallocCodeSpace((char *)base, sz))
|
if (base != (CELL *)Yap_ReallocCodeSpace((char *)base, sz))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
bzero(base, sz);
|
memset(base, 0, sz);
|
||||||
i->key = (BITS32 *)base;
|
i->key = (BITS32 *)base;
|
||||||
i->links = (BITS32 *)base+i->hsize;
|
i->links = (BITS32 *)base+i->hsize;
|
||||||
i->ncollisions = i->nentries = i->ntrys = 0;
|
i->ncollisions = i->nentries = i->ntrys = 0;
|
||||||
@ -562,7 +562,7 @@ Yap_NextExo(choiceptr cptr, struct index_t *it)
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
MegaClause *
|
static MegaClause *
|
||||||
exodb_get_space( Term t, Term mod, Term tn )
|
exodb_get_space( Term t, Term mod, Term tn )
|
||||||
{
|
{
|
||||||
UInt arity;
|
UInt arity;
|
||||||
@ -668,7 +668,7 @@ store_exo(yamop *pc, UInt arity, Term t0)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
exoassert( void *handle, Int n, Term term )
|
exoassert( void *handle, Int n, Term term )
|
||||||
{ /* '$number_of_clauses'(Predicate,M,N) */
|
{ /* '$number_of_clauses'(Predicate,M,N) */
|
||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
|
306
C/globals.c
306
C/globals.c
@ -108,15 +108,15 @@ NewArena(UInt size, UInt arity, CELL *where USES_REGS)
|
|||||||
Term t;
|
Term t;
|
||||||
UInt new_size;
|
UInt new_size;
|
||||||
|
|
||||||
if (where == NULL || where == H) {
|
if (where == NULL || where == HR) {
|
||||||
while (H+size > ASP-1024) {
|
while (HR+size > ASP-1024) {
|
||||||
if (!Yap_gcl(size*sizeof(CELL), arity, ENV, P)) {
|
if (!Yap_gcl(size*sizeof(CELL), arity, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t = CreateNewArena(H, size);
|
t = CreateNewArena(HR, size);
|
||||||
H += size;
|
HR += size;
|
||||||
} else {
|
} else {
|
||||||
if ((new_size=Yap_InsertInGlobal(where, size*sizeof(CELL)))==0) {
|
if ((new_size=Yap_InsertInGlobal(where, size*sizeof(CELL)))==0) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"No Stack Space for Non-Backtrackable terms");
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"No Stack Space for Non-Backtrackable terms");
|
||||||
@ -162,7 +162,7 @@ adjust_cps(UInt size USES_REGS)
|
|||||||
{
|
{
|
||||||
/* adjust possible back pointers in choice-point stack */
|
/* adjust possible back pointers in choice-point stack */
|
||||||
choiceptr b_ptr = B;
|
choiceptr b_ptr = B;
|
||||||
while (b_ptr->cp_h == H) {
|
while (b_ptr->cp_h == HR) {
|
||||||
b_ptr->cp_h += size;
|
b_ptr->cp_h += size;
|
||||||
b_ptr = b_ptr->cp_b;
|
b_ptr = b_ptr->cp_b;
|
||||||
}
|
}
|
||||||
@ -183,8 +183,8 @@ GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity USES_REGS)
|
|||||||
if (size < 4096) {
|
if (size < 4096) {
|
||||||
size = 4096;
|
size = 4096;
|
||||||
}
|
}
|
||||||
if (pt == H) {
|
if (pt == HR) {
|
||||||
if (H+size > ASP-1024) {
|
if (HR+size > ASP-1024) {
|
||||||
|
|
||||||
XREGS[arity+1] = arena;
|
XREGS[arity+1] = arena;
|
||||||
if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, gc_P(P,CP))) {
|
||||||
@ -197,11 +197,11 @@ GrowArena(Term arena, CELL *pt, UInt old_size, UInt size, UInt arity USES_REGS)
|
|||||||
return GrowArena(arena, pt, old_size, size, arity PASS_REGS);
|
return GrowArena(arena, pt, old_size, size, arity PASS_REGS);
|
||||||
}
|
}
|
||||||
adjust_cps(size PASS_REGS);
|
adjust_cps(size PASS_REGS);
|
||||||
H += size;
|
HR += size;
|
||||||
} else {
|
} else {
|
||||||
XREGS[arity+1] = arena;
|
XREGS[arity+1] = arena;
|
||||||
/* try to recover some room */
|
/* try to recover some room */
|
||||||
if (arena == LOCAL_GlobalArena && 10*(pt-H0) > 8*(H-H0)) {
|
if (arena == LOCAL_GlobalArena && 10*(pt-H0) > 8*(HR-H0)) {
|
||||||
if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -231,9 +231,9 @@ Yap_GetFromArena(Term *arenap, UInt cells, UInt arity)
|
|||||||
CELL *newH;
|
CELL *newH;
|
||||||
UInt old_sz = ArenaSz(arena), new_size;
|
UInt old_sz = ArenaSz(arena), new_size;
|
||||||
|
|
||||||
if (IN_BETWEEN(base, H, max)) {
|
if (IN_BETWEEN(base, HR, max)) {
|
||||||
base = H;
|
base = HR;
|
||||||
H += cells;
|
HR += cells;
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
if (base+cells > max-1024) {
|
if (base+cells > max-1024) {
|
||||||
@ -254,11 +254,11 @@ CloseArena(CELL *oldH, CELL *oldHB, CELL *oldASP, Term *oldArenaP, UInt old_size
|
|||||||
{
|
{
|
||||||
UInt new_size;
|
UInt new_size;
|
||||||
|
|
||||||
if (H == oldH)
|
if (HR == oldH)
|
||||||
return;
|
return;
|
||||||
new_size = old_size - (H-RepAppl(*oldArenaP));
|
new_size = old_size - (HR-RepAppl(*oldArenaP));
|
||||||
*oldArenaP = CreateNewArena(H, new_size);
|
*oldArenaP = CreateNewArena(HR, new_size);
|
||||||
H = oldH;
|
HR = oldH;
|
||||||
HB = oldHB;
|
HB = oldHB;
|
||||||
ASP = oldASP;
|
ASP = oldASP;
|
||||||
}
|
}
|
||||||
@ -308,12 +308,12 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
if (IsPairTerm(d0)) {
|
if (IsPairTerm(d0)) {
|
||||||
CELL *ap2 = RepPair(d0);
|
CELL *ap2 = RepPair(d0);
|
||||||
if ((share && ap2 < HB) ||
|
if ((share && ap2 < HB) ||
|
||||||
(ap2 >= HB && ap2 < H)) {
|
(ap2 >= HB && ap2 < HR)) {
|
||||||
/* If this is newer than the current term, just reuse */
|
/* If this is newer than the current term, just reuse */
|
||||||
*ptf++ = d0;
|
*ptf++ = d0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*ptf = AbsPair(H);
|
*ptf = AbsPair(HR);
|
||||||
ptf++;
|
ptf++;
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
if (to_visit+1 >= (struct cp_frame *)AuxSp) {
|
if (to_visit+1 >= (struct cp_frame *)AuxSp) {
|
||||||
@ -325,7 +325,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
to_visit->oldv = *pt0;
|
to_visit->oldv = *pt0;
|
||||||
to_visit->ground = ground;
|
to_visit->ground = ground;
|
||||||
/* fool the system into thinking we had a variable there */
|
/* fool the system into thinking we had a variable there */
|
||||||
*pt0 = AbsPair(H);
|
*pt0 = AbsPair(HR);
|
||||||
to_visit ++;
|
to_visit ++;
|
||||||
#else
|
#else
|
||||||
if (pt0 < pt0_end) {
|
if (pt0 < pt0_end) {
|
||||||
@ -342,9 +342,9 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
ground = TRUE;
|
ground = TRUE;
|
||||||
pt0 = ap2 - 1;
|
pt0 = ap2 - 1;
|
||||||
pt0_end = ap2 + 1;
|
pt0_end = ap2 + 1;
|
||||||
ptf = H;
|
ptf = HR;
|
||||||
H += 2;
|
HR += 2;
|
||||||
if (H > ASP - MIN_ARENA_SIZE) {
|
if (HR > ASP - MIN_ARENA_SIZE) {
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
} else if (IsApplTerm(d0)) {
|
} else if (IsApplTerm(d0)) {
|
||||||
@ -353,7 +353,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
/* store the terms to visit */
|
/* store the terms to visit */
|
||||||
ap2 = RepAppl(d0);
|
ap2 = RepAppl(d0);
|
||||||
if ((share && ap2 < HB) ||
|
if ((share && ap2 < HB) ||
|
||||||
(ap2 >= HB && ap2 < H)) {
|
(ap2 >= HB && ap2 < HR)) {
|
||||||
/* If this is newer than the current term, just reuse */
|
/* If this is newer than the current term, just reuse */
|
||||||
*ptf++ = d0;
|
*ptf++ = d0;
|
||||||
continue;
|
continue;
|
||||||
@ -367,41 +367,41 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
*ptf++ = d0;
|
*ptf++ = d0;
|
||||||
break;
|
break;
|
||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
if (H > ASP - (MIN_ARENA_SIZE+3)) {
|
if (HR > ASP - (MIN_ARENA_SIZE+3)) {
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
*ptf++ = AbsAppl(H);
|
*ptf++ = AbsAppl(HR);
|
||||||
H[0] = (CELL)f;
|
HR[0] = (CELL)f;
|
||||||
H[1] = ap2[1];
|
HR[1] = ap2[1];
|
||||||
H[2] = EndSpecials;
|
HR[2] = EndSpecials;
|
||||||
H += 3;
|
HR += 3;
|
||||||
if (H > ASP - MIN_ARENA_SIZE) {
|
if (HR > ASP - MIN_ARENA_SIZE) {
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (CELL)FunctorDouble:
|
case (CELL)FunctorDouble:
|
||||||
if (H > ASP - (MIN_ARENA_SIZE+(2+SIZEOF_DOUBLE/sizeof(CELL)))) {
|
if (HR > ASP - (MIN_ARENA_SIZE+(2+SIZEOF_DOUBLE/sizeof(CELL)))) {
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
*ptf++ = AbsAppl(H);
|
*ptf++ = AbsAppl(HR);
|
||||||
H[0] = (CELL)f;
|
HR[0] = (CELL)f;
|
||||||
H[1] = ap2[1];
|
HR[1] = ap2[1];
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
H[2] = ap2[2];
|
HR[2] = ap2[2];
|
||||||
H[3] = EndSpecials;
|
HR[3] = EndSpecials;
|
||||||
H += 4;
|
HR += 4;
|
||||||
#else
|
#else
|
||||||
H[2] = EndSpecials;
|
HR[2] = EndSpecials;
|
||||||
H += 3;
|
HR += 3;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case (CELL)FunctorString:
|
case (CELL)FunctorString:
|
||||||
if (ASP - H > MIN_ARENA_SIZE+3+ap2[1]) {
|
if (ASP - HR > MIN_ARENA_SIZE+3+ap2[1]) {
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
*ptf++ = AbsAppl(H);
|
*ptf++ = AbsAppl(HR);
|
||||||
memcpy(H, ap2, sizeof(CELL)*(3+ap2[1]));
|
memcpy(HR, ap2, sizeof(CELL)*(3+ap2[1]));
|
||||||
H+=ap2[1]+3;
|
HR+=ap2[1]+3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -409,20 +409,20 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
UInt sz = (sizeof(MP_INT)+3*CellSize+
|
UInt sz = (sizeof(MP_INT)+3*CellSize+
|
||||||
((MP_INT *)(ap2+2))->_mp_alloc*sizeof(mp_limb_t))/CellSize, i;
|
((MP_INT *)(ap2+2))->_mp_alloc*sizeof(mp_limb_t))/CellSize, i;
|
||||||
|
|
||||||
if (H > ASP - (MIN_ARENA_SIZE+sz)) {
|
if (HR > ASP - (MIN_ARENA_SIZE+sz)) {
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
*ptf++ = AbsAppl(H);
|
*ptf++ = AbsAppl(HR);
|
||||||
H[0] = (CELL)f;
|
HR[0] = (CELL)f;
|
||||||
for (i = 1; i < sz; i++) {
|
for (i = 1; i < sz; i++) {
|
||||||
H[i] = ap2[i];
|
HR[i] = ap2[i];
|
||||||
}
|
}
|
||||||
H += sz;
|
HR += sz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*ptf = AbsAppl(H);
|
*ptf = AbsAppl(HR);
|
||||||
ptf++;
|
ptf++;
|
||||||
/* store the terms to visit */
|
/* store the terms to visit */
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
@ -435,7 +435,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
to_visit->oldv = *pt0;
|
to_visit->oldv = *pt0;
|
||||||
to_visit->ground = ground;
|
to_visit->ground = ground;
|
||||||
/* fool the system into thinking we had a variable there */
|
/* fool the system into thinking we had a variable there */
|
||||||
*pt0 = AbsAppl(H);
|
*pt0 = AbsAppl(HR);
|
||||||
to_visit ++;
|
to_visit ++;
|
||||||
#else
|
#else
|
||||||
if (pt0 < pt0_end) {
|
if (pt0 < pt0_end) {
|
||||||
@ -454,10 +454,10 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
pt0 = ap2;
|
pt0 = ap2;
|
||||||
pt0_end = ap2 + d0;
|
pt0_end = ap2 + d0;
|
||||||
/* store the functor for the new term */
|
/* store the functor for the new term */
|
||||||
H[0] = (CELL)f;
|
HR[0] = (CELL)f;
|
||||||
ptf = H+1;
|
ptf = HR+1;
|
||||||
H += 1+d0;
|
HR += 1+d0;
|
||||||
if (H > ASP - MIN_ARENA_SIZE) {
|
if (HR > ASP - MIN_ARENA_SIZE) {
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -471,7 +471,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
ground = FALSE;
|
ground = FALSE;
|
||||||
/* don't need to copy variables if we want to share the global term */
|
/* don't need to copy variables if we want to share the global term */
|
||||||
if ((share && ptd0 < HB && ptd0 > H0) ||
|
if ((share && ptd0 < HB && ptd0 > H0) ||
|
||||||
(ptd0 >= HLow && ptd0 < H)) {
|
(ptd0 >= HLow && ptd0 < HR)) {
|
||||||
/* we have already found this cell */
|
/* we have already found this cell */
|
||||||
*ptf++ = (CELL) ptd0;
|
*ptf++ = (CELL) ptd0;
|
||||||
} else {
|
} else {
|
||||||
@ -530,7 +530,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
|
|
||||||
overflow:
|
overflow:
|
||||||
/* oops, we're in trouble */
|
/* oops, we're in trouble */
|
||||||
H = HLow;
|
HR = HLow;
|
||||||
/* we've done it */
|
/* we've done it */
|
||||||
/* restore our nice, friendly, term to its original state */
|
/* restore our nice, friendly, term to its original state */
|
||||||
HB = HB0;
|
HB = HB0;
|
||||||
@ -548,7 +548,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
|
|
||||||
heap_overflow:
|
heap_overflow:
|
||||||
/* oops, we're in trouble */
|
/* oops, we're in trouble */
|
||||||
H = HLow;
|
HR = HLow;
|
||||||
/* we've done it */
|
/* we've done it */
|
||||||
/* restore our nice, friendly, term to its original state */
|
/* restore our nice, friendly, term to its original state */
|
||||||
HB = HB0;
|
HB = HB0;
|
||||||
@ -566,7 +566,7 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop
|
|||||||
|
|
||||||
trail_overflow:
|
trail_overflow:
|
||||||
/* oops, we're in trouble */
|
/* oops, we're in trouble */
|
||||||
H = HLow;
|
HR = HLow;
|
||||||
/* we've done it */
|
/* we've done it */
|
||||||
/* restore our nice, friendly, term to its original state */
|
/* restore our nice, friendly, term to its original state */
|
||||||
HB = HB0;
|
HB = HB0;
|
||||||
@ -587,7 +587,7 @@ static Term
|
|||||||
CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Term *newarena, UInt min_grow USES_REGS)
|
CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Term *newarena, UInt min_grow USES_REGS)
|
||||||
{
|
{
|
||||||
UInt old_size = ArenaSz(arena);
|
UInt old_size = ArenaSz(arena);
|
||||||
CELL *oldH = H;
|
CELL *oldH = HR;
|
||||||
CELL *oldHB = HB;
|
CELL *oldHB = HB;
|
||||||
CELL *oldASP = ASP;
|
CELL *oldASP = ASP;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
@ -597,14 +597,14 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
|||||||
t = Deref(t);
|
t = Deref(t);
|
||||||
if (IsVarTerm(t)) {
|
if (IsVarTerm(t)) {
|
||||||
ASP = ArenaLimit(arena);
|
ASP = ArenaLimit(arena);
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
#if COROUTINING
|
#if COROUTINING
|
||||||
if (GlobalIsAttachedTerm(t)) {
|
if (GlobalIsAttachedTerm(t)) {
|
||||||
CELL *Hi;
|
CELL *Hi;
|
||||||
|
|
||||||
*H = t;
|
*HR = t;
|
||||||
Hi = H+1;
|
Hi = HR+1;
|
||||||
H += 2;
|
HR += 2;
|
||||||
if ((res = copy_complex_term(Hi-2, Hi-1, share, copy_att_vars, Hi, Hi PASS_REGS)) < 0)
|
if ((res = copy_complex_term(Hi-2, Hi-1, share, copy_att_vars, Hi, Hi PASS_REGS)) < 0)
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS);
|
CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS);
|
||||||
@ -616,7 +616,7 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
tn = MkVarTerm();
|
tn = MkVarTerm();
|
||||||
if (H > ASP - MIN_ARENA_SIZE) {
|
if (HR > ASP - MIN_ARENA_SIZE) {
|
||||||
res = -1;
|
res = -1;
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
@ -632,12 +632,12 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
|||||||
if (share && ArenaPt(arena) > RepPair(t)) {
|
if (share && ArenaPt(arena) > RepPair(t)) {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
ASP = ArenaLimit(arena);
|
ASP = ArenaLimit(arena);
|
||||||
ap = RepPair(t);
|
ap = RepPair(t);
|
||||||
Hi = H;
|
Hi = HR;
|
||||||
tf = AbsPair(H);
|
tf = AbsPair(HR);
|
||||||
H += 2;
|
HR += 2;
|
||||||
if ((res = copy_complex_term(ap-1, ap+1, share, copy_att_vars, Hi, Hi PASS_REGS)) < 0) {
|
if ((res = copy_complex_term(ap-1, ap+1, share, copy_att_vars, Hi, Hi PASS_REGS)) < 0) {
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
@ -652,67 +652,67 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
|||||||
if (share && ArenaPt(arena) > RepAppl(t)) {
|
if (share && ArenaPt(arena) > RepAppl(t)) {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
ASP = ArenaLimit(arena);
|
ASP = ArenaLimit(arena);
|
||||||
f = FunctorOfTerm(t);
|
f = FunctorOfTerm(t);
|
||||||
HB0 = H;
|
HB0 = HR;
|
||||||
ap = RepAppl(t);
|
ap = RepAppl(t);
|
||||||
tf = AbsAppl(H);
|
tf = AbsAppl(HR);
|
||||||
H[0] = (CELL)f;
|
HR[0] = (CELL)f;
|
||||||
if (IsExtensionFunctor(f)) {
|
if (IsExtensionFunctor(f)) {
|
||||||
switch((CELL)f) {
|
switch((CELL)f) {
|
||||||
case (CELL)FunctorDBRef:
|
case (CELL)FunctorDBRef:
|
||||||
CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS);
|
CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS);
|
||||||
return t;
|
return t;
|
||||||
case (CELL)FunctorLongInt:
|
case (CELL)FunctorLongInt:
|
||||||
if (H > ASP - (MIN_ARENA_SIZE+3)) {
|
if (HR > ASP - (MIN_ARENA_SIZE+3)) {
|
||||||
res = -1;
|
res = -1;
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
H[1] = ap[1];
|
HR[1] = ap[1];
|
||||||
H[2] = EndSpecials;
|
HR[2] = EndSpecials;
|
||||||
H += 3;
|
HR += 3;
|
||||||
break;
|
break;
|
||||||
case (CELL)FunctorDouble:
|
case (CELL)FunctorDouble:
|
||||||
if (H > ASP - (MIN_ARENA_SIZE+(2+SIZEOF_DOUBLE/sizeof(CELL)))) {
|
if (HR > ASP - (MIN_ARENA_SIZE+(2+SIZEOF_DOUBLE/sizeof(CELL)))) {
|
||||||
res = -1;
|
res = -1;
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
H[1] = ap[1];
|
HR[1] = ap[1];
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
H[2] = ap[2];
|
HR[2] = ap[2];
|
||||||
H[3] = EndSpecials;
|
HR[3] = EndSpecials;
|
||||||
H += 4;
|
HR += 4;
|
||||||
#else
|
#else
|
||||||
H[2] = EndSpecials;
|
HR[2] = EndSpecials;
|
||||||
H += 3;
|
HR += 3;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case (CELL)FunctorString:
|
case (CELL)FunctorString:
|
||||||
if (H > ASP - MIN_ARENA_SIZE+3+ap[1]) {
|
if (HR > ASP - MIN_ARENA_SIZE+3+ap[1]) {
|
||||||
res = -1;
|
res = -1;
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
memcpy(H, ap, sizeof(CELL)*(3+ap[1]));
|
memcpy(HR, ap, sizeof(CELL)*(3+ap[1]));
|
||||||
H += ap[1]+3;
|
HR += ap[1]+3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
UInt sz = ArenaSz(t), i;
|
UInt sz = ArenaSz(t), i;
|
||||||
|
|
||||||
if (H > ASP - (MIN_ARENA_SIZE+sz)) {
|
if (HR > ASP - (MIN_ARENA_SIZE+sz)) {
|
||||||
res = -1;
|
res = -1;
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
for (i = 1; i < sz; i++) {
|
for (i = 1; i < sz; i++) {
|
||||||
H[i] = ap[i];
|
HR[i] = ap[i];
|
||||||
}
|
}
|
||||||
H += sz;
|
HR += sz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
H += 1+ArityOfFunctor(f);
|
HR += 1+ArityOfFunctor(f);
|
||||||
if (H > ASP-MIN_ARENA_SIZE) {
|
if (HR > ASP-MIN_ARENA_SIZE) {
|
||||||
res = -1;
|
res = -1;
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
@ -724,7 +724,7 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
|||||||
return tf;
|
return tf;
|
||||||
}
|
}
|
||||||
error_handler:
|
error_handler:
|
||||||
H = HB;
|
HR = HB;
|
||||||
CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS);
|
CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS);
|
||||||
XREGS[arity+1] = t;
|
XREGS[arity+1] = t;
|
||||||
XREGS[arity+2] = arena;
|
XREGS[arity+2] = arena;
|
||||||
@ -732,7 +732,7 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
|||||||
{
|
{
|
||||||
CELL *old_top = ArenaLimit(*newarena);
|
CELL *old_top = ArenaLimit(*newarena);
|
||||||
ASP = oldASP;
|
ASP = oldASP;
|
||||||
H = oldH;
|
HR = oldH;
|
||||||
HB = oldHB;
|
HB = oldHB;
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case -1:
|
case -1:
|
||||||
@ -750,7 +750,7 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
oldASP = ASP;
|
oldASP = ASP;
|
||||||
newarena = (CELL *)XREGS[arity+3];
|
newarena = (CELL *)XREGS[arity+3];
|
||||||
@ -764,7 +764,7 @@ static Term
|
|||||||
CreateTermInArena(Term arena, Atom Na, UInt Nar, UInt arity, Term *newarena, Term init USES_REGS)
|
CreateTermInArena(Term arena, Atom Na, UInt Nar, UInt arity, Term *newarena, Term init USES_REGS)
|
||||||
{
|
{
|
||||||
UInt old_size = ArenaSz(arena);
|
UInt old_size = ArenaSz(arena);
|
||||||
CELL *oldH = H;
|
CELL *oldH = HR;
|
||||||
CELL *oldHB = HB;
|
CELL *oldHB = HB;
|
||||||
CELL *oldASP = ASP;
|
CELL *oldASP = ASP;
|
||||||
Term tf;
|
Term tf;
|
||||||
@ -773,22 +773,22 @@ CreateTermInArena(Term arena, Atom Na, UInt Nar, UInt arity, Term *newarena, Ter
|
|||||||
UInt i;
|
UInt i;
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
ASP = ArenaLimit(arena);
|
ASP = ArenaLimit(arena);
|
||||||
HB0 = H;
|
HB0 = HR;
|
||||||
tf = AbsAppl(H);
|
tf = AbsAppl(HR);
|
||||||
H[0] = (CELL)f;
|
HR[0] = (CELL)f;
|
||||||
H += 1+ArityOfFunctor(f);
|
HR += 1+ArityOfFunctor(f);
|
||||||
if (H > ASP-MIN_ARENA_SIZE) {
|
if (HR > ASP-MIN_ARENA_SIZE) {
|
||||||
/* overflow */
|
/* overflow */
|
||||||
H = HB;
|
HR = HB;
|
||||||
CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS);
|
CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS);
|
||||||
XREGS[arity+1] = arena;
|
XREGS[arity+1] = arena;
|
||||||
XREGS[arity+2] = (CELL)newarena;
|
XREGS[arity+2] = (CELL)newarena;
|
||||||
{
|
{
|
||||||
CELL *old_top = ArenaLimit(*newarena);
|
CELL *old_top = ArenaLimit(*newarena);
|
||||||
ASP = oldASP;
|
ASP = oldASP;
|
||||||
H = oldH;
|
HR = oldH;
|
||||||
HB = oldHB;
|
HB = oldHB;
|
||||||
if (arena == LOCAL_GlobalArena)
|
if (arena == LOCAL_GlobalArena)
|
||||||
LOCAL_GlobalArenaOverflows++;
|
LOCAL_GlobalArenaOverflows++;
|
||||||
@ -797,7 +797,7 @@ CreateTermInArena(Term arena, Atom Na, UInt Nar, UInt arity, Term *newarena, Ter
|
|||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
oldASP = ASP;
|
oldASP = ASP;
|
||||||
newarena = (CELL *)XREGS[arity+2];
|
newarena = (CELL *)XREGS[arity+2];
|
||||||
@ -1124,7 +1124,7 @@ p_nb_add_to_accumulator( USES_REGS1 )
|
|||||||
CELL *target = RepAppl(t0);
|
CELL *target = RepAppl(t0);
|
||||||
CELL *source = RepAppl(new);
|
CELL *source = RepAppl(new);
|
||||||
|
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
target[2] = source[2];
|
target[2] = source[2];
|
||||||
#endif
|
#endif
|
||||||
target[1] = source[1];
|
target[1] = source[1];
|
||||||
@ -1252,7 +1252,7 @@ p_b_setval( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
/* but first make sure we are doing on a global object, or a constant! */
|
/* but first make sure we are doing on a global object, or a constant! */
|
||||||
Term t = Deref(ARG2);
|
Term t = Deref(ARG2);
|
||||||
if (IsVarTerm(t) && VarOfTerm(t) > H && VarOfTerm(t) < LCL0) {
|
if (IsVarTerm(t) && VarOfTerm(t) > HR && VarOfTerm(t) < LCL0) {
|
||||||
Term tn = MkVarTerm();
|
Term tn = MkVarTerm();
|
||||||
Bind_Local(VarOfTerm(t), tn);
|
Bind_Local(VarOfTerm(t), tn);
|
||||||
t = tn;
|
t = tn;
|
||||||
@ -1492,7 +1492,7 @@ nb_queue(UInt arena_sz USES_REGS)
|
|||||||
static Int
|
static Int
|
||||||
p_nb_queue( USES_REGS1 )
|
p_nb_queue( USES_REGS1 )
|
||||||
{
|
{
|
||||||
UInt arena_sz = (ASP-H)/16;
|
UInt arena_sz = (ASP-HR)/16;
|
||||||
if (LOCAL_DepthArenas > 1)
|
if (LOCAL_DepthArenas > 1)
|
||||||
arena_sz /= LOCAL_DepthArenas;
|
arena_sz /= LOCAL_DepthArenas;
|
||||||
if (arena_sz < MIN_ARENA_SIZE)
|
if (arena_sz < MIN_ARENA_SIZE)
|
||||||
@ -1563,8 +1563,8 @@ RecoverArena(Term arena USES_REGS)
|
|||||||
CELL *pt = ArenaPt(arena),
|
CELL *pt = ArenaPt(arena),
|
||||||
*max = ArenaLimit(arena);
|
*max = ArenaLimit(arena);
|
||||||
|
|
||||||
if (max == H) {
|
if (max == HR) {
|
||||||
H = pt;
|
HR = pt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1626,14 +1626,14 @@ p_nb_queue_enqueue( USES_REGS1 )
|
|||||||
qd = GetQueue(ARG1,"enqueue");
|
qd = GetQueue(ARG1,"enqueue");
|
||||||
arena = GetQueueArena(qd,"enqueue");
|
arena = GetQueueArena(qd,"enqueue");
|
||||||
/* garbage collection ? */
|
/* garbage collection ? */
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
old_sz = ArenaSz(arena);
|
old_sz = ArenaSz(arena);
|
||||||
qsize = IntegerOfTerm(qd[QUEUE_SIZE]);
|
qsize = IntegerOfTerm(qd[QUEUE_SIZE]);
|
||||||
while (old_sz < MIN_ARENA_SIZE) {
|
while (old_sz < MIN_ARENA_SIZE) {
|
||||||
UInt gsiz = H-RepPair(qd[QUEUE_HEAD]);
|
UInt gsiz = HR-RepPair(qd[QUEUE_HEAD]);
|
||||||
H = oldH;
|
HR = oldH;
|
||||||
HB = oldHB;
|
HB = oldHB;
|
||||||
if (gsiz > 1024*1024) {
|
if (gsiz > 1024*1024) {
|
||||||
gsiz = 1024*1024;
|
gsiz = 1024*1024;
|
||||||
@ -1649,21 +1649,21 @@ p_nb_queue_enqueue( USES_REGS1 )
|
|||||||
to = ARG3;
|
to = ARG3;
|
||||||
qd = RepAppl(Deref(ARG1))+1;
|
qd = RepAppl(Deref(ARG1))+1;
|
||||||
arena = GetQueueArena(qd,"enqueue");
|
arena = GetQueueArena(qd,"enqueue");
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
old_sz = ArenaSz(arena);
|
old_sz = ArenaSz(arena);
|
||||||
}
|
}
|
||||||
qd[QUEUE_SIZE] = Global_MkIntegerTerm(qsize+1);
|
qd[QUEUE_SIZE] = Global_MkIntegerTerm(qsize+1);
|
||||||
if (qsize == 0) {
|
if (qsize == 0) {
|
||||||
qd[QUEUE_HEAD] = AbsPair(H);
|
qd[QUEUE_HEAD] = AbsPair(HR);
|
||||||
} else {
|
} else {
|
||||||
*VarOfTerm(qd[QUEUE_TAIL]) = AbsPair(H);
|
*VarOfTerm(qd[QUEUE_TAIL]) = AbsPair(HR);
|
||||||
}
|
}
|
||||||
*H++ = to;
|
*HR++ = to;
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
qd[QUEUE_TAIL] = (CELL)H;
|
qd[QUEUE_TAIL] = (CELL)HR;
|
||||||
H++;
|
HR++;
|
||||||
CloseArena(oldH, oldHB, ASP, qd+QUEUE_ARENA, old_sz PASS_REGS);
|
CloseArena(oldH, oldHB, ASP, qd+QUEUE_ARENA, old_sz PASS_REGS);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1688,7 +1688,7 @@ p_nb_queue_dequeue( USES_REGS1 )
|
|||||||
out = HeadOfTerm(qd[QUEUE_HEAD]);
|
out = HeadOfTerm(qd[QUEUE_HEAD]);
|
||||||
qd[QUEUE_HEAD] = TailOfTerm(qd[QUEUE_HEAD]);
|
qd[QUEUE_HEAD] = TailOfTerm(qd[QUEUE_HEAD]);
|
||||||
/* garbage collection ? */
|
/* garbage collection ? */
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
qd[QUEUE_SIZE] = Global_MkIntegerTerm(qsz-1);
|
qd[QUEUE_SIZE] = Global_MkIntegerTerm(qsz-1);
|
||||||
CloseArena(oldH, oldHB, ASP, &arena, old_sz PASS_REGS);
|
CloseArena(oldH, oldHB, ASP, &arena, old_sz PASS_REGS);
|
||||||
@ -1787,16 +1787,16 @@ MkZeroApplTerm(Functor f, UInt sz USES_REGS)
|
|||||||
Term t0, tf;
|
Term t0, tf;
|
||||||
CELL *pt;
|
CELL *pt;
|
||||||
|
|
||||||
if (H+(sz+1) > ASP-1024)
|
if (HR+(sz+1) > ASP-1024)
|
||||||
return TermNil;
|
return TermNil;
|
||||||
tf = AbsAppl(H);
|
tf = AbsAppl(HR);
|
||||||
*H = (CELL)f;
|
*HR = (CELL)f;
|
||||||
t0 = MkIntTerm(0);
|
t0 = MkIntTerm(0);
|
||||||
pt = H+1;
|
pt = HR+1;
|
||||||
while (sz--) {
|
while (sz--) {
|
||||||
*pt++ = t0;
|
*pt++ = t0;
|
||||||
}
|
}
|
||||||
H = pt;
|
HR = pt;
|
||||||
return tf;
|
return tf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1806,7 +1806,7 @@ p_nb_heap( USES_REGS1 )
|
|||||||
Term heap_arena, heap, *ar, *nar;
|
Term heap_arena, heap, *ar, *nar;
|
||||||
UInt hsize;
|
UInt hsize;
|
||||||
Term tsize = Deref(ARG1);
|
Term tsize = Deref(ARG1);
|
||||||
UInt arena_sz = (H-H0)/16;
|
UInt arena_sz = (HR-H0)/16;
|
||||||
|
|
||||||
if (IsVarTerm(tsize)) {
|
if (IsVarTerm(tsize)) {
|
||||||
Yap_Error(INSTANTIATION_ERROR,tsize,"nb_heap");
|
Yap_Error(INSTANTIATION_ERROR,tsize,"nb_heap");
|
||||||
@ -1957,9 +1957,9 @@ p_nb_heap_add_to_heap( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
arena = qd[HEAP_ARENA];
|
arena = qd[HEAP_ARENA];
|
||||||
old_sz = ArenaSz(arena);
|
old_sz = ArenaSz(arena);
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
qd[HEAP_MAX] = Global_MkIntegerTerm(hmsize);
|
qd[HEAP_MAX] = Global_MkIntegerTerm(hmsize);
|
||||||
CloseArena(oldH, oldHB, ASP, qd+HEAP_ARENA, old_sz PASS_REGS);
|
CloseArena(oldH, oldHB, ASP, qd+HEAP_ARENA, old_sz PASS_REGS);
|
||||||
goto restart;
|
goto restart;
|
||||||
@ -1979,14 +1979,14 @@ p_nb_heap_add_to_heap( USES_REGS1 )
|
|||||||
qd = GetHeap(ARG1,"add_to_heap");
|
qd = GetHeap(ARG1,"add_to_heap");
|
||||||
arena = qd[HEAP_ARENA];
|
arena = qd[HEAP_ARENA];
|
||||||
/* garbage collection ? */
|
/* garbage collection ? */
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
old_sz = ArenaSz(arena);
|
old_sz = ArenaSz(arena);
|
||||||
while (old_sz < MIN_ARENA_SIZE) {
|
while (old_sz < MIN_ARENA_SIZE) {
|
||||||
UInt gsiz = hsize*2;
|
UInt gsiz = hsize*2;
|
||||||
|
|
||||||
H = oldH;
|
HR = oldH;
|
||||||
HB = oldHB;
|
HB = oldHB;
|
||||||
if (gsiz > 1024*1024) {
|
if (gsiz > 1024*1024) {
|
||||||
gsiz = 1024*1024;
|
gsiz = 1024*1024;
|
||||||
@ -2001,9 +2001,9 @@ p_nb_heap_add_to_heap( USES_REGS1 )
|
|||||||
to = ARG3;
|
to = ARG3;
|
||||||
qd = RepAppl(Deref(ARG1))+1;
|
qd = RepAppl(Deref(ARG1))+1;
|
||||||
arena = qd[HEAP_ARENA];
|
arena = qd[HEAP_ARENA];
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
old_sz = ArenaSz(arena);
|
old_sz = ArenaSz(arena);
|
||||||
}
|
}
|
||||||
pt = qd+HEAP_START;
|
pt = qd+HEAP_START;
|
||||||
@ -2034,7 +2034,7 @@ p_nb_heap_del( USES_REGS1 )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
old_sz = ArenaSz(arena);
|
old_sz = ArenaSz(arena);
|
||||||
/* garbage collection ? */
|
/* garbage collection ? */
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
qd[HEAP_SIZE] = Global_MkIntegerTerm(qsz-1);
|
qd[HEAP_SIZE] = Global_MkIntegerTerm(qsz-1);
|
||||||
CloseArena(oldH, oldHB, ASP, &arena, old_sz PASS_REGS);
|
CloseArena(oldH, oldHB, ASP, &arena, old_sz PASS_REGS);
|
||||||
@ -2089,7 +2089,7 @@ p_nb_beam( USES_REGS1 )
|
|||||||
Term beam_arena, beam, *ar, *nar;
|
Term beam_arena, beam, *ar, *nar;
|
||||||
UInt hsize;
|
UInt hsize;
|
||||||
Term tsize = Deref(ARG1);
|
Term tsize = Deref(ARG1);
|
||||||
UInt arena_sz = (H-H0)/16;
|
UInt arena_sz = (HR-H0)/16;
|
||||||
|
|
||||||
if (IsVarTerm(tsize)) {
|
if (IsVarTerm(tsize)) {
|
||||||
Yap_Error(INSTANTIATION_ERROR,tsize,"nb_beam");
|
Yap_Error(INSTANTIATION_ERROR,tsize,"nb_beam");
|
||||||
@ -2368,14 +2368,14 @@ p_nb_beam_add_to_beam( USES_REGS1 )
|
|||||||
qd = GetHeap(ARG1,"add_to_beam");
|
qd = GetHeap(ARG1,"add_to_beam");
|
||||||
arena = qd[HEAP_ARENA];
|
arena = qd[HEAP_ARENA];
|
||||||
/* garbage collection ? */
|
/* garbage collection ? */
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
old_sz = ArenaSz(arena);
|
old_sz = ArenaSz(arena);
|
||||||
while (old_sz < MIN_ARENA_SIZE) {
|
while (old_sz < MIN_ARENA_SIZE) {
|
||||||
UInt gsiz = hsize*2;
|
UInt gsiz = hsize*2;
|
||||||
|
|
||||||
H = oldH;
|
HR = oldH;
|
||||||
HB = oldHB;
|
HB = oldHB;
|
||||||
if (gsiz > 1024*1024) {
|
if (gsiz > 1024*1024) {
|
||||||
gsiz = 1024*1024;
|
gsiz = 1024*1024;
|
||||||
@ -2390,9 +2390,9 @@ p_nb_beam_add_to_beam( USES_REGS1 )
|
|||||||
to = ARG3;
|
to = ARG3;
|
||||||
qd = RepAppl(Deref(ARG1))+1;
|
qd = RepAppl(Deref(ARG1))+1;
|
||||||
arena = qd[HEAP_ARENA];
|
arena = qd[HEAP_ARENA];
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
H = HB = ArenaPt(arena);
|
HR = HB = ArenaPt(arena);
|
||||||
old_sz = ArenaSz(arena);
|
old_sz = ArenaSz(arena);
|
||||||
}
|
}
|
||||||
pt = qd+HEAP_START;
|
pt = qd+HEAP_START;
|
||||||
@ -2421,7 +2421,7 @@ p_nb_beam_del( USES_REGS1 )
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
old_sz = ArenaSz(arena);
|
old_sz = ArenaSz(arena);
|
||||||
/* garbage collection ? */
|
/* garbage collection ? */
|
||||||
oldH = H;
|
oldH = HR;
|
||||||
oldHB = HB;
|
oldHB = HB;
|
||||||
qd[HEAP_SIZE] = Global_MkIntegerTerm(qsz-1);
|
qd[HEAP_SIZE] = Global_MkIntegerTerm(qsz-1);
|
||||||
CloseArena(oldH, oldHB, ASP, &arena, old_sz PASS_REGS);
|
CloseArena(oldH, oldHB, ASP, &arena, old_sz PASS_REGS);
|
||||||
@ -2488,25 +2488,25 @@ p_nb_beam_keys( USES_REGS1 )
|
|||||||
if (!qd)
|
if (!qd)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
qsz = IntegerOfTerm(qd[HEAP_SIZE]);
|
qsz = IntegerOfTerm(qd[HEAP_SIZE]);
|
||||||
ho = H;
|
ho = HR;
|
||||||
pt = qd+HEAP_START;
|
pt = qd+HEAP_START;
|
||||||
if (qsz == 0)
|
if (qsz == 0)
|
||||||
return Yap_unify(ARG2, TermNil);
|
return Yap_unify(ARG2, TermNil);
|
||||||
for (i=0; i < qsz; i++) {
|
for (i=0; i < qsz; i++) {
|
||||||
if (H > ASP-1024) {
|
if (HR > ASP-1024) {
|
||||||
H = ho;
|
HR = ho;
|
||||||
if (!Yap_gcl(((ASP-H)-1024)*sizeof(CELL), 2, ENV, P)) {
|
if (!Yap_gcl(((ASP-HR)-1024)*sizeof(CELL), 2, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
*H++ = pt[0];
|
*HR++ = pt[0];
|
||||||
*H = AbsPair(H+1);
|
*HR = AbsPair(HR+1);
|
||||||
H++;
|
HR++;
|
||||||
pt += 2;
|
pt += 2;
|
||||||
}
|
}
|
||||||
H[-1] = TermNil;
|
HR[-1] = TermNil;
|
||||||
return Yap_unify(ARG2, AbsPair(ho));
|
return Yap_unify(ARG2, AbsPair(ho));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
C/grow.c
26
C/grow.c
@ -100,7 +100,7 @@ SetHeapRegs(int copying_threads USES_REGS)
|
|||||||
LOCAL_OldLCL0 = LCL0;
|
LOCAL_OldLCL0 = LCL0;
|
||||||
LOCAL_OldASP = ASP;
|
LOCAL_OldASP = ASP;
|
||||||
LOCAL_OldGlobalBase = (CELL *)LOCAL_GlobalBase;
|
LOCAL_OldGlobalBase = (CELL *)LOCAL_GlobalBase;
|
||||||
LOCAL_OldH = H;
|
LOCAL_OldH = HR;
|
||||||
LOCAL_OldH0 = H0;
|
LOCAL_OldH0 = H0;
|
||||||
LOCAL_OldTrailBase = LOCAL_TrailBase;
|
LOCAL_OldTrailBase = LOCAL_TrailBase;
|
||||||
LOCAL_OldTrailTop = LOCAL_TrailTop;
|
LOCAL_OldTrailTop = LOCAL_TrailTop;
|
||||||
@ -135,8 +135,8 @@ SetHeapRegs(int copying_threads USES_REGS)
|
|||||||
if (LCL0)
|
if (LCL0)
|
||||||
LCL0 = PtoLocAdjust(LCL0);
|
LCL0 = PtoLocAdjust(LCL0);
|
||||||
UNLOCK(LOCAL_SignalLock);
|
UNLOCK(LOCAL_SignalLock);
|
||||||
if (H)
|
if (HR)
|
||||||
H = PtoGloAdjust(H);
|
HR = PtoGloAdjust(HR);
|
||||||
#ifdef CUT_C
|
#ifdef CUT_C
|
||||||
if (Yap_REGS.CUT_C_TOP)
|
if (Yap_REGS.CUT_C_TOP)
|
||||||
Yap_REGS.CUT_C_TOP = CutCAdjust(Yap_REGS.CUT_C_TOP);
|
Yap_REGS.CUT_C_TOP = CutCAdjust(Yap_REGS.CUT_C_TOP);
|
||||||
@ -542,7 +542,7 @@ AdjustGlobal(long sz, int thread_copying USES_REGS)
|
|||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
pt = H0;
|
pt = H0;
|
||||||
pt_max = (H-sz/CellSize);
|
pt_max = (HR-sz/CellSize);
|
||||||
#if defined(YAPOR_THREADS)
|
#if defined(YAPOR_THREADS)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -563,7 +563,7 @@ AdjustGlobal(long sz, int thread_copying USES_REGS)
|
|||||||
/* skip bitmaps */
|
/* skip bitmaps */
|
||||||
switch((CELL)f) {
|
switch((CELL)f) {
|
||||||
case (CELL)FunctorDouble:
|
case (CELL)FunctorDouble:
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
pt += 3;
|
pt += 3;
|
||||||
#else
|
#else
|
||||||
pt += 2;
|
pt += 2;
|
||||||
@ -901,19 +901,19 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
|
|||||||
do_grow = FALSE;
|
do_grow = FALSE;
|
||||||
}
|
}
|
||||||
} else if (hsplit < (CELL*)omax ||
|
} else if (hsplit < (CELL*)omax ||
|
||||||
hsplit > H)
|
hsplit > HR)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (hsplit == (CELL *)omax)
|
else if (hsplit == (CELL *)omax)
|
||||||
hsplit = NULL;
|
hsplit = NULL;
|
||||||
if (size < 0 ||
|
if (size < 0 ||
|
||||||
(Unsigned(H)+size < Unsigned(ASP)-StackGap( PASS_REGS1 ) &&
|
(Unsigned(HR)+size < Unsigned(ASP)-StackGap( PASS_REGS1 ) &&
|
||||||
hsplit > H0)) {
|
hsplit > H0)) {
|
||||||
/* don't need to expand stacks */
|
/* don't need to expand stacks */
|
||||||
insert_in_delays = FALSE;
|
insert_in_delays = FALSE;
|
||||||
do_grow = FALSE;
|
do_grow = FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Unsigned(H)+size < Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(HR)+size < Unsigned(ASP)-CreepFlag) {
|
||||||
/* we can just ask for more room */
|
/* we can just ask for more room */
|
||||||
do_grow = FALSE;
|
do_grow = FALSE;
|
||||||
}
|
}
|
||||||
@ -1184,6 +1184,7 @@ fix_compiler_instructions(PInstr *pcpc USES_REGS)
|
|||||||
case index_dbref_op:
|
case index_dbref_op:
|
||||||
case index_blob_op:
|
case index_blob_op:
|
||||||
case index_long_op:
|
case index_long_op:
|
||||||
|
case index_string_op:
|
||||||
case if_nonvar_op:
|
case if_nonvar_op:
|
||||||
case unify_last_list_op:
|
case unify_last_list_op:
|
||||||
case write_last_list_op:
|
case write_last_list_op:
|
||||||
@ -1200,6 +1201,7 @@ fix_compiler_instructions(PInstr *pcpc USES_REGS)
|
|||||||
case enter_lu_op:
|
case enter_lu_op:
|
||||||
case empty_call_op:
|
case empty_call_op:
|
||||||
case blob_op:
|
case blob_op:
|
||||||
|
case string_op:
|
||||||
case fetch_args_vi_op:
|
case fetch_args_vi_op:
|
||||||
case fetch_args_iv_op:
|
case fetch_args_iv_op:
|
||||||
case label_ctl_op:
|
case label_ctl_op:
|
||||||
@ -1665,7 +1667,7 @@ growstack(size_t size USES_REGS)
|
|||||||
fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id);
|
fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id);
|
||||||
#endif
|
#endif
|
||||||
fprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows);
|
fprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows);
|
||||||
fprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,H);
|
fprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (unsigned long int)(HR-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,HR);
|
||||||
fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
|
fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
|
||||||
fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n",
|
fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n",
|
||||||
(unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR);
|
(unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR);
|
||||||
@ -1703,7 +1705,7 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
|
|||||||
fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id);
|
fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id);
|
||||||
#endif
|
#endif
|
||||||
fprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows);
|
fprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows);
|
||||||
fprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,H);
|
fprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (unsigned long int)(HR-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,HR);
|
||||||
fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
|
fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
|
||||||
fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n",
|
fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n",
|
||||||
(unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR);
|
(unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR);
|
||||||
@ -1752,7 +1754,7 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr
|
|||||||
#endif
|
#endif
|
||||||
fprintf(GLOBAL_stderr, "%% Trail Overflow %d\n", LOCAL_trail_overflows);
|
fprintf(GLOBAL_stderr, "%% Trail Overflow %d\n", LOCAL_trail_overflows);
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
fprintf(GLOBAL_stderr, "%% Heap: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)LOCAL_GlobalBase),(CELL *)LOCAL_GlobalBase,H);
|
fprintf(GLOBAL_stderr, "%% Heap: %8ld cells (%p-%p)\n", (unsigned long int)(HR-(CELL *)LOCAL_GlobalBase),(CELL *)LOCAL_GlobalBase,HR);
|
||||||
fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
|
fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
|
||||||
fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n",
|
fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n",
|
||||||
(unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR);
|
(unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR);
|
||||||
@ -1974,7 +1976,7 @@ Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental)
|
|||||||
LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff = size;
|
LOCAL_TrDiff = LOCAL_LDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff = size;
|
||||||
LOCAL_XDiff = LOCAL_HDiff = 0;
|
LOCAL_XDiff = LOCAL_HDiff = 0;
|
||||||
LOCAL_GSplit = NULL;
|
LOCAL_GSplit = NULL;
|
||||||
H = REMOTE_ThreadHandle(worker_p).current_yaam_regs->H_;
|
HR = REMOTE_ThreadHandle(worker_p).current_yaam_regs->H_;
|
||||||
H0 = REMOTE_ThreadHandle(worker_p).current_yaam_regs->H0_;
|
H0 = REMOTE_ThreadHandle(worker_p).current_yaam_regs->H0_;
|
||||||
B = REMOTE_ThreadHandle(worker_p).current_yaam_regs->B_;
|
B = REMOTE_ThreadHandle(worker_p).current_yaam_regs->B_;
|
||||||
ENV = REMOTE_ThreadHandle(worker_p).current_yaam_regs->ENV_;
|
ENV = REMOTE_ThreadHandle(worker_p).current_yaam_regs->ENV_;
|
||||||
|
52
C/heapgc.c
52
C/heapgc.c
@ -1163,7 +1163,7 @@ mark_variable(CELL_PTR current USES_REGS)
|
|||||||
if (UNMARKED_MARK(current,local_bp)) {
|
if (UNMARKED_MARK(current,local_bp)) {
|
||||||
POP_CONTINUATION();
|
POP_CONTINUATION();
|
||||||
}
|
}
|
||||||
if (current >= H0 && current < H) {
|
if (current >= H0 && current < HR) {
|
||||||
//fprintf(stderr,"%p M\n", current);
|
//fprintf(stderr,"%p M\n", current);
|
||||||
LOCAL_total_marked++;
|
LOCAL_total_marked++;
|
||||||
if (current < LOCAL_HGEN) {
|
if (current < LOCAL_HGEN) {
|
||||||
@ -1177,7 +1177,7 @@ mark_variable(CELL_PTR current USES_REGS)
|
|||||||
next = GET_NEXT(ccur);
|
next = GET_NEXT(ccur);
|
||||||
|
|
||||||
if (IsVarTerm(ccur)) {
|
if (IsVarTerm(ccur)) {
|
||||||
if (IN_BETWEEN(LOCAL_GlobalBase,current,H) && GlobalIsAttVar(current) && current==next) {
|
if (IN_BETWEEN(LOCAL_GlobalBase,current,HR) && GlobalIsAttVar(current) && current==next) {
|
||||||
if (next < H0) POP_CONTINUATION();
|
if (next < H0) POP_CONTINUATION();
|
||||||
if (!UNMARKED_MARK(next-1,local_bp)) {
|
if (!UNMARKED_MARK(next-1,local_bp)) {
|
||||||
//fprintf(stderr,"%p M\n", next-1);
|
//fprintf(stderr,"%p M\n", next-1);
|
||||||
@ -1222,7 +1222,7 @@ mark_variable(CELL_PTR current USES_REGS)
|
|||||||
if (next >= HB && current < LCL0 && cnext != TermFoundVar) {
|
if (next >= HB && current < LCL0 && cnext != TermFoundVar) {
|
||||||
UNMARK(current);
|
UNMARK(current);
|
||||||
*current = cnext;
|
*current = cnext;
|
||||||
if (current >= H0 && current < H) {
|
if (current >= H0 && current < HR) {
|
||||||
//fprintf(stderr,"%p M\n", current-1);
|
//fprintf(stderr,"%p M\n", current-1);
|
||||||
LOCAL_total_marked--;
|
LOCAL_total_marked--;
|
||||||
if (current < LOCAL_HGEN) {
|
if (current < LOCAL_HGEN) {
|
||||||
@ -1247,7 +1247,7 @@ mark_variable(CELL_PTR current USES_REGS)
|
|||||||
/* This step is possible because we clean up the trail */
|
/* This step is possible because we clean up the trail */
|
||||||
*current = UNMARK_CELL(cnext);
|
*current = UNMARK_CELL(cnext);
|
||||||
UNMARK(current);
|
UNMARK(current);
|
||||||
if (current >= H0 && current < H ) {
|
if (current >= H0 && current < HR ) {
|
||||||
//fprintf(stderr,"%p M\n", current);
|
//fprintf(stderr,"%p M\n", current);
|
||||||
LOCAL_total_marked--;
|
LOCAL_total_marked--;
|
||||||
if (current < LOCAL_HGEN) {
|
if (current < LOCAL_HGEN) {
|
||||||
@ -1365,7 +1365,7 @@ mark_variable(CELL_PTR current USES_REGS)
|
|||||||
MARK(next);
|
MARK(next);
|
||||||
PUSH_POINTER(next PASS_REGS);
|
PUSH_POINTER(next PASS_REGS);
|
||||||
{
|
{
|
||||||
UInt sz = 1+SIZEOF_DOUBLE/SIZEOF_LONG_INT;
|
UInt sz = 1+SIZEOF_DOUBLE/SIZEOF_INT_P;
|
||||||
if (next < LOCAL_HGEN) {
|
if (next < LOCAL_HGEN) {
|
||||||
LOCAL_total_oldies+= 1+sz;
|
LOCAL_total_oldies+= 1+sz;
|
||||||
} else {
|
} else {
|
||||||
@ -1736,7 +1736,7 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
|
|||||||
nondeterministically, I know that after backtracking it will be back to be an unbound variable.
|
nondeterministically, I know that after backtracking it will be back to be an unbound variable.
|
||||||
The ideal solution would be to unbind all variables. The current solution is to
|
The ideal solution would be to unbind all variables. The current solution is to
|
||||||
remark it as an attributed variable */
|
remark it as an attributed variable */
|
||||||
if (IN_BETWEEN(LOCAL_GlobalBase,hp,H) && GlobalIsAttVar(hp) && !UNMARKED_MARK(hp-1,LOCAL_bp)) {
|
if (IN_BETWEEN(LOCAL_GlobalBase,hp,HR) && GlobalIsAttVar(hp) && !UNMARKED_MARK(hp-1,LOCAL_bp)) {
|
||||||
//fprintf(stderr,"%p M\n", hp);
|
//fprintf(stderr,"%p M\n", hp);
|
||||||
LOCAL_total_marked++;
|
LOCAL_total_marked++;
|
||||||
PUSH_POINTER(hp-1 PASS_REGS);
|
PUSH_POINTER(hp-1 PASS_REGS);
|
||||||
@ -1779,7 +1779,7 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B
|
|||||||
} else if (IsPairTerm(trail_cell)) {
|
} else if (IsPairTerm(trail_cell)) {
|
||||||
/* cannot safely ignore this */
|
/* cannot safely ignore this */
|
||||||
CELL *cptr = RepPair(trail_cell);
|
CELL *cptr = RepPair(trail_cell);
|
||||||
if (IN_BETWEEN(LOCAL_GlobalBase,cptr,H)) {
|
if (IN_BETWEEN(LOCAL_GlobalBase,cptr,HR)) {
|
||||||
if (GlobalIsAttVar(cptr)) {
|
if (GlobalIsAttVar(cptr)) {
|
||||||
TrailTerm(trail_base) = (CELL)cptr;
|
TrailTerm(trail_base) = (CELL)cptr;
|
||||||
mark_external_reference(&TrailTerm(trail_base) PASS_REGS);
|
mark_external_reference(&TrailTerm(trail_base) PASS_REGS);
|
||||||
@ -2617,7 +2617,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR USES_REGS)
|
|||||||
if (IsVarTerm(trail_cell)) {
|
if (IsVarTerm(trail_cell)) {
|
||||||
/* we need to check whether this is a honest to god trail entry */
|
/* we need to check whether this is a honest to god trail entry */
|
||||||
/* make sure it is a heap cell before we test whether it has been marked */
|
/* make sure it is a heap cell before we test whether it has been marked */
|
||||||
if ((CELL *)trail_cell < H && (CELL *)trail_cell >= H0 && MARKED_PTR((CELL *)trail_cell)) {
|
if ((CELL *)trail_cell < HR && (CELL *)trail_cell >= H0 && MARKED_PTR((CELL *)trail_cell)) {
|
||||||
if (HEAP_PTR(trail_cell)) {
|
if (HEAP_PTR(trail_cell)) {
|
||||||
into_relocation_chain(&TrailTerm(dest), GET_NEXT(trail_cell) PASS_REGS);
|
into_relocation_chain(&TrailTerm(dest), GET_NEXT(trail_cell) PASS_REGS);
|
||||||
}
|
}
|
||||||
@ -2635,7 +2635,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR USES_REGS)
|
|||||||
CELL *pt0 = RepPair(trail_cell);
|
CELL *pt0 = RepPair(trail_cell);
|
||||||
CELL flags;
|
CELL flags;
|
||||||
|
|
||||||
if (IN_BETWEEN(LOCAL_GlobalBase, pt0, H)) {
|
if (IN_BETWEEN(LOCAL_GlobalBase, pt0, HR)) {
|
||||||
if (GlobalIsAttVar(pt0)) {
|
if (GlobalIsAttVar(pt0)) {
|
||||||
TrailTerm(dest) = trail_cell;
|
TrailTerm(dest) = trail_cell;
|
||||||
/* be careful with partial gc */
|
/* be careful with partial gc */
|
||||||
@ -3445,12 +3445,12 @@ compact_heap( USES_REGS1 )
|
|||||||
next_hb = set_next_hb(gc_B PASS_REGS);
|
next_hb = set_next_hb(gc_B PASS_REGS);
|
||||||
dest = H0 + LOCAL_total_marked - 1;
|
dest = H0 + LOCAL_total_marked - 1;
|
||||||
|
|
||||||
gc_B = update_B_H(gc_B, H, dest+1, dest+2
|
gc_B = update_B_H(gc_B, HR, dest+1, dest+2
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
, &depfr
|
, &depfr
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
);
|
);
|
||||||
for (current = H - 1; current >= start_from; current--) {
|
for (current = HR - 1; current >= start_from; current--) {
|
||||||
|
|
||||||
if (MARKED_PTR(current)) {
|
if (MARKED_PTR(current)) {
|
||||||
CELL ccell = UNMARK_CELL(*current);
|
CELL ccell = UNMARK_CELL(*current);
|
||||||
@ -3541,7 +3541,7 @@ compact_heap( USES_REGS1 )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
dest = (CELL_PTR) start_from;
|
dest = (CELL_PTR) start_from;
|
||||||
for (current = start_from; current < H; current++) {
|
for (current = start_from; current < HR; current++) {
|
||||||
CELL ccur = *current;
|
CELL ccur = *current;
|
||||||
if (MARKED_PTR(current)) {
|
if (MARKED_PTR(current)) {
|
||||||
CELL uccur = UNMARK_CELL(ccur);
|
CELL uccur = UNMARK_CELL(ccur);
|
||||||
@ -3577,7 +3577,7 @@ compact_heap( USES_REGS1 )
|
|||||||
ccur = *current;
|
ccur = *current;
|
||||||
next = GET_NEXT(ccur);
|
next = GET_NEXT(ccur);
|
||||||
if (HEAP_PTR(ccur) &&
|
if (HEAP_PTR(ccur) &&
|
||||||
(next = GET_NEXT(ccur)) < H && /* move current cell &
|
(next = GET_NEXT(ccur)) < HR && /* move current cell &
|
||||||
* push */
|
* push */
|
||||||
next > current) { /* into relocation chain */
|
next > current) { /* into relocation chain */
|
||||||
*dest = ccur;
|
*dest = ccur;
|
||||||
@ -3601,7 +3601,7 @@ compact_heap( USES_REGS1 )
|
|||||||
(unsigned long int)found_marked);
|
(unsigned long int)found_marked);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
H = dest; /* reset H */
|
HR = dest; /* reset H */
|
||||||
HB = B->cp_h;
|
HB = B->cp_h;
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (B_FZ == (choiceptr)LCL0)
|
if (B_FZ == (choiceptr)LCL0)
|
||||||
@ -3620,7 +3620,7 @@ compact_heap( USES_REGS1 )
|
|||||||
static void
|
static void
|
||||||
icompact_heap( USES_REGS1 )
|
icompact_heap( USES_REGS1 )
|
||||||
{
|
{
|
||||||
CELL_PTR *iptr, *ibase = (CELL_PTR *)H;
|
CELL_PTR *iptr, *ibase = (CELL_PTR *)HR;
|
||||||
CELL_PTR dest;
|
CELL_PTR dest;
|
||||||
CELL *next_hb;
|
CELL *next_hb;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -3645,7 +3645,7 @@ icompact_heap( USES_REGS1 )
|
|||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
next_hb = set_next_hb(gc_B PASS_REGS);
|
next_hb = set_next_hb(gc_B PASS_REGS);
|
||||||
dest = (CELL_PTR) H0 + LOCAL_total_marked - 1;
|
dest = (CELL_PTR) H0 + LOCAL_total_marked - 1;
|
||||||
gc_B = update_B_H(gc_B, H, dest+1, dest+2
|
gc_B = update_B_H(gc_B, HR, dest+1, dest+2
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
, &depfr
|
, &depfr
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
@ -3778,7 +3778,7 @@ icompact_heap( USES_REGS1 )
|
|||||||
(unsigned long int)found_marked);
|
(unsigned long int)found_marked);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
H = dest; /* reset H */
|
HR = dest; /* reset H */
|
||||||
HB = B->cp_h;
|
HB = B->cp_h;
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (B_FZ == (choiceptr)LCL0)
|
if (B_FZ == (choiceptr)LCL0)
|
||||||
@ -3867,7 +3867,7 @@ compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp USES_REGS)
|
|||||||
{
|
{
|
||||||
CELL *CurrentH0 = NULL;
|
CELL *CurrentH0 = NULL;
|
||||||
|
|
||||||
int icompact = (LOCAL_iptop < (CELL_PTR *)ASP && 10*LOCAL_total_marked < H-H0);
|
int icompact = (LOCAL_iptop < (CELL_PTR *)ASP && 10*LOCAL_total_marked < HR-H0);
|
||||||
|
|
||||||
if (icompact) {
|
if (icompact) {
|
||||||
/* we are going to reuse the total space */
|
/* we are going to reuse the total space */
|
||||||
@ -3908,7 +3908,7 @@ compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp USES_REGS)
|
|||||||
LOCAL_total_marked += LOCAL_total_oldies;
|
LOCAL_total_marked += LOCAL_total_oldies;
|
||||||
CurrentH0 = NULL;
|
CurrentH0 = NULL;
|
||||||
}
|
}
|
||||||
quicksort((CELL_PTR *)H, 0, (LOCAL_iptop-(CELL_PTR *)H)-1);
|
quicksort((CELL_PTR *)HR, 0, (LOCAL_iptop-(CELL_PTR *)HR)-1);
|
||||||
icompact_heap( PASS_REGS1 );
|
icompact_heap( PASS_REGS1 );
|
||||||
} else
|
} else
|
||||||
#endif /* HYBRID_SCHEME */
|
#endif /* HYBRID_SCHEME */
|
||||||
@ -3947,7 +3947,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
|||||||
UInt alloc_sz;
|
UInt alloc_sz;
|
||||||
int jmp_res;
|
int jmp_res;
|
||||||
|
|
||||||
heap_cells = H-H0;
|
heap_cells = HR-H0;
|
||||||
gc_verbose = is_gc_verbose();
|
gc_verbose = is_gc_verbose();
|
||||||
effectiveness = 0;
|
effectiveness = 0;
|
||||||
gc_trace = FALSE;
|
gc_trace = FALSE;
|
||||||
@ -3984,7 +3984,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
|||||||
fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id);
|
fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id);
|
||||||
#endif
|
#endif
|
||||||
fprintf(GLOBAL_stderr, "%% Start of garbage collection %lu:\n", (unsigned long int)LOCAL_GcCalls);
|
fprintf(GLOBAL_stderr, "%% Start of garbage collection %lu:\n", (unsigned long int)LOCAL_GcCalls);
|
||||||
fprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (long int)heap_cells,H0,H);
|
fprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (long int)heap_cells,H0,HR);
|
||||||
fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
|
fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
|
||||||
fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n",
|
fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n",
|
||||||
(unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR);
|
(unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR);
|
||||||
@ -4070,7 +4070,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
|||||||
}
|
}
|
||||||
memset((void *)LOCAL_bp, 0, alloc_sz);
|
memset((void *)LOCAL_bp, 0, alloc_sz);
|
||||||
#ifdef HYBRID_SCHEME
|
#ifdef HYBRID_SCHEME
|
||||||
LOCAL_iptop = (CELL_PTR *)H;
|
LOCAL_iptop = (CELL_PTR *)HR;
|
||||||
#endif
|
#endif
|
||||||
/* get the number of active registers */
|
/* get the number of active registers */
|
||||||
LOCAL_HGEN = VarOfTerm(Yap_ReadTimedVar(LOCAL_GcGeneration));
|
LOCAL_HGEN = VarOfTerm(Yap_ReadTimedVar(LOCAL_GcGeneration));
|
||||||
@ -4144,7 +4144,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
|||||||
if (gc_verbose) {
|
if (gc_verbose) {
|
||||||
fprintf(GLOBAL_stderr, "%% GC %lu took %g sec, total of %g sec doing GC so far.\n", (unsigned long int)LOCAL_GcCalls, (double)gc_time/1000, (double)LOCAL_TotGcTime/1000);
|
fprintf(GLOBAL_stderr, "%% GC %lu took %g sec, total of %g sec doing GC so far.\n", (unsigned long int)LOCAL_GcCalls, (double)gc_time/1000, (double)LOCAL_TotGcTime/1000);
|
||||||
fprintf(GLOBAL_stderr, "%% Left %ld cells free in stacks.\n",
|
fprintf(GLOBAL_stderr, "%% Left %ld cells free in stacks.\n",
|
||||||
(unsigned long int)(ASP-H));
|
(unsigned long int)(ASP-HR));
|
||||||
}
|
}
|
||||||
check_global();
|
check_global();
|
||||||
return effectiveness;
|
return effectiveness;
|
||||||
@ -4231,19 +4231,19 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop USES_REGS)
|
|||||||
if (gc_on && !(LOCAL_PrologMode & InErrorMode) &&
|
if (gc_on && !(LOCAL_PrologMode & InErrorMode) &&
|
||||||
/* make sure there is a point in collecting the heap */
|
/* make sure there is a point in collecting the heap */
|
||||||
(ASP-H0)*sizeof(CELL) > gc_lim &&
|
(ASP-H0)*sizeof(CELL) > gc_lim &&
|
||||||
H-LOCAL_HGEN > (LCL0-ASP)/2) {
|
HR-LOCAL_HGEN > (LCL0-ASP)/2) {
|
||||||
effectiveness = do_gc(predarity, current_env, nextop PASS_REGS);
|
effectiveness = do_gc(predarity, current_env, nextop PASS_REGS);
|
||||||
if (effectiveness < 0)
|
if (effectiveness < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (effectiveness > 90 && !gc_t) {
|
if (effectiveness > 90 && !gc_t) {
|
||||||
while (gc_margin < (H-H0)/sizeof(CELL))
|
while (gc_margin < (HR-H0)/sizeof(CELL))
|
||||||
gc_margin <<= 1;
|
gc_margin <<= 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
effectiveness = 0;
|
effectiveness = 0;
|
||||||
}
|
}
|
||||||
/* expand the stack if effectiveness is less than 20 % */
|
/* expand the stack if effectiveness is less than 20 % */
|
||||||
if (ASP - H < gc_margin/sizeof(CELL) ||
|
if (ASP - HR < gc_margin/sizeof(CELL) ||
|
||||||
effectiveness < 20) {
|
effectiveness < 20) {
|
||||||
LeaveGCMode( PASS_REGS1 );
|
LeaveGCMode( PASS_REGS1 );
|
||||||
#ifndef YAPOR
|
#ifndef YAPOR
|
||||||
|
14
C/index.c
14
C/index.c
@ -2756,10 +2756,10 @@ compile_index(struct intermediates *cint)
|
|||||||
siglongjmp(cint->CompilerBotch,2);
|
siglongjmp(cint->CompilerBotch,2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cint->freep = (char *)H;
|
cint->freep = (char *)HR;
|
||||||
#else
|
#else
|
||||||
/* reserve double the space for compiler */
|
/* reserve double the space for compiler */
|
||||||
cint->cls = (ClauseDef *)H;
|
cint->cls = (ClauseDef *)HR;
|
||||||
if (cint->cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
if (cint->cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
||||||
/* tell how much space we need */
|
/* tell how much space we need */
|
||||||
LOCAL_Error_Size += NClauses*sizeof(ClauseDef);
|
LOCAL_Error_Size += NClauses*sizeof(ClauseDef);
|
||||||
@ -3809,7 +3809,7 @@ expand_index(struct intermediates *cint) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
cint->cls = (ClauseDef *)H;
|
cint->cls = (ClauseDef *)HR;
|
||||||
if (cint->cls+2*nclauses > (ClauseDef *)(ASP-4096)) {
|
if (cint->cls+2*nclauses > (ClauseDef *)(ASP-4096)) {
|
||||||
/* tell how much space we need (worst case) */
|
/* tell how much space we need (worst case) */
|
||||||
LOCAL_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
LOCAL_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
||||||
@ -3837,7 +3837,7 @@ expand_index(struct intermediates *cint) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
cint->cls = (ClauseDef *)H;
|
cint->cls = (ClauseDef *)HR;
|
||||||
if (cint->cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
if (cint->cls+2*NClauses > (ClauseDef *)(ASP-4096)) {
|
||||||
/* tell how much space we need (worst case) */
|
/* tell how much space we need (worst case) */
|
||||||
LOCAL_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
LOCAL_Error_Size += 2*NClauses*sizeof(ClauseDef);
|
||||||
@ -3866,7 +3866,7 @@ expand_index(struct intermediates *cint) {
|
|||||||
return labp;
|
return labp;
|
||||||
}
|
}
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
cint->freep = (char *)H;
|
cint->freep = (char *)HR;
|
||||||
#else
|
#else
|
||||||
cint->freep = (char *)(max+1);
|
cint->freep = (char *)(max+1);
|
||||||
#endif
|
#endif
|
||||||
@ -6056,7 +6056,7 @@ store_clause_choice_point(Term t1, Term tb, Term tr, yamop *ipc, PredEntry *pe,
|
|||||||
tsp[3] = tb;
|
tsp[3] = tb;
|
||||||
tsp[4] = tr;
|
tsp[4] = tr;
|
||||||
bptr->cp_tr = TR;
|
bptr->cp_tr = TR;
|
||||||
HB = bptr->cp_h = H;
|
HB = bptr->cp_h = HR;
|
||||||
#ifdef DEPTH_LIMIT
|
#ifdef DEPTH_LIMIT
|
||||||
bptr->cp_depth = DEPTH;
|
bptr->cp_depth = DEPTH;
|
||||||
#endif
|
#endif
|
||||||
@ -6079,7 +6079,7 @@ update_clause_choice_point(yamop *ipc, yamop *ap_pc USES_REGS)
|
|||||||
{
|
{
|
||||||
Term tpc = MkIntegerTerm((Int)ipc);
|
Term tpc = MkIntegerTerm((Int)ipc);
|
||||||
B->cp_args[1] = tpc;
|
B->cp_args[1] = tpc;
|
||||||
B->cp_h = H;
|
B->cp_h = HR;
|
||||||
B->cp_ap = ap_pc;
|
B->cp_ap = ap_pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
C/inlines.c
22
C/inlines.c
@ -425,9 +425,9 @@ p_dif( USES_REGS1 )
|
|||||||
/* make B and HB point to H to guarantee all bindings will
|
/* make B and HB point to H to guarantee all bindings will
|
||||||
* be trailed
|
* be trailed
|
||||||
*/
|
*/
|
||||||
HBREG = H;
|
HBREG = HR;
|
||||||
B = (choiceptr) H;
|
B = (choiceptr) HR;
|
||||||
B->cp_h = H;
|
B->cp_h = HR;
|
||||||
SET_BB(B);
|
SET_BB(B);
|
||||||
save_hb();
|
save_hb();
|
||||||
d0 = Yap_IUnify(d0, d1);
|
d0 = Yap_IUnify(d0, d1);
|
||||||
@ -442,7 +442,7 @@ p_dif( USES_REGS1 )
|
|||||||
B = pt1;
|
B = pt1;
|
||||||
SET_BB(PROTECT_FROZEN_B(pt1));
|
SET_BB(PROTECT_FROZEN_B(pt1));
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
H = HBREG;
|
HR = HBREG;
|
||||||
#endif
|
#endif
|
||||||
HBREG = B->cp_h;
|
HBREG = B->cp_h;
|
||||||
/* untrail all bindings made by Yap_IUnify */
|
/* untrail all bindings made by Yap_IUnify */
|
||||||
@ -707,10 +707,10 @@ p_functor( USES_REGS1 ) /* functor(?,?,?) */
|
|||||||
/* We made it!!!!! we got in d0 the name, in d1 the arity and
|
/* We made it!!!!! we got in d0 the name, in d1 the arity and
|
||||||
* in pt0 the variable to bind it to. */
|
* in pt0 the variable to bind it to. */
|
||||||
if (d0 == TermDot && d1 == 2) {
|
if (d0 == TermDot && d1 == 2) {
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
RESET_VARIABLE(H+1);
|
RESET_VARIABLE(HR+1);
|
||||||
d0 = AbsPair(H);
|
d0 = AbsPair(HR);
|
||||||
H += 2;
|
HR += 2;
|
||||||
}
|
}
|
||||||
else if ((Int)d1 > 0) {
|
else if ((Int)d1 > 0) {
|
||||||
/* now let's build a compound term */
|
/* now let's build a compound term */
|
||||||
@ -724,9 +724,9 @@ p_functor( USES_REGS1 ) /* functor(?,?,?) */
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
d0 = (CELL) Yap_MkFunctor(AtomOfTerm(d0), (Int) d1);
|
d0 = (CELL) Yap_MkFunctor(AtomOfTerm(d0), (Int) d1);
|
||||||
pt1 = H;
|
pt1 = HR;
|
||||||
*pt1++ = d0;
|
*pt1++ = d0;
|
||||||
d0 = AbsAppl(H);
|
d0 = AbsAppl(HR);
|
||||||
if (pt1+d1 > ENV - StackGap( PASS_REGS1 )) {
|
if (pt1+d1 > ENV - StackGap( PASS_REGS1 )) {
|
||||||
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
@ -739,7 +739,7 @@ p_functor( USES_REGS1 ) /* functor(?,?,?) */
|
|||||||
pt1++;
|
pt1++;
|
||||||
}
|
}
|
||||||
/* done building the term */
|
/* done building the term */
|
||||||
H = pt1;
|
HR = pt1;
|
||||||
ENDP(pt1);
|
ENDP(pt1);
|
||||||
} else if ((Int)d1 < 0) {
|
} else if ((Int)d1 < 0) {
|
||||||
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO,MkIntegerTerm(d1),"functor/3");
|
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO,MkIntegerTerm(d1),"functor/3");
|
||||||
|
31
C/iopreds.c
31
C/iopreds.c
@ -271,7 +271,7 @@ syntax_error (TokEntry * tokptr, IOSTREAM *st, Term *outp)
|
|||||||
Int start, err = 0, end;
|
Int start, err = 0, end;
|
||||||
Term tf[7];
|
Term tf[7];
|
||||||
Term *error = tf+3;
|
Term *error = tf+3;
|
||||||
CELL *Hi = H;
|
CELL *Hi = HR;
|
||||||
int has_qq = FALSE;
|
int has_qq = FALSE;
|
||||||
|
|
||||||
/* make sure to globalise variable */
|
/* make sure to globalise variable */
|
||||||
@ -280,12 +280,12 @@ syntax_error (TokEntry * tokptr, IOSTREAM *st, Term *outp)
|
|||||||
clean_vars(LOCAL_AnonVarTable);
|
clean_vars(LOCAL_AnonVarTable);
|
||||||
while (1) {
|
while (1) {
|
||||||
Term ts[2];
|
Term ts[2];
|
||||||
if (H > ASP-1024) {
|
if (HR > ASP-1024) {
|
||||||
tf[3] = TermNil;
|
tf[3] = TermNil;
|
||||||
err = 0;
|
err = 0;
|
||||||
end = 0;
|
end = 0;
|
||||||
/* for some reason moving this earlier confuses gcc on solaris */
|
/* for some reason moving this earlier confuses gcc on solaris */
|
||||||
H = Hi;
|
HR = Hi;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (tokptr == LOCAL_toktide) {
|
if (tokptr == LOCAL_toktide) {
|
||||||
@ -302,6 +302,7 @@ syntax_error (TokEntry * tokptr, IOSTREAM *st, Term *outp)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QuasiQuotes_tok:
|
case QuasiQuotes_tok:
|
||||||
|
case WQuasiQuotes_tok:
|
||||||
{
|
{
|
||||||
if (has_qq) {
|
if (has_qq) {
|
||||||
Term t0[1];
|
Term t0[1];
|
||||||
@ -372,7 +373,7 @@ syntax_error (TokEntry * tokptr, IOSTREAM *st, Term *outp)
|
|||||||
}
|
}
|
||||||
/* now we can throw away tokens, so we can unify and possibly overwrite TR */
|
/* now we can throw away tokens, so we can unify and possibly overwrite TR */
|
||||||
Yap_unify(*outp, MkVarTerm());
|
Yap_unify(*outp, MkVarTerm());
|
||||||
if (IsVarTerm(*outp) && (VarOfTerm(*outp) > H || VarOfTerm(*outp) < H0)) {
|
if (IsVarTerm(*outp) && (VarOfTerm(*outp) > HR || VarOfTerm(*outp) < H0)) {
|
||||||
tf[0] = Yap_MkNewApplTerm(Yap_MkFunctor(AtomRead,1),1);
|
tf[0] = Yap_MkNewApplTerm(Yap_MkFunctor(AtomRead,1),1);
|
||||||
} else {
|
} else {
|
||||||
tf[0] = Yap_MkApplTerm(Yap_MkFunctor(AtomRead,1),1,outp);
|
tf[0] = Yap_MkApplTerm(Yap_MkFunctor(AtomRead,1),1,outp);
|
||||||
@ -501,12 +502,12 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
}
|
}
|
||||||
/* Scans the term using stack space */
|
/* Scans the term using stack space */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
old_H = H;
|
old_H = HR;
|
||||||
LOCAL_Comments = TermNil;
|
LOCAL_Comments = TermNil;
|
||||||
LOCAL_CommentsNextChar = LOCAL_CommentsTail = NULL;
|
LOCAL_CommentsNextChar = LOCAL_CommentsTail = NULL;
|
||||||
tokstart = LOCAL_tokptr = LOCAL_toktide = Yap_tokenizer(inp_stream, store_comments, &tpos, rd);
|
tokstart = LOCAL_tokptr = LOCAL_toktide = Yap_tokenizer(inp_stream, store_comments, &tpos, rd);
|
||||||
if (LOCAL_Error_TYPE != YAP_NO_ERROR && seekable) {
|
if (LOCAL_Error_TYPE != YAP_NO_ERROR && seekable) {
|
||||||
H = old_H;
|
HR = old_H;
|
||||||
Yap_clean_tokenizer(tokstart, LOCAL_VarTable, LOCAL_AnonVarTable, LOCAL_Comments);
|
Yap_clean_tokenizer(tokstart, LOCAL_VarTable, LOCAL_AnonVarTable, LOCAL_Comments);
|
||||||
if (seekable) {
|
if (seekable) {
|
||||||
Sseek64(inp_stream, cpos, SIO_SEEK_SET);
|
Sseek64(inp_stream, cpos, SIO_SEEK_SET);
|
||||||
@ -540,7 +541,7 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||||
/* preserve value of H after scanning: otherwise we may lose strings
|
/* preserve value of H after scanning: otherwise we may lose strings
|
||||||
and floats */
|
and floats */
|
||||||
old_H = H;
|
old_H = HR;
|
||||||
if (tokstart != NULL && tokstart->Tok == Ord (eot_tok)) {
|
if (tokstart != NULL && tokstart->Tok == Ord (eot_tok)) {
|
||||||
/* did we get the end of file from an abort? */
|
/* did we get the end of file from an abort? */
|
||||||
if (LOCAL_ErrorMessage &&
|
if (LOCAL_ErrorMessage &&
|
||||||
@ -567,7 +568,7 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
tr_fr_ptr old_TR = TR;
|
tr_fr_ptr old_TR = TR;
|
||||||
|
|
||||||
|
|
||||||
H = old_H;
|
HR = old_H;
|
||||||
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
||||||
|
|
||||||
if (!strcmp(LOCAL_ErrorMessage,"Stack Overflow"))
|
if (!strcmp(LOCAL_ErrorMessage,"Stack Overflow"))
|
||||||
@ -579,7 +580,7 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
if (res) {
|
if (res) {
|
||||||
LOCAL_ScannerStack = (char *)TR;
|
LOCAL_ScannerStack = (char *)TR;
|
||||||
TR = old_TR;
|
TR = old_TR;
|
||||||
old_H = H;
|
old_H = HR;
|
||||||
LOCAL_tokptr = LOCAL_toktide = tokstart;
|
LOCAL_tokptr = LOCAL_toktide = tokstart;
|
||||||
LOCAL_ErrorMessage = NULL;
|
LOCAL_ErrorMessage = NULL;
|
||||||
goto repeat_cycle;
|
goto repeat_cycle;
|
||||||
@ -611,7 +612,7 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
if (rd->varnames) {
|
if (rd->varnames) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
CELL *old_H = H;
|
CELL *old_H = HR;
|
||||||
|
|
||||||
if (setjmp(LOCAL_IOBotch) == 0) {
|
if (setjmp(LOCAL_IOBotch) == 0) {
|
||||||
v = Yap_VarNames(LOCAL_VarTable, TermNil);
|
v = Yap_VarNames(LOCAL_VarTable, TermNil);
|
||||||
@ -622,7 +623,7 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
|
|
||||||
old_TR = TR;
|
old_TR = TR;
|
||||||
/* restart global */
|
/* restart global */
|
||||||
H = old_H;
|
HR = old_H;
|
||||||
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
||||||
Yap_growstack_in_parser(&old_TR, &tokstart, &LOCAL_VarTable);
|
Yap_growstack_in_parser(&old_TR, &tokstart, &LOCAL_VarTable);
|
||||||
LOCAL_ScannerStack = (char *)TR;
|
LOCAL_ScannerStack = (char *)TR;
|
||||||
@ -636,7 +637,7 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
|
|
||||||
if (rd->variables) {
|
if (rd->variables) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
CELL *old_H = H;
|
CELL *old_H = HR;
|
||||||
|
|
||||||
if (setjmp(LOCAL_IOBotch) == 0) {
|
if (setjmp(LOCAL_IOBotch) == 0) {
|
||||||
v = Yap_Variables(LOCAL_VarTable, TermNil);
|
v = Yap_Variables(LOCAL_VarTable, TermNil);
|
||||||
@ -647,7 +648,7 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
|
|
||||||
old_TR = TR;
|
old_TR = TR;
|
||||||
/* restart global */
|
/* restart global */
|
||||||
H = old_H;
|
HR = old_H;
|
||||||
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
||||||
Yap_growstack_in_parser(&old_TR, &tokstart, &LOCAL_VarTable);
|
Yap_growstack_in_parser(&old_TR, &tokstart, &LOCAL_VarTable);
|
||||||
LOCAL_ScannerStack = (char *)TR;
|
LOCAL_ScannerStack = (char *)TR;
|
||||||
@ -659,7 +660,7 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
}
|
}
|
||||||
if (rd->singles) {
|
if (rd->singles) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
CELL *old_H = H;
|
CELL *old_H = HR;
|
||||||
|
|
||||||
if (setjmp(LOCAL_IOBotch) == 0) {
|
if (setjmp(LOCAL_IOBotch) == 0) {
|
||||||
v = Yap_Singletons(LOCAL_VarTable, TermNil);
|
v = Yap_Singletons(LOCAL_VarTable, TermNil);
|
||||||
@ -670,7 +671,7 @@ Yap_read_term(term_t t0, IOSTREAM *inp_stream, struct read_data_t *rd)
|
|||||||
|
|
||||||
old_TR = TR;
|
old_TR = TR;
|
||||||
/* restart global */
|
/* restart global */
|
||||||
H = old_H;
|
HR = old_H;
|
||||||
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
TR = (tr_fr_ptr)LOCAL_ScannerStack;
|
||||||
Yap_growstack_in_parser(&old_TR, &tokstart, &LOCAL_VarTable);
|
Yap_growstack_in_parser(&old_TR, &tokstart, &LOCAL_VarTable);
|
||||||
LOCAL_ScannerStack = (char *)TR;
|
LOCAL_ScannerStack = (char *)TR;
|
||||||
|
26
C/mavar.c
26
C/mavar.c
@ -36,7 +36,7 @@ p_setarg( USES_REGS1 )
|
|||||||
Int i;
|
Int i;
|
||||||
|
|
||||||
if (IsVarTerm(t3) &&
|
if (IsVarTerm(t3) &&
|
||||||
VarOfTerm(t3) > H &&VarOfTerm(t3) < ASP) {
|
VarOfTerm(t3) > HR &&VarOfTerm(t3) < ASP) {
|
||||||
/* local variable */
|
/* local variable */
|
||||||
Term tn = MkVarTerm();
|
Term tn = MkVarTerm();
|
||||||
Bind_Local(VarOfTerm(t3), tn);
|
Bind_Local(VarOfTerm(t3), tn);
|
||||||
@ -124,17 +124,17 @@ NewTimedVar(CELL val USES_REGS)
|
|||||||
Term out;
|
Term out;
|
||||||
timed_var *tv;
|
timed_var *tv;
|
||||||
if (IsVarTerm(val) &&
|
if (IsVarTerm(val) &&
|
||||||
VarOfTerm(val) > H) {
|
VarOfTerm(val) > HR) {
|
||||||
Term nval = MkVarTerm();
|
Term nval = MkVarTerm();
|
||||||
Bind_Local(VarOfTerm(val), nval);
|
Bind_Local(VarOfTerm(val), nval);
|
||||||
val = nval;
|
val = nval;
|
||||||
}
|
}
|
||||||
out = AbsAppl(H);
|
out = AbsAppl(HR);
|
||||||
*H++ = (CELL)FunctorMutable;
|
*HR++ = (CELL)FunctorMutable;
|
||||||
tv = (timed_var *)H;
|
tv = (timed_var *)HR;
|
||||||
RESET_VARIABLE(&(tv->clock));
|
RESET_VARIABLE(&(tv->clock));
|
||||||
tv->value = val;
|
tv->value = val;
|
||||||
H += sizeof(timed_var)/sizeof(CELL);
|
HR += sizeof(timed_var)/sizeof(CELL);
|
||||||
return(out);
|
return(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,13 +149,13 @@ Term
|
|||||||
Yap_NewEmptyTimedVar( void )
|
Yap_NewEmptyTimedVar( void )
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Term out = AbsAppl(H);
|
Term out = AbsAppl(HR);
|
||||||
timed_var *tv;
|
timed_var *tv;
|
||||||
*H++ = (CELL)FunctorMutable;
|
*HR++ = (CELL)FunctorMutable;
|
||||||
tv = (timed_var *)H;
|
tv = (timed_var *)HR;
|
||||||
RESET_VARIABLE(&(tv->clock));
|
RESET_VARIABLE(&(tv->clock));
|
||||||
RESET_VARIABLE(&(tv->value));
|
RESET_VARIABLE(&(tv->value));
|
||||||
H += sizeof(timed_var)/sizeof(CELL);
|
HR += sizeof(timed_var)/sizeof(CELL);
|
||||||
return(out);
|
return(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ UpdateTimedVar(Term inv, Term new USES_REGS)
|
|||||||
CELL t = tv->value;
|
CELL t = tv->value;
|
||||||
CELL* timestmp = (CELL *)(tv->clock);
|
CELL* timestmp = (CELL *)(tv->clock);
|
||||||
if (IsVarTerm(new) &&
|
if (IsVarTerm(new) &&
|
||||||
VarOfTerm(new) > H) {
|
VarOfTerm(new) > HR) {
|
||||||
Term nnew = MkVarTerm();
|
Term nnew = MkVarTerm();
|
||||||
Bind_Local(VarOfTerm(new), nnew);
|
Bind_Local(VarOfTerm(new), nnew);
|
||||||
new = nnew;
|
new = nnew;
|
||||||
@ -200,9 +200,9 @@ UpdateTimedVar(Term inv, Term new USES_REGS)
|
|||||||
#endif
|
#endif
|
||||||
tv->value = new;
|
tv->value = new;
|
||||||
} else {
|
} else {
|
||||||
Term nclock = (Term)H;
|
Term nclock = (Term)HR;
|
||||||
MaBind(&(tv->value), new);
|
MaBind(&(tv->value), new);
|
||||||
*H++ = TermFoundVar;
|
*HR++ = TermFoundVar;
|
||||||
MaBind(&(tv->clock), nclock);
|
MaBind(&(tv->clock), nclock);
|
||||||
}
|
}
|
||||||
return(t);
|
return(t);
|
||||||
|
30
C/other.c
30
C/other.c
@ -52,11 +52,11 @@ Term
|
|||||||
Yap_MkNewPairTerm(void)
|
Yap_MkNewPairTerm(void)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
register CELL *p = H;
|
register CELL *p = HR;
|
||||||
|
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
RESET_VARIABLE(H+1);
|
RESET_VARIABLE(HR+1);
|
||||||
H+=2;
|
HR+=2;
|
||||||
return (AbsPair(p));
|
return (AbsPair(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,15 +66,15 @@ Yap_MkApplTerm(Functor f, unsigned int n, register Term *a)
|
|||||||
* args a */
|
* args a */
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
CELL *t = H;
|
CELL *t = HR;
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return (MkAtomTerm(NameOfFunctor(f)));
|
return (MkAtomTerm(NameOfFunctor(f)));
|
||||||
if (f == FunctorList)
|
if (f == FunctorList)
|
||||||
return MkPairTerm(a[0], a[1]);
|
return MkPairTerm(a[0], a[1]);
|
||||||
*H++ = (CELL) f;
|
*HR++ = (CELL) f;
|
||||||
while (n--)
|
while (n--)
|
||||||
*H++ = (CELL) * a++;
|
*HR++ = (CELL) * a++;
|
||||||
return (AbsAppl(t));
|
return (AbsAppl(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,20 +84,20 @@ Yap_MkNewApplTerm(Functor f, unsigned int n)
|
|||||||
* args a */
|
* args a */
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
CELL *t = H;
|
CELL *t = HR;
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return (MkAtomTerm(NameOfFunctor(f)));
|
return (MkAtomTerm(NameOfFunctor(f)));
|
||||||
if (f == FunctorList) {
|
if (f == FunctorList) {
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
RESET_VARIABLE(H+1);
|
RESET_VARIABLE(HR+1);
|
||||||
H+=2;
|
HR+=2;
|
||||||
return (AbsPair(t));
|
return (AbsPair(t));
|
||||||
}
|
}
|
||||||
*H++ = (CELL) f;
|
*HR++ = (CELL) f;
|
||||||
while (n--) {
|
while (n--) {
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
H++;
|
HR++;
|
||||||
}
|
}
|
||||||
return (AbsAppl(t));
|
return (AbsAppl(t));
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ Yap_Globalise(Term t)
|
|||||||
if (!IsVarTerm(t))
|
if (!IsVarTerm(t))
|
||||||
return t;
|
return t;
|
||||||
vt = VarOfTerm(t);
|
vt = VarOfTerm(t);
|
||||||
if (vt <= H && vt > H0)
|
if (vt <= HR && vt > H0)
|
||||||
return t;
|
return t;
|
||||||
tn = MkVarTerm();
|
tn = MkVarTerm();
|
||||||
Yap_unify(t, tn);
|
Yap_unify(t, tn);
|
||||||
|
42
C/parser.c
42
C/parser.c
@ -83,7 +83,7 @@ static Term ParseTerm(read_data *, int, JMPBUFF * CACHE_TYPE);
|
|||||||
#define TRY(S,P) \
|
#define TRY(S,P) \
|
||||||
{ Volatile JMPBUFF *saveenv, newenv; \
|
{ Volatile JMPBUFF *saveenv, newenv; \
|
||||||
Volatile TokEntry *saveT=LOCAL_tokptr; \
|
Volatile TokEntry *saveT=LOCAL_tokptr; \
|
||||||
Volatile CELL *saveH=H; \
|
Volatile CELL *saveH=HR; \
|
||||||
Volatile int savecurprio=curprio; \
|
Volatile int savecurprio=curprio; \
|
||||||
saveenv=FailBuff; \
|
saveenv=FailBuff; \
|
||||||
if(!sigsetjmp(newenv.JmpBuff, 0)) { \
|
if(!sigsetjmp(newenv.JmpBuff, 0)) { \
|
||||||
@ -93,7 +93,7 @@ static Term ParseTerm(read_data *, int, JMPBUFF * CACHE_TYPE);
|
|||||||
P; \
|
P; \
|
||||||
} \
|
} \
|
||||||
else { FailBuff=saveenv; \
|
else { FailBuff=saveenv; \
|
||||||
H=saveH; \
|
HR=saveH; \
|
||||||
curprio = savecurprio; \
|
curprio = savecurprio; \
|
||||||
LOCAL_tokptr=saveT; \
|
LOCAL_tokptr=saveT; \
|
||||||
} \
|
} \
|
||||||
@ -102,7 +102,7 @@ static Term ParseTerm(read_data *, int, JMPBUFF * CACHE_TYPE);
|
|||||||
#define TRY3(S,P,F) \
|
#define TRY3(S,P,F) \
|
||||||
{ Volatile JMPBUFF *saveenv, newenv; \
|
{ Volatile JMPBUFF *saveenv, newenv; \
|
||||||
Volatile TokEntry *saveT=LOCAL_tokptr; \
|
Volatile TokEntry *saveT=LOCAL_tokptr; \
|
||||||
Volatile CELL *saveH=H; \
|
Volatile CELL *saveH=HR; \
|
||||||
saveenv=FailBuff; \
|
saveenv=FailBuff; \
|
||||||
if(!sigsetjmp(newenv.JmpBuff, 0)) { \
|
if(!sigsetjmp(newenv.JmpBuff, 0)) { \
|
||||||
FailBuff = &newenv; \
|
FailBuff = &newenv; \
|
||||||
@ -112,7 +112,7 @@ static Term ParseTerm(read_data *, int, JMPBUFF * CACHE_TYPE);
|
|||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
FailBuff=saveenv; \
|
FailBuff=saveenv; \
|
||||||
H=saveH; \
|
HR=saveH; \
|
||||||
LOCAL_tokptr=saveT; \
|
LOCAL_tokptr=saveT; \
|
||||||
F } \
|
F } \
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ VarNames(VarEntry *p,Term l USES_REGS)
|
|||||||
o = Yap_MkApplTerm(FunctorEq, 2, t);
|
o = Yap_MkApplTerm(FunctorEq, 2, t);
|
||||||
o = MkPairTerm(o, VarNames(p->VarRight,
|
o = MkPairTerm(o, VarNames(p->VarRight,
|
||||||
VarNames(p->VarLeft,l PASS_REGS) PASS_REGS));
|
VarNames(p->VarLeft,l PASS_REGS) PASS_REGS));
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(LOCAL_IOBotch,1);
|
siglongjmp(LOCAL_IOBotch,1);
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ Singletons(VarEntry *p,Term l USES_REGS)
|
|||||||
o = Yap_MkApplTerm(FunctorEq, 2, t);
|
o = Yap_MkApplTerm(FunctorEq, 2, t);
|
||||||
o = MkPairTerm(o, Singletons(p->VarRight,
|
o = MkPairTerm(o, Singletons(p->VarRight,
|
||||||
Singletons(p->VarLeft,l PASS_REGS) PASS_REGS));
|
Singletons(p->VarLeft,l PASS_REGS) PASS_REGS));
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(LOCAL_IOBotch,1);
|
siglongjmp(LOCAL_IOBotch,1);
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ Variables(VarEntry *p,Term l USES_REGS)
|
|||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
Term o;
|
Term o;
|
||||||
o = MkPairTerm(p->VarAdr, Variables(p->VarRight,Variables(p->VarLeft,l PASS_REGS) PASS_REGS));
|
o = MkPairTerm(p->VarAdr, Variables(p->VarRight,Variables(p->VarLeft,l PASS_REGS) PASS_REGS));
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
siglongjmp(LOCAL_IOBotch,1);
|
siglongjmp(LOCAL_IOBotch,1);
|
||||||
}
|
}
|
||||||
@ -472,7 +472,7 @@ ParseArgs(read_data *rd, Atom a, wchar_t close, JMPBUFF *FailBuff, Term arg1 USE
|
|||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
t = Yap_MkApplTerm(func, nargs, p);
|
t = Yap_MkApplTerm(func, nargs, p);
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
@ -500,7 +500,7 @@ ParseArgs(read_data *rd, Atom a, wchar_t close, JMPBUFF *FailBuff, Term arg1 USE
|
|||||||
* Needed because the arguments for the functor are placed in reverse
|
* Needed because the arguments for the functor are placed in reverse
|
||||||
* order
|
* order
|
||||||
*/
|
*/
|
||||||
if (H > ASP-(nargs+1)) {
|
if (HR > ASP-(nargs+1)) {
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ ParseArgs(read_data *rd, Atom a, wchar_t close, JMPBUFF *FailBuff, Term arg1 USE
|
|||||||
else
|
else
|
||||||
t = Yap_MkApplTerm(func, nargs, p);
|
t = Yap_MkApplTerm(func, nargs, p);
|
||||||
#endif
|
#endif
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
@ -547,10 +547,10 @@ ParseList(read_data *rd, JMPBUFF *FailBuff USES_REGS)
|
|||||||
{
|
{
|
||||||
Term o;
|
Term o;
|
||||||
CELL *to_store;
|
CELL *to_store;
|
||||||
o = AbsPair(H);
|
o = AbsPair(HR);
|
||||||
loop:
|
loop:
|
||||||
to_store = H;
|
to_store = HR;
|
||||||
H+=2;
|
HR+=2;
|
||||||
to_store[0] = ParseTerm(rd, 999, FailBuff PASS_REGS);
|
to_store[0] = ParseTerm(rd, 999, FailBuff PASS_REGS);
|
||||||
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok)) {
|
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok)) {
|
||||||
if (((int) LOCAL_tokptr->TokInfo) == ',') {
|
if (((int) LOCAL_tokptr->TokInfo) == ',') {
|
||||||
@ -561,12 +561,12 @@ ParseList(read_data *rd, JMPBUFF *FailBuff USES_REGS)
|
|||||||
to_store[1] = ParseTerm(rd, 999, FailBuff PASS_REGS);
|
to_store[1] = ParseTerm(rd, 999, FailBuff PASS_REGS);
|
||||||
} else {
|
} else {
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
to_store[1] = TermNil;
|
to_store[1] = TermNil;
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
FAIL;
|
FAIL;
|
||||||
} else {
|
} else {
|
||||||
to_store[1] = AbsPair(H);
|
to_store[1] = AbsPair(HR);
|
||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -664,7 +664,7 @@ ParseTerm(read_data *rd, int prio, JMPBUFF *FailBuff USES_REGS)
|
|||||||
t = ParseTerm(rd, oprprio, FailBuff PASS_REGS);
|
t = ParseTerm(rd, oprprio, FailBuff PASS_REGS);
|
||||||
t = Yap_MkApplTerm(func, 1, &t);
|
t = Yap_MkApplTerm(func, 1, &t);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
@ -749,7 +749,7 @@ ParseTerm(read_data *rd, int prio, JMPBUFF *FailBuff USES_REGS)
|
|||||||
t = ParseTerm(rd, 1200, FailBuff PASS_REGS);
|
t = ParseTerm(rd, 1200, FailBuff PASS_REGS);
|
||||||
t = Yap_MkApplTerm(FunctorBraces, 1, &t);
|
t = Yap_MkApplTerm(FunctorBraces, 1, &t);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
@ -860,7 +860,7 @@ ParseTerm(read_data *rd, int prio, JMPBUFF *FailBuff USES_REGS)
|
|||||||
args[1] = ParseTerm(rd, oprprio, FailBuff PASS_REGS);
|
args[1] = ParseTerm(rd, oprprio, FailBuff PASS_REGS);
|
||||||
t = Yap_MkApplTerm(func, 2, args);
|
t = Yap_MkApplTerm(func, 2, args);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
@ -883,7 +883,7 @@ ParseTerm(read_data *rd, int prio, JMPBUFF *FailBuff USES_REGS)
|
|||||||
}
|
}
|
||||||
t = Yap_MkApplTerm(func, 1, &t);
|
t = Yap_MkApplTerm(func, 1, &t);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
@ -902,7 +902,7 @@ ParseTerm(read_data *rd, int prio, JMPBUFF *FailBuff USES_REGS)
|
|||||||
args[1] = ParseTerm(rd, 1000, FailBuff PASS_REGS);
|
args[1] = ParseTerm(rd, 1000, FailBuff PASS_REGS);
|
||||||
t = Yap_MkApplTerm(FunctorComma, 2, args);
|
t = Yap_MkApplTerm(FunctorComma, 2, args);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
@ -917,7 +917,7 @@ ParseTerm(read_data *rd, int prio, JMPBUFF *FailBuff USES_REGS)
|
|||||||
args[1] = ParseTerm(rd, oprprio, FailBuff PASS_REGS);
|
args[1] = ParseTerm(rd, oprprio, FailBuff PASS_REGS);
|
||||||
t = Yap_MkApplTerm(FunctorVBar, 2, args);
|
t = Yap_MkApplTerm(FunctorVBar, 2, args);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (H > ASP-4096) {
|
if (HR > ASP-4096) {
|
||||||
LOCAL_ErrorMessage = "Stack Overflow";
|
LOCAL_ErrorMessage = "Stack Overflow";
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
|
18
C/save.c
18
C/save.c
@ -369,7 +369,7 @@ put_info(int info, int mode USES_REGS)
|
|||||||
if (putout(Unsigned(LCL0)-Unsigned(ASP)) < 0)
|
if (putout(Unsigned(LCL0)-Unsigned(ASP)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
/* Space used for global stack */
|
/* Space used for global stack */
|
||||||
if (putout(Unsigned(H) - Unsigned(LOCAL_GlobalBase)) < 0)
|
if (putout(Unsigned(HR) - Unsigned(LOCAL_GlobalBase)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
/* Space used for trail */
|
/* Space used for trail */
|
||||||
if (putout(Unsigned(TR) - Unsigned(LOCAL_TrailBase)) < 0)
|
if (putout(Unsigned(TR) - Unsigned(LOCAL_TrailBase)) < 0)
|
||||||
@ -396,7 +396,7 @@ save_regs(int mode USES_REGS)
|
|||||||
return -1;
|
return -1;
|
||||||
if (putcellptr(LCL0) < 0)
|
if (putcellptr(LCL0) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (putcellptr(H) < 0)
|
if (putcellptr(HR) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (putcellptr(HB) < 0)
|
if (putcellptr(HB) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -535,7 +535,7 @@ save_stacks(int mode USES_REGS)
|
|||||||
if (mywrite(splfild, (char *) ASP, j) < 0)
|
if (mywrite(splfild, (char *) ASP, j) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
/* Save the global stack */
|
/* Save the global stack */
|
||||||
j = Unsigned(H) - Unsigned(LOCAL_GlobalBase);
|
j = Unsigned(HR) - Unsigned(LOCAL_GlobalBase);
|
||||||
if (mywrite(splfild, (char *) LOCAL_GlobalBase, j) < 0)
|
if (mywrite(splfild, (char *) LOCAL_GlobalBase, j) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
/* Save the trail */
|
/* Save the trail */
|
||||||
@ -834,7 +834,7 @@ get_regs(int flag USES_REGS)
|
|||||||
LCL0 = get_cellptr();
|
LCL0 = get_cellptr();
|
||||||
if (LOCAL_ErrorMessage)
|
if (LOCAL_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
H = get_cellptr();
|
HR = get_cellptr();
|
||||||
if (LOCAL_ErrorMessage)
|
if (LOCAL_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
HB = get_cellptr();
|
HB = get_cellptr();
|
||||||
@ -929,7 +929,7 @@ get_regs(int flag USES_REGS)
|
|||||||
LOCAL_OldASP = ASP;
|
LOCAL_OldASP = ASP;
|
||||||
LOCAL_OldLCL0 = LCL0;
|
LOCAL_OldLCL0 = LCL0;
|
||||||
LOCAL_OldGlobalBase = (CELL *)LOCAL_GlobalBase;
|
LOCAL_OldGlobalBase = (CELL *)LOCAL_GlobalBase;
|
||||||
LOCAL_OldH = H;
|
LOCAL_OldH = HR;
|
||||||
LOCAL_OldTR = TR;
|
LOCAL_OldTR = TR;
|
||||||
LOCAL_GDiff = Unsigned(NewGlobalBase) - Unsigned(LOCAL_GlobalBase);
|
LOCAL_GDiff = Unsigned(NewGlobalBase) - Unsigned(LOCAL_GlobalBase);
|
||||||
LOCAL_GDiff0 = 0;
|
LOCAL_GDiff0 = 0;
|
||||||
@ -977,7 +977,7 @@ CopyStacks( USES_REGS1 )
|
|||||||
NewASP = (char *) (Unsigned(ASP) + (Unsigned(LCL0) - Unsigned(LOCAL_OldLCL0)));
|
NewASP = (char *) (Unsigned(ASP) + (Unsigned(LCL0) - Unsigned(LOCAL_OldLCL0)));
|
||||||
if (myread(splfild, (char *) NewASP, j) < 0)
|
if (myread(splfild, (char *) NewASP, j) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
j = Unsigned(H) - Unsigned(LOCAL_OldGlobalBase);
|
j = Unsigned(HR) - Unsigned(LOCAL_OldGlobalBase);
|
||||||
if (myread(splfild, (char *) LOCAL_GlobalBase, j) < 0)
|
if (myread(splfild, (char *) LOCAL_GlobalBase, j) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
j = Unsigned(TR) - Unsigned(LOCAL_OldTrailBase);
|
j = Unsigned(TR) - Unsigned(LOCAL_OldTrailBase);
|
||||||
@ -1060,7 +1060,7 @@ restore_regs(int flag USES_REGS)
|
|||||||
CP = PtoOpAdjust(CP);
|
CP = PtoOpAdjust(CP);
|
||||||
ENV = PtoLocAdjust(ENV);
|
ENV = PtoLocAdjust(ENV);
|
||||||
ASP = PtoLocAdjust(ASP);
|
ASP = PtoLocAdjust(ASP);
|
||||||
H = PtoGloAdjust(H);
|
HR = PtoGloAdjust(HR);
|
||||||
B = (choiceptr)PtoLocAdjust(CellPtr(B));
|
B = (choiceptr)PtoLocAdjust(CellPtr(B));
|
||||||
TR = PtoTRAdjust(TR);
|
TR = PtoTRAdjust(TR);
|
||||||
P = PtoOpAdjust(P);
|
P = PtoOpAdjust(P);
|
||||||
@ -1149,8 +1149,8 @@ rehash(CELL *oldcode, int NOfE, int KindOfEntries USES_REGS)
|
|||||||
|
|
||||||
if (LOCAL_HDiff == 0)
|
if (LOCAL_HDiff == 0)
|
||||||
return;
|
return;
|
||||||
basep = H;
|
basep = HR;
|
||||||
if (H + (NOfE*2) > ASP) {
|
if (HR + (NOfE*2) > ASP) {
|
||||||
basep = (CELL *)TR;
|
basep = (CELL *)TR;
|
||||||
if (basep + (NOfE*2) > (CELL *)LOCAL_TrailTop) {
|
if (basep + (NOfE*2) > (CELL *)LOCAL_TrailTop) {
|
||||||
if (!Yap_growtrail((ADDR)(basep + (NOfE*2))-LOCAL_TrailTop, TRUE)) {
|
if (!Yap_growtrail((ADDR)(basep + (NOfE*2))-LOCAL_TrailTop, TRUE)) {
|
||||||
|
12
C/scanner.c
12
C/scanner.c
@ -631,22 +631,18 @@ get_num(int *chp, int *chbuffp, IOSTREAM *inp_stream, char *s, UInt max_size, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ch == 'e' || ch == 'E') {
|
if (ch == 'e' || ch == 'E') {
|
||||||
char cbuff = ch;
|
|
||||||
|
|
||||||
if (--max_size == 0) {
|
if (--max_size == 0) {
|
||||||
return num_send_error_message("Number Too Long");
|
return num_send_error_message("Number Too Long");
|
||||||
}
|
}
|
||||||
*sp++ = ch;
|
*sp++ = ch;
|
||||||
ch = getchr(inp_stream);
|
ch = getchr(inp_stream);
|
||||||
if (ch == '-') {
|
if (ch == '-') {
|
||||||
cbuff = '-';
|
|
||||||
if (--max_size == 0) {
|
if (--max_size == 0) {
|
||||||
return num_send_error_message("Number Too Long");
|
return num_send_error_message("Number Too Long");
|
||||||
}
|
}
|
||||||
*sp++ = '-';
|
*sp++ = '-';
|
||||||
ch = getchr(inp_stream);
|
ch = getchr(inp_stream);
|
||||||
} else if (ch == '+') {
|
} else if (ch == '+') {
|
||||||
cbuff = '+';
|
|
||||||
ch = getchr(inp_stream);
|
ch = getchr(inp_stream);
|
||||||
}
|
}
|
||||||
if (chtype(ch) != NU) {
|
if (chtype(ch) != NU) {
|
||||||
@ -719,7 +715,7 @@ Yap_scan_num(IOSTREAM *inp)
|
|||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
cherr = '\0';
|
cherr = '\0';
|
||||||
if (ASP-H < 1024)
|
if (ASP-HR < 1024)
|
||||||
return TermNil;
|
return TermNil;
|
||||||
out = get_num(&ch, &cherr, inp, ptr, 4096, sign); /* */
|
out = get_num(&ch, &cherr, inp, ptr, 4096, sign); /* */
|
||||||
PopScannerMemory(ptr, 4096);
|
PopScannerMemory(ptr, 4096);
|
||||||
@ -731,7 +727,7 @@ Yap_scan_num(IOSTREAM *inp)
|
|||||||
|
|
||||||
|
|
||||||
#define CHECK_SPACE() \
|
#define CHECK_SPACE() \
|
||||||
if (ASP-H < 1024) { \
|
if (ASP-HR < 1024) { \
|
||||||
LOCAL_ErrorMessage = "Stack Overflow"; \
|
LOCAL_ErrorMessage = "Stack Overflow"; \
|
||||||
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR; \
|
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR; \
|
||||||
LOCAL_Error_Size = 0L; \
|
LOCAL_Error_Size = 0L; \
|
||||||
@ -744,8 +740,8 @@ Yap_scan_num(IOSTREAM *inp)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
open_comment(int ch, IOSTREAM *inp_stream USES_REGS) {
|
open_comment(int ch, IOSTREAM *inp_stream USES_REGS) {
|
||||||
CELL *h0 = H;
|
CELL *h0 = HR;
|
||||||
H += 5;
|
HR += 5;
|
||||||
h0[0] = AbsAppl(h0+2);
|
h0[0] = AbsAppl(h0+2);
|
||||||
h0[1] = TermNil;
|
h0[1] = TermNil;
|
||||||
if (!LOCAL_CommentsTail) {
|
if (!LOCAL_CommentsTail) {
|
||||||
|
24
C/sort.c
24
C/sort.c
@ -58,12 +58,12 @@ build_new_list(CELL *pt, Term t USES_REGS)
|
|||||||
}
|
}
|
||||||
pt += 2;
|
pt += 2;
|
||||||
if (pt > ASP - 4096) {
|
if (pt > ASP - 4096) {
|
||||||
if (!Yap_gcl((ASP-H)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl((ASP-HR)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
t = Deref(ARG1);
|
t = Deref(ARG1);
|
||||||
pt = H;
|
pt = HR;
|
||||||
out = 0;
|
out = 0;
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ static Int
|
|||||||
p_sort( USES_REGS1 )
|
p_sort( USES_REGS1 )
|
||||||
{
|
{
|
||||||
/* use the heap to build a new list */
|
/* use the heap to build a new list */
|
||||||
CELL *pt = H;
|
CELL *pt = HR;
|
||||||
Term out;
|
Term out;
|
||||||
/* list size */
|
/* list size */
|
||||||
Int size;
|
Int size;
|
||||||
@ -355,13 +355,13 @@ p_sort( USES_REGS1 )
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
if (size < 2)
|
if (size < 2)
|
||||||
return(Yap_unify(ARG1, ARG2));
|
return(Yap_unify(ARG1, ARG2));
|
||||||
pt = H; /* because of possible garbage collection */
|
pt = HR; /* because of possible garbage collection */
|
||||||
/* make sure no one writes on our temp data structure */
|
/* make sure no one writes on our temp data structure */
|
||||||
H += size*2;
|
HR += size*2;
|
||||||
/* reserve the necessary space */
|
/* reserve the necessary space */
|
||||||
size = compact_mergesort(pt, size, M_EVEN);
|
size = compact_mergesort(pt, size, M_EVEN);
|
||||||
/* reajust space */
|
/* reajust space */
|
||||||
H = pt+size*2;
|
HR = pt+size*2;
|
||||||
adjust_vector(pt, size);
|
adjust_vector(pt, size);
|
||||||
out = AbsPair(pt);
|
out = AbsPair(pt);
|
||||||
return(Yap_unify(out, ARG2));
|
return(Yap_unify(out, ARG2));
|
||||||
@ -371,7 +371,7 @@ static Int
|
|||||||
p_msort( USES_REGS1 )
|
p_msort( USES_REGS1 )
|
||||||
{
|
{
|
||||||
/* use the heap to build a new list */
|
/* use the heap to build a new list */
|
||||||
CELL *pt = H;
|
CELL *pt = HR;
|
||||||
Term out;
|
Term out;
|
||||||
/* list size */
|
/* list size */
|
||||||
Int size;
|
Int size;
|
||||||
@ -380,9 +380,9 @@ p_msort( USES_REGS1 )
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
if (size < 2)
|
if (size < 2)
|
||||||
return(Yap_unify(ARG1, ARG2));
|
return(Yap_unify(ARG1, ARG2));
|
||||||
pt = H; /* because of possible garbage collection */
|
pt = HR; /* because of possible garbage collection */
|
||||||
/* reserve the necessary space */
|
/* reserve the necessary space */
|
||||||
H += size*2;
|
HR += size*2;
|
||||||
simple_mergesort(pt, size, M_EVEN);
|
simple_mergesort(pt, size, M_EVEN);
|
||||||
adjust_vector(pt, size);
|
adjust_vector(pt, size);
|
||||||
out = AbsPair(pt);
|
out = AbsPair(pt);
|
||||||
@ -393,7 +393,7 @@ static Int
|
|||||||
p_ksort( USES_REGS1 )
|
p_ksort( USES_REGS1 )
|
||||||
{
|
{
|
||||||
/* use the heap to build a new list */
|
/* use the heap to build a new list */
|
||||||
CELL *pt = H;
|
CELL *pt = HR;
|
||||||
Term out;
|
Term out;
|
||||||
/* list size */
|
/* list size */
|
||||||
Int size;
|
Int size;
|
||||||
@ -403,8 +403,8 @@ p_ksort( USES_REGS1 )
|
|||||||
if (size < 2)
|
if (size < 2)
|
||||||
return(Yap_unify(ARG1, ARG2));
|
return(Yap_unify(ARG1, ARG2));
|
||||||
/* reserve the necessary space */
|
/* reserve the necessary space */
|
||||||
pt = H; /* because of possible garbage collection */
|
pt = HR; /* because of possible garbage collection */
|
||||||
H += size*2;
|
HR += size*2;
|
||||||
if (!key_mergesort(pt, size, M_EVEN, FunctorMinus))
|
if (!key_mergesort(pt, size, M_EVEN, FunctorMinus))
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
adjust_vector(pt, size);
|
adjust_vector(pt, size);
|
||||||
|
28
C/stdpreds.c
28
C/stdpreds.c
@ -634,15 +634,15 @@ p_univ( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
build_compound:
|
build_compound:
|
||||||
/* build the term directly on the heap */
|
/* build the term directly on the heap */
|
||||||
Ar = H;
|
Ar = HR;
|
||||||
H++;
|
HR++;
|
||||||
|
|
||||||
while (!IsVarTerm(twork) && IsPairTerm(twork)) {
|
while (!IsVarTerm(twork) && IsPairTerm(twork)) {
|
||||||
*H++ = HeadOfTerm(twork);
|
*HR++ = HeadOfTerm(twork);
|
||||||
if (H > ASP - 1024) {
|
if (HR > ASP - 1024) {
|
||||||
/* restore space */
|
/* restore space */
|
||||||
H = Ar;
|
HR = Ar;
|
||||||
if (!Yap_gcl((ASP-H)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl((ASP-HR)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -671,11 +671,11 @@ p_univ( USES_REGS1 )
|
|||||||
arity, CellPtr(TR));
|
arity, CellPtr(TR));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
arity = H-Ar-1;
|
arity = HR-Ar-1;
|
||||||
if (at == AtomDot && arity == 2) {
|
if (at == AtomDot && arity == 2) {
|
||||||
Ar[0] = Ar[1];
|
Ar[0] = Ar[1];
|
||||||
Ar[1] = Ar[2];
|
Ar[1] = Ar[2];
|
||||||
H --;
|
HR --;
|
||||||
twork = AbsPair(Ar);
|
twork = AbsPair(Ar);
|
||||||
} else {
|
} else {
|
||||||
*Ar = (CELL)(Yap_MkFunctor(at, arity));
|
*Ar = (CELL)(Yap_MkFunctor(at, arity));
|
||||||
@ -716,7 +716,7 @@ p_univ( USES_REGS1 )
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
while (H+arity*2 > ASP-1024) {
|
while (HR+arity*2 > ASP-1024) {
|
||||||
if (!Yap_gcl((arity*2)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
if (!Yap_gcl((arity*2)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
@ -1301,7 +1301,7 @@ Yap_show_statistics(void)
|
|||||||
frag);
|
frag);
|
||||||
fprintf(GLOBAL_stderr, "Stack Space: %ld (%ld for Global, %ld for local).\n",
|
fprintf(GLOBAL_stderr, "Stack Space: %ld (%ld for Global, %ld for local).\n",
|
||||||
(unsigned long int)(sizeof(CELL)*(LCL0-H0)),
|
(unsigned long int)(sizeof(CELL)*(LCL0-H0)),
|
||||||
(unsigned long int)(sizeof(CELL)*(H-H0)),
|
(unsigned long int)(sizeof(CELL)*(HR-H0)),
|
||||||
(unsigned long int)(sizeof(CELL)*(LCL0-ASP)));
|
(unsigned long int)(sizeof(CELL)*(LCL0-ASP)));
|
||||||
fprintf(GLOBAL_stderr, "Trail Space: %ld (%ld used).\n",
|
fprintf(GLOBAL_stderr, "Trail Space: %ld (%ld used).\n",
|
||||||
(unsigned long int)(sizeof(tr_fr_ptr)*(Unsigned(LOCAL_TrailTop)-Unsigned(LOCAL_TrailBase))),
|
(unsigned long int)(sizeof(tr_fr_ptr)*(Unsigned(LOCAL_TrailTop)-Unsigned(LOCAL_TrailBase))),
|
||||||
@ -1376,7 +1376,7 @@ GlobalMax(void)
|
|||||||
CELL *pt;
|
CELL *pt;
|
||||||
|
|
||||||
if (GlobalTide != StkWidth) {
|
if (GlobalTide != StkWidth) {
|
||||||
pt = H;
|
pt = HR;
|
||||||
while (pt+2 < ASP) {
|
while (pt+2 < ASP) {
|
||||||
if (pt[0] == 0 &&
|
if (pt[0] == 0 &&
|
||||||
pt[1] == 0 &&
|
pt[1] == 0 &&
|
||||||
@ -1419,7 +1419,7 @@ LocalMax(void)
|
|||||||
|
|
||||||
if (LocalTide != StkWidth) {
|
if (LocalTide != StkWidth) {
|
||||||
pt = LCL0;
|
pt = LCL0;
|
||||||
while (pt-3 > H) {
|
while (pt-3 > HR) {
|
||||||
if (pt[-1] == 0 &&
|
if (pt[-1] == 0 &&
|
||||||
pt[-2] == 0 &&
|
pt[-2] == 0 &&
|
||||||
pt[-3] == 0)
|
pt[-3] == 0)
|
||||||
@ -1427,7 +1427,7 @@ LocalMax(void)
|
|||||||
else
|
else
|
||||||
--pt;
|
--pt;
|
||||||
}
|
}
|
||||||
if (pt-3 > H)
|
if (pt-3 > HR)
|
||||||
i = Unsigned(LCL0) - Unsigned(pt);
|
i = Unsigned(LCL0) - Unsigned(pt);
|
||||||
else
|
else
|
||||||
/* so that both Local and Global have reached maximum width */
|
/* so that both Local and Global have reached maximum width */
|
||||||
@ -1477,7 +1477,7 @@ static Int
|
|||||||
p_statistics_stacks_info( USES_REGS1 )
|
p_statistics_stacks_info( USES_REGS1 )
|
||||||
{
|
{
|
||||||
Term tmax = MkIntegerTerm(Unsigned(LCL0) - Unsigned(H0));
|
Term tmax = MkIntegerTerm(Unsigned(LCL0) - Unsigned(H0));
|
||||||
Term tgusage = MkIntegerTerm(Unsigned(H) - Unsigned(H0));
|
Term tgusage = MkIntegerTerm(Unsigned(HR) - Unsigned(H0));
|
||||||
Term tlusage = MkIntegerTerm(Unsigned(LCL0) - Unsigned(ASP));
|
Term tlusage = MkIntegerTerm(Unsigned(LCL0) - Unsigned(ASP));
|
||||||
|
|
||||||
return(Yap_unify(tmax, ARG1) && Yap_unify(tgusage,ARG2) && Yap_unify(tlusage,ARG3));
|
return(Yap_unify(tmax, ARG1) && Yap_unify(tgusage,ARG2) && Yap_unify(tlusage,ARG3));
|
||||||
|
@ -205,7 +205,6 @@ Yap_InitSysPath(void) {
|
|||||||
strncpy(LOCAL_FileNameBuf, YAP_SHAREDIR, YAP_FILENAME_MAX);
|
strncpy(LOCAL_FileNameBuf, YAP_SHAREDIR, YAP_FILENAME_MAX);
|
||||||
#if _MSC_VER || defined(__MINGW32__)
|
#if _MSC_VER || defined(__MINGW32__)
|
||||||
{
|
{
|
||||||
DWORD fatts;
|
|
||||||
int buflen;
|
int buflen;
|
||||||
char *pt;
|
char *pt;
|
||||||
|
|
||||||
@ -2733,7 +2732,9 @@ set_fpu_exceptions(int flag)
|
|||||||
#if HAVE_FETESTEXCEPT
|
#if HAVE_FETESTEXCEPT
|
||||||
feclearexcept(FE_ALL_EXCEPT);
|
feclearexcept(FE_ALL_EXCEPT);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _WIN32
|
||||||
my_signal (SIGFPE, HandleMatherr);
|
my_signal (SIGFPE, HandleMatherr);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* do IEEE arithmetic in the way the big boys do */
|
/* do IEEE arithmetic in the way the big boys do */
|
||||||
#if defined(__hpux)
|
#if defined(__hpux)
|
||||||
@ -2748,7 +2749,9 @@ set_fpu_exceptions(int flag)
|
|||||||
int v = _FPU_IEEE;
|
int v = _FPU_IEEE;
|
||||||
_FPU_SETCW(v);
|
_FPU_SETCW(v);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _WIN32
|
||||||
my_signal (SIGFPE, SIG_IGN);
|
my_signal (SIGFPE, SIG_IGN);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
95
C/text.c
95
C/text.c
@ -39,7 +39,7 @@ Globalize(Term v USES_REGS)
|
|||||||
if (!IsVarTerm(v = Deref(v))) {
|
if (!IsVarTerm(v = Deref(v))) {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
if (VarOfTerm(v) > H && VarOfTerm(v) < LCL0) {
|
if (VarOfTerm(v) > HR && VarOfTerm(v) < LCL0) {
|
||||||
Bind_Local(VarOfTerm(v), MkVarTerm());
|
Bind_Local(VarOfTerm(v), MkVarTerm());
|
||||||
v = Deref(v);
|
v = Deref(v);
|
||||||
}
|
}
|
||||||
@ -591,7 +591,7 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
|
|||||||
char *cp = s, *buf;
|
char *cp = s, *buf;
|
||||||
|
|
||||||
LOCAL_TERM_ERROR( 2*(lim-s) );
|
LOCAL_TERM_ERROR( 2*(lim-s) );
|
||||||
buf = buf_from_tstring(H);
|
buf = buf_from_tstring(HR);
|
||||||
while (*cp && cp < lim) {
|
while (*cp && cp < lim) {
|
||||||
int chr;
|
int chr;
|
||||||
cp = utf8_get_char(cp, &chr);
|
cp = utf8_get_char(cp, &chr);
|
||||||
@ -614,7 +614,7 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
|
|||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
LOCAL_TERM_ERROR( 2*(lim-s) );
|
LOCAL_TERM_ERROR( 2*(lim-s) );
|
||||||
buf = buf_from_tstring(H);
|
buf = buf_from_tstring(HR);
|
||||||
while (cp < lim) {
|
while (cp < lim) {
|
||||||
int chr;
|
int chr;
|
||||||
cp = get_char(cp, &chr);
|
cp = get_char(cp, &chr);
|
||||||
@ -636,7 +636,7 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
|
|||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
LOCAL_TERM_ERROR( 2*(lim-s) );
|
LOCAL_TERM_ERROR( 2*(lim-s) );
|
||||||
buf = buf_from_tstring(H);
|
buf = buf_from_tstring(HR);
|
||||||
while (wp < lim) {
|
while (wp < lim) {
|
||||||
int chr;
|
int chr;
|
||||||
wp = get_wchar(wp, &chr);
|
wp = get_wchar(wp, &chr);
|
||||||
@ -658,7 +658,7 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
|
|||||||
static Term
|
static Term
|
||||||
write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng USES_REGS)
|
write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng USES_REGS)
|
||||||
{
|
{
|
||||||
Term t = AbsPair(H);
|
Term t = AbsPair(HR);
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
size_t min = 0, max = leng;
|
size_t min = 0, max = leng;
|
||||||
if (out->type & (YAP_STRING_NCHARS|YAP_STRING_TRUNC)) {
|
if (out->type & (YAP_STRING_NCHARS|YAP_STRING_TRUNC)) {
|
||||||
@ -677,9 +677,9 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
|
|||||||
int chr;
|
int chr;
|
||||||
cp = utf8_get_char(cp, &chr);
|
cp = utf8_get_char(cp, &chr);
|
||||||
w[0] = chr;
|
w[0] = chr;
|
||||||
H[0] = MkAtomTerm(Yap_LookupMaybeWideAtom(w));
|
HR[0] = MkAtomTerm(Yap_LookupMaybeWideAtom(w));
|
||||||
H[1] = AbsPair(H+2);
|
HR[1] = AbsPair(HR+2);
|
||||||
H += 2;
|
HR += 2;
|
||||||
sz++;
|
sz++;
|
||||||
if (sz == max) break;
|
if (sz == max) break;
|
||||||
}
|
}
|
||||||
@ -696,9 +696,9 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
|
|||||||
int chr;
|
int chr;
|
||||||
cp = get_char(cp, &chr);
|
cp = get_char(cp, &chr);
|
||||||
w[0] = chr;
|
w[0] = chr;
|
||||||
H[0] = MkAtomTerm(Yap_LookupAtom(w));
|
HR[0] = MkAtomTerm(Yap_LookupAtom(w));
|
||||||
H[1] = AbsPair(H+2);
|
HR[1] = AbsPair(HR+2);
|
||||||
H += 2;
|
HR += 2;
|
||||||
sz++;
|
sz++;
|
||||||
if (sz == max) break;
|
if (sz == max) break;
|
||||||
}
|
}
|
||||||
@ -715,26 +715,26 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
|
|||||||
int chr;
|
int chr;
|
||||||
cp = get_wchar(cp, &chr);
|
cp = get_wchar(cp, &chr);
|
||||||
w[0] = chr;
|
w[0] = chr;
|
||||||
H[0] = MkAtomTerm(Yap_LookupMaybeWideAtom(w));
|
HR[0] = MkAtomTerm(Yap_LookupMaybeWideAtom(w));
|
||||||
H[1] = AbsPair(H+2);
|
HR[1] = AbsPair(HR+2);
|
||||||
H += 2;
|
HR += 2;
|
||||||
sz++;
|
sz++;
|
||||||
if (sz == max) break;
|
if (sz == max) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (sz < min) {
|
while (sz < min) {
|
||||||
H[0] = MkAtomTerm(AtomEmptyAtom);
|
HR[0] = MkAtomTerm(AtomEmptyAtom);
|
||||||
H[1] = AbsPair(H+2);
|
HR[1] = AbsPair(HR+2);
|
||||||
H += 2;
|
HR += 2;
|
||||||
sz++;
|
sz++;
|
||||||
}
|
}
|
||||||
if (out->type & YAP_STRING_DIFF) {
|
if (out->type & YAP_STRING_DIFF) {
|
||||||
if (sz == 0) t = out->dif;
|
if (sz == 0) t = out->dif;
|
||||||
else H[-1] = Globalize(out->dif PASS_REGS);
|
else HR[-1] = Globalize(out->dif PASS_REGS);
|
||||||
} else {
|
} else {
|
||||||
if (sz == 0) t = TermNil;
|
if (sz == 0) t = TermNil;
|
||||||
else H[-1] = TermNil;
|
else HR[-1] = TermNil;
|
||||||
}
|
}
|
||||||
out->val.t = t;
|
out->val.t = t;
|
||||||
return (t);
|
return (t);
|
||||||
@ -743,7 +743,7 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
|
|||||||
static Term
|
static Term
|
||||||
write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng USES_REGS)
|
write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng USES_REGS)
|
||||||
{
|
{
|
||||||
Term t = AbsPair(H);
|
Term t = AbsPair(HR);
|
||||||
size_t min = 0, max = leng;
|
size_t min = 0, max = leng;
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
|
|
||||||
@ -760,9 +760,9 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
|
|||||||
while (*cp && cp < lim) {
|
while (*cp && cp < lim) {
|
||||||
int chr;
|
int chr;
|
||||||
cp = utf8_get_char(cp, &chr);
|
cp = utf8_get_char(cp, &chr);
|
||||||
H[0] = MkIntTerm(chr);
|
HR[0] = MkIntTerm(chr);
|
||||||
H[1] = AbsPair(H+2);
|
HR[1] = AbsPair(HR+2);
|
||||||
H += 2;
|
HR += 2;
|
||||||
sz++;
|
sz++;
|
||||||
if (sz == max) break;
|
if (sz == max) break;
|
||||||
}
|
}
|
||||||
@ -776,9 +776,9 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
|
|||||||
while (cp < lim) {
|
while (cp < lim) {
|
||||||
int chr;
|
int chr;
|
||||||
cp = get_char(cp, &chr);
|
cp = get_char(cp, &chr);
|
||||||
H[0] = MkIntTerm(chr);
|
HR[0] = MkIntTerm(chr);
|
||||||
H[1] = AbsPair(H+2);
|
HR[1] = AbsPair(HR+2);
|
||||||
H += 2;
|
HR += 2;
|
||||||
sz++;
|
sz++;
|
||||||
if (sz == max) break;
|
if (sz == max) break;
|
||||||
}
|
}
|
||||||
@ -792,26 +792,26 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
|
|||||||
while (cp < lim) {
|
while (cp < lim) {
|
||||||
int chr;
|
int chr;
|
||||||
cp = get_wchar(cp, &chr);
|
cp = get_wchar(cp, &chr);
|
||||||
H[0] = MkIntTerm(chr);
|
HR[0] = MkIntTerm(chr);
|
||||||
H[1] = AbsPair(H+2);
|
HR[1] = AbsPair(HR+2);
|
||||||
H += 2;
|
HR += 2;
|
||||||
sz++;
|
sz++;
|
||||||
if (sz == max) break;
|
if (sz == max) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (sz < min) {
|
while (sz < min) {
|
||||||
H[0] = MkIntTerm(MkIntTerm(0));
|
HR[0] = MkIntTerm(MkIntTerm(0));
|
||||||
H[1] = AbsPair(H+2);
|
HR[1] = AbsPair(HR+2);
|
||||||
H += 2;
|
HR += 2;
|
||||||
sz++;
|
sz++;
|
||||||
}
|
}
|
||||||
if (out->type & YAP_STRING_DIFF) {
|
if (out->type & YAP_STRING_DIFF) {
|
||||||
if (sz == 0) t = out->dif;
|
if (sz == 0) t = out->dif;
|
||||||
else H[-1] = Globalize(out->dif PASS_REGS);
|
else HR[-1] = Globalize(out->dif PASS_REGS);
|
||||||
} else {
|
} else {
|
||||||
if (sz == 0) t = TermNil;
|
if (sz == 0) t = TermNil;
|
||||||
else H[-1] = TermNil;
|
else HR[-1] = TermNil;
|
||||||
}
|
}
|
||||||
out->val.t = t;
|
out->val.t = t;
|
||||||
return (t);
|
return (t);
|
||||||
@ -821,10 +821,9 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
|
|||||||
static Atom
|
static Atom
|
||||||
write_atom( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng USES_REGS)
|
write_atom( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng USES_REGS)
|
||||||
{
|
{
|
||||||
size_t min = 0, max = leng;
|
size_t max = leng;
|
||||||
if (out->type & (YAP_STRING_NCHARS|YAP_STRING_TRUNC)) {
|
if (out->type & (YAP_STRING_NCHARS|YAP_STRING_TRUNC)) {
|
||||||
if (out->type & YAP_STRING_NCHARS) min = out->sz;
|
if (out->type & YAP_STRING_TRUNC && out->max < max) max = out->max;
|
||||||
if (out->type & YAP_STRING_TRUNC && out->max < max) max = out->max;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (enc) {
|
switch (enc) {
|
||||||
@ -1162,7 +1161,7 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
|
|||||||
if (out->type == YAP_STRING_STRING) {
|
if (out->type == YAP_STRING_STRING) {
|
||||||
/* we assume we concatenate strings only, or ASCII stuff like numbers */
|
/* we assume we concatenate strings only, or ASCII stuff like numbers */
|
||||||
Term t = init_tstring( PASS_REGS1 );
|
Term t = init_tstring( PASS_REGS1 );
|
||||||
char *buf = buf_from_tstring(H);
|
char *buf = buf_from_tstring(HR);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (encv[i] == YAP_WCHAR) {
|
if (encv[i] == YAP_WCHAR) {
|
||||||
@ -1182,7 +1181,7 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
|
|||||||
*buf ++ = '\0';
|
*buf ++ = '\0';
|
||||||
close_tstring( buf PASS_REGS );
|
close_tstring( buf PASS_REGS );
|
||||||
out->val.t = t;
|
out->val.t = t;
|
||||||
return H;
|
return HR;
|
||||||
} else {
|
} else {
|
||||||
encoding_t enc = YAP_CHAR;
|
encoding_t enc = YAP_CHAR;
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
@ -1196,7 +1195,7 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
|
|||||||
}
|
}
|
||||||
if (enc == YAP_WCHAR) {
|
if (enc == YAP_WCHAR) {
|
||||||
/* wide atom */
|
/* wide atom */
|
||||||
wchar_t *buf = (wchar_t *)H;
|
wchar_t *buf = (wchar_t *)HR;
|
||||||
Atom at;
|
Atom at;
|
||||||
Term t = ARG1;
|
Term t = ARG1;
|
||||||
LOCAL_ERROR( sz+3 );
|
LOCAL_ERROR( sz+3 );
|
||||||
@ -1216,11 +1215,11 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*buf++ = '\0';
|
*buf++ = '\0';
|
||||||
at = out->val.a = Yap_LookupWideAtom((wchar_t *)H);
|
at = out->val.a = Yap_LookupWideAtom((wchar_t *)HR);
|
||||||
return at;
|
return at;
|
||||||
} else {
|
} else {
|
||||||
/* atom */
|
/* atom */
|
||||||
char *buf = (char *)H;
|
char *buf = (char *)HR;
|
||||||
Atom at;
|
Atom at;
|
||||||
Term t = ARG1;
|
Term t = ARG1;
|
||||||
|
|
||||||
@ -1231,7 +1230,7 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
|
|||||||
while ( (chr = *ptr++) != '\0' ) *buf++ = chr;
|
while ( (chr = *ptr++) != '\0' ) *buf++ = chr;
|
||||||
}
|
}
|
||||||
*buf++ = '\0';
|
*buf++ = '\0';
|
||||||
at = out->val.a = Yap_LookupAtom((char *)H);
|
at = out->val.a = Yap_LookupAtom((char *)HR);
|
||||||
return at;
|
return at;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1244,7 +1243,7 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
|
|||||||
if (out->type == YAP_STRING_STRING) {
|
if (out->type == YAP_STRING_STRING) {
|
||||||
/* we assume we concatenate strings only, or ASCII stuff like numbers */
|
/* we assume we concatenate strings only, or ASCII stuff like numbers */
|
||||||
Term t = init_tstring( PASS_REGS1 );
|
Term t = init_tstring( PASS_REGS1 );
|
||||||
char *nbuf = buf_from_tstring(H);
|
char *nbuf = buf_from_tstring(HR);
|
||||||
if (enc == YAP_WCHAR) {
|
if (enc == YAP_WCHAR) {
|
||||||
wchar_t *ptr = (wchar_t *)buf + min;
|
wchar_t *ptr = (wchar_t *)buf + min;
|
||||||
int chr;
|
int chr;
|
||||||
@ -1268,7 +1267,7 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
|
|||||||
/* atom */
|
/* atom */
|
||||||
if (enc == YAP_WCHAR) {
|
if (enc == YAP_WCHAR) {
|
||||||
/* wide atom */
|
/* wide atom */
|
||||||
wchar_t *nbuf = (wchar_t *)H;
|
wchar_t *nbuf = (wchar_t *)HR;
|
||||||
Term t = TermNil;
|
Term t = TermNil;
|
||||||
wchar_t *ptr = (wchar_t *)buf + min;
|
wchar_t *ptr = (wchar_t *)buf + min;
|
||||||
if (max>min) {
|
if (max>min) {
|
||||||
@ -1279,7 +1278,7 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
|
|||||||
at = Yap_LookupMaybeWideAtom( nbuf );
|
at = Yap_LookupMaybeWideAtom( nbuf );
|
||||||
} else if (enc == YAP_CHAR) {
|
} else if (enc == YAP_CHAR) {
|
||||||
/* atom */
|
/* atom */
|
||||||
char *nbuf = (char *)H;
|
char *nbuf = (char *)HR;
|
||||||
|
|
||||||
if (max>min) {
|
if (max>min) {
|
||||||
Term t = TermNil;
|
Term t = TermNil;
|
||||||
@ -1291,7 +1290,7 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
|
|||||||
at = Yap_LookupAtom( nbuf );
|
at = Yap_LookupAtom( nbuf );
|
||||||
} else {
|
} else {
|
||||||
/* atom */
|
/* atom */
|
||||||
wchar_t *nbuf = (wchar_t *)H;
|
wchar_t *nbuf = (wchar_t *)HR;
|
||||||
Term t = ARG1;
|
Term t = ARG1;
|
||||||
const char *ptr = utf8_skip ( (const char *)buf, min );
|
const char *ptr = utf8_skip ( (const char *)buf, min );
|
||||||
int chr;
|
int chr;
|
||||||
@ -1299,7 +1298,7 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
|
|||||||
LOCAL_ERROR( max-min );
|
LOCAL_ERROR( max-min );
|
||||||
while ( min++ < max ) { ptr = utf8_get_char(ptr, & chr); *nbuf++ = chr; }
|
while ( min++ < max ) { ptr = utf8_get_char(ptr, & chr); *nbuf++ = chr; }
|
||||||
nbuf[0] = '\0';
|
nbuf[0] = '\0';
|
||||||
at = Yap_LookupMaybeWideAtom( (wchar_t*)H );
|
at = Yap_LookupMaybeWideAtom( (wchar_t*)HR );
|
||||||
}
|
}
|
||||||
out->val.a = at;
|
out->val.a = at;
|
||||||
return at->StrOfAE;
|
return at->StrOfAE;
|
||||||
|
@ -397,7 +397,7 @@ oc_unify_nvar_nvar:
|
|||||||
/* d0 is bound and d1 is unbound */
|
/* d0 is bound and d1 is unbound */
|
||||||
Bind(pt1, d0);
|
Bind(pt1, d0);
|
||||||
/* local variables cannot be in a term */
|
/* local variables cannot be in a term */
|
||||||
if (pt1 > H && pt1 < LCL0)
|
if (pt1 > HR && pt1 < LCL0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (rational_tree(d0))
|
if (rational_tree(d0))
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
@ -410,7 +410,7 @@ oc_unify_var_nvar:
|
|||||||
/* pt0 is unbound and d1 is bound */
|
/* pt0 is unbound and d1 is bound */
|
||||||
Bind(pt0, d1);
|
Bind(pt0, d1);
|
||||||
/* local variables cannot be in a term */
|
/* local variables cannot be in a term */
|
||||||
if (pt0 > H && pt0 < LCL0)
|
if (pt0 > HR && pt0 < LCL0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (rational_tree(d1))
|
if (rational_tree(d1))
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
@ -587,7 +587,7 @@ InitReverseLookupOpcode(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bzero(OP_RTABLE, sz);
|
memset(OP_RTABLE, 0, sz);
|
||||||
opeptr = OP_RTABLE;
|
opeptr = OP_RTABLE;
|
||||||
/* clear up table */
|
/* clear up table */
|
||||||
{
|
{
|
||||||
|
646
C/utilpreds.c
646
C/utilpreds.c
File diff suppressed because it is too large
Load Diff
@ -206,7 +206,7 @@ ensure_space(size_t sz) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!s) {
|
if (!s) {
|
||||||
s = (char *)H;
|
s = (char *)HR;
|
||||||
if (s+sz >= (char *)ASP) {
|
if (s+sz >= (char *)ASP) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"not enough space to write bignum: it requires %d bytes", sz);
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"not enough space to write bignum: it requires %d bytes", sz);
|
||||||
s = NULL;
|
s = NULL;
|
||||||
|
70
H/Regs.h
70
H/Regs.h
@ -231,7 +231,7 @@ extern REGSTORE Yap_REGS;
|
|||||||
|
|
||||||
#define P Yap_REGS.P_ /* prolog machine program counter */
|
#define P Yap_REGS.P_ /* prolog machine program counter */
|
||||||
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
||||||
register CELL *H asm ("$9");
|
register CELL *HR asm ("$9");
|
||||||
register CELL *HB asm ("$10");
|
register CELL *HB asm ("$10");
|
||||||
register choiceptr B asm ("$11");
|
register choiceptr B asm ("$11");
|
||||||
register yamop *CP asm ("$12");
|
register yamop *CP asm ("$12");
|
||||||
@ -247,7 +247,7 @@ register CELL CreepFlag asm ("$15");
|
|||||||
/* Interface with foreign code, make sure the foreign code sees all the
|
/* Interface with foreign code, make sure the foreign code sees all the
|
||||||
registers the way they used to be */
|
registers the way they used to be */
|
||||||
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
||||||
Yap_REGS.H_ = H;
|
Yap_REGS.H_ = HR;
|
||||||
Yap_REGS.HB_ = HB;
|
Yap_REGS.HB_ = HB;
|
||||||
Yap_REGS.B_ = B;
|
Yap_REGS.B_ = B;
|
||||||
Yap_REGS.CP_ = CP;
|
Yap_REGS.CP_ = CP;
|
||||||
@ -258,7 +258,7 @@ INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
||||||
H = Yap_REGS.H_;
|
HR = Yap_REGS.H_;
|
||||||
HB = Yap_REGS.HB_;
|
HB = Yap_REGS.HB_;
|
||||||
B = Yap_REGS.B_;
|
B = Yap_REGS.B_;
|
||||||
CP = Yap_REGS.CP_;
|
CP = Yap_REGS.CP_;
|
||||||
@ -287,16 +287,16 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
|||||||
TR = BK_TR
|
TR = BK_TR
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_H(void) {
|
INLINE_ONLY EXTERN inline void save_H(void) {
|
||||||
Yap_REGS.H_ = H;
|
Yap_REGS.H_ = HR;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void restore_H(void) {
|
INLINE_ONLY EXTERN inline void restore_H(void) {
|
||||||
H = Yap_REGS.H_;
|
HR = Yap_REGS.H_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BACKUP_H() CELL *BK_H = H; restore_H()
|
#define BACKUP_H() CELL *BK_H = HR; restore_H()
|
||||||
|
|
||||||
#define RECOVER_H() save_H(); H = BK_H
|
#define RECOVER_H() save_H(); HR = BK_H
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_B(void) {
|
INLINE_ONLY EXTERN inline void save_B(void) {
|
||||||
Yap_REGS.B_ = B;
|
Yap_REGS.B_ = B;
|
||||||
@ -325,7 +325,7 @@ INLINE_ONLY EXTERN inline void restore_TR(void) {
|
|||||||
|
|
||||||
#define P Yap_REGS.P_ /* prolog machine program counter */
|
#define P Yap_REGS.P_ /* prolog machine program counter */
|
||||||
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
||||||
register CELL *H asm ("$16");
|
register CELL *HR asm ("$16");
|
||||||
register CELL *HB asm ("$17");
|
register CELL *HB asm ("$17");
|
||||||
register choiceptr B asm ("$18");
|
register choiceptr B asm ("$18");
|
||||||
register yamop *CP asm ("$19");
|
register yamop *CP asm ("$19");
|
||||||
@ -334,7 +334,7 @@ register CELL CreepFlag asm ("$21");
|
|||||||
register tr_fr_ptr TR asm ("$22");
|
register tr_fr_ptr TR asm ("$22");
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
||||||
Yap_REGS.H_ = H;
|
Yap_REGS.H_ = HR;
|
||||||
Yap_REGS.HB_ = HB;
|
Yap_REGS.HB_ = HB;
|
||||||
Yap_REGS.B_ = B;
|
Yap_REGS.B_ = B;
|
||||||
Yap_REGS.CP_ = CP;
|
Yap_REGS.CP_ = CP;
|
||||||
@ -343,7 +343,7 @@ INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
||||||
H = Yap_REGS.H_;
|
HR = Yap_REGS.H_;
|
||||||
HB = Yap_REGS.HB_;
|
HB = Yap_REGS.HB_;
|
||||||
B = Yap_REGS.B_;
|
B = Yap_REGS.B_;
|
||||||
CP = Yap_REGS.CP_;
|
CP = Yap_REGS.CP_;
|
||||||
@ -352,7 +352,7 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define BACKUP_MACHINE_REGS() \
|
#define BACKUP_MACHINE_REGS() \
|
||||||
CELL *BK_H = H; \
|
CELL *BK_H = HR; \
|
||||||
CELL *BK_HB = HB; \
|
CELL *BK_HB = HB; \
|
||||||
choiceptr BK_B = B; \
|
choiceptr BK_B = B; \
|
||||||
CELL BK_CreepFlag = CreepFlag; \
|
CELL BK_CreepFlag = CreepFlag; \
|
||||||
@ -362,7 +362,7 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
|||||||
|
|
||||||
#define RECOVER_MACHINE_REGS() \
|
#define RECOVER_MACHINE_REGS() \
|
||||||
save_machine_regs(); \
|
save_machine_regs(); \
|
||||||
H = BK_H; \
|
HR = BK_H; \
|
||||||
HB = BK_HB; \
|
HB = BK_HB; \
|
||||||
B = BK_B; \
|
B = BK_B; \
|
||||||
CreepFlag = BK_CreepFlag; \
|
CreepFlag = BK_CreepFlag; \
|
||||||
@ -370,16 +370,16 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
|||||||
TR = BK_TR
|
TR = BK_TR
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_H(void) {
|
INLINE_ONLY EXTERN inline void save_H(void) {
|
||||||
Yap_REGS.H_ = H;
|
Yap_REGS.H_ = HR;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void restore_H(void) {
|
INLINE_ONLY EXTERN inline void restore_H(void) {
|
||||||
H = Yap_REGS.H_;
|
HR = Yap_REGS.H_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BACKUP_H() CELL *BK_H = H; restore_H()
|
#define BACKUP_H() CELL *BK_H = HR; restore_H()
|
||||||
|
|
||||||
#define RECOVER_H() save_H(); H = BK_H
|
#define RECOVER_H() save_H(); HR = BK_H
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_B(void) {
|
INLINE_ONLY EXTERN inline void save_B(void) {
|
||||||
Yap_REGS.B_ = B;
|
Yap_REGS.B_ = B;
|
||||||
@ -399,7 +399,7 @@ INLINE_ONLY EXTERN inline void restore_B(void) {
|
|||||||
|
|
||||||
#define P Yap_REGS.P_ /* prolog machine program counter */
|
#define P Yap_REGS.P_ /* prolog machine program counter */
|
||||||
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
||||||
register CELL *H asm ("r12");
|
register CELL *HR asm ("r12");
|
||||||
register CELL *HB asm ("r13");
|
register CELL *HB asm ("r13");
|
||||||
register choiceptr B asm ("r14");
|
register choiceptr B asm ("r14");
|
||||||
register yamop *CP asm ("r15");
|
register yamop *CP asm ("r15");
|
||||||
@ -408,7 +408,7 @@ register CELL CreepFlag asm ("r17");
|
|||||||
register tr_fr_ptr TR asm ("r18");
|
register tr_fr_ptr TR asm ("r18");
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
||||||
Yap_REGS.H_ = H;
|
Yap_REGS.H_ = HR;
|
||||||
Yap_REGS.HB_ = HB;
|
Yap_REGS.HB_ = HB;
|
||||||
Yap_REGS.B_ = B;
|
Yap_REGS.B_ = B;
|
||||||
Yap_REGS.CP_ = CP;
|
Yap_REGS.CP_ = CP;
|
||||||
@ -417,7 +417,7 @@ INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
||||||
H = Yap_REGS.H_;
|
HR = Yap_REGS.H_;
|
||||||
HB = Yap_REGS.HB_;
|
HB = Yap_REGS.HB_;
|
||||||
B = Yap_REGS.B_;
|
B = Yap_REGS.B_;
|
||||||
CP = Yap_REGS.CP_;
|
CP = Yap_REGS.CP_;
|
||||||
@ -426,7 +426,7 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define BACKUP_MACHINE_REGS() \
|
#define BACKUP_MACHINE_REGS() \
|
||||||
CELL *BK_H = H; \
|
CELL *BK_H = HR; \
|
||||||
CELL *BK_HB = HB; \
|
CELL *BK_HB = HB; \
|
||||||
choiceptr BK_B = B; \
|
choiceptr BK_B = B; \
|
||||||
CELL BK_CreepFlag = CreepFlag; \
|
CELL BK_CreepFlag = CreepFlag; \
|
||||||
@ -436,7 +436,7 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
|||||||
|
|
||||||
#define RECOVER_MACHINE_REGS() \
|
#define RECOVER_MACHINE_REGS() \
|
||||||
save_machine_regs(); \
|
save_machine_regs(); \
|
||||||
H = BK_H; \
|
HR = BK_H; \
|
||||||
HB = BK_HB; \
|
HB = BK_HB; \
|
||||||
B = BK_B; \
|
B = BK_B; \
|
||||||
CreepFlag = BK_CreepFlag; \
|
CreepFlag = BK_CreepFlag; \
|
||||||
@ -444,16 +444,16 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
|||||||
TR = BK_TR
|
TR = BK_TR
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_H(void) {
|
INLINE_ONLY EXTERN inline void save_H(void) {
|
||||||
Yap_REGS.H_ = H;
|
Yap_REGS.H_ = HR;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void restore_H(void) {
|
INLINE_ONLY EXTERN inline void restore_H(void) {
|
||||||
H = Yap_REGS.H_;
|
HR = Yap_REGS.H_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BACKUP_H() CELL *BK_H = H; restore_H()
|
#define BACKUP_H() CELL *BK_H = HR; restore_H()
|
||||||
|
|
||||||
#define RECOVER_H() save_H(); H = BK_H
|
#define RECOVER_H() save_H(); HR = BK_H
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_B(void) {
|
INLINE_ONLY EXTERN inline void save_B(void) {
|
||||||
Yap_REGS.B_ = B;
|
Yap_REGS.B_ = B;
|
||||||
@ -501,7 +501,7 @@ register tr_fr_ptr TR asm ("r13");
|
|||||||
#else
|
#else
|
||||||
register tr_fr_ptr TR asm ("r21");
|
register tr_fr_ptr TR asm ("r21");
|
||||||
#endif
|
#endif
|
||||||
register CELL *H asm ("r14");
|
register CELL *HR asm ("r14");
|
||||||
register CELL *HB asm ("r15");
|
register CELL *HB asm ("r15");
|
||||||
register choiceptr B asm ("r16");
|
register choiceptr B asm ("r16");
|
||||||
register yamop *CP asm ("r17");
|
register yamop *CP asm ("r17");
|
||||||
@ -520,7 +520,7 @@ register CELL *YENV asm ("r19");
|
|||||||
|
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
||||||
Yap_REGS.H_ = H;
|
Yap_REGS.H_ = HR;
|
||||||
Yap_REGS.HB_ = HB;
|
Yap_REGS.HB_ = HB;
|
||||||
Yap_REGS.B_ = B;
|
Yap_REGS.B_ = B;
|
||||||
Yap_REGS.CP_ = CP;
|
Yap_REGS.CP_ = CP;
|
||||||
@ -529,7 +529,7 @@ INLINE_ONLY EXTERN inline void save_machine_regs(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
||||||
H = Yap_REGS.H_;
|
HR = Yap_REGS.H_;
|
||||||
HB = Yap_REGS.HB_;
|
HB = Yap_REGS.HB_;
|
||||||
B = Yap_REGS.B_;
|
B = Yap_REGS.B_;
|
||||||
CP = Yap_REGS.CP_;
|
CP = Yap_REGS.CP_;
|
||||||
@ -538,7 +538,7 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define BACKUP_MACHINE_REGS() \
|
#define BACKUP_MACHINE_REGS() \
|
||||||
CELL *BK_H = H; \
|
CELL *BK_H = HR; \
|
||||||
CELL *BK_HB = HB; \
|
CELL *BK_HB = HB; \
|
||||||
choiceptr BK_B = B; \
|
choiceptr BK_B = B; \
|
||||||
yamop *BK_CP = CP; \
|
yamop *BK_CP = CP; \
|
||||||
@ -547,23 +547,23 @@ INLINE_ONLY EXTERN inline void restore_machine_regs(void) {
|
|||||||
|
|
||||||
#define RECOVER_MACHINE_REGS() \
|
#define RECOVER_MACHINE_REGS() \
|
||||||
save_machine_regs(); \
|
save_machine_regs(); \
|
||||||
H = BK_H; \
|
HR = BK_H; \
|
||||||
HB = BK_HB; \
|
HB = BK_HB; \
|
||||||
B = BK_B; \
|
B = BK_B; \
|
||||||
CP = BK_CP; \
|
CP = BK_CP; \
|
||||||
TR = BK_TR
|
TR = BK_TR
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_H(void) {
|
INLINE_ONLY EXTERN inline void save_H(void) {
|
||||||
Yap_REGS.H_ = H;
|
Yap_REGS.H_ = HR;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void restore_H(void) {
|
INLINE_ONLY EXTERN inline void restore_H(void) {
|
||||||
H = Yap_REGS.H_;
|
HR = Yap_REGS.H_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BACKUP_H() CELL *BK_H = H; restore_H()
|
#define BACKUP_H() CELL *BK_H = HR; restore_H()
|
||||||
|
|
||||||
#define RECOVER_H() save_H(); H = BK_H
|
#define RECOVER_H() save_H(); HR = BK_H
|
||||||
|
|
||||||
INLINE_ONLY EXTERN inline void save_B(void) {
|
INLINE_ONLY EXTERN inline void save_B(void) {
|
||||||
Yap_REGS.B_ = B;
|
Yap_REGS.B_ = B;
|
||||||
@ -594,7 +594,7 @@ INLINE_ONLY EXTERN inline void restore_TR(void) {
|
|||||||
#define P Yap_REGS.P_ /* prolog machine program counter */
|
#define P Yap_REGS.P_ /* prolog machine program counter */
|
||||||
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
#define YENV Yap_REGS.YENV_ /* current environment (may differ from ENV) */
|
||||||
#define S Yap_REGS.S_ /* structure pointer */
|
#define S Yap_REGS.S_ /* structure pointer */
|
||||||
#define H Yap_REGS.H_ /* top of heap (global) stack */
|
#define HR Yap_REGS.H_ /* top of heap (global) stack */
|
||||||
#define B Yap_REGS.B_ /* latest choice point */
|
#define B Yap_REGS.B_ /* latest choice point */
|
||||||
#define TR Yap_REGS.TR_ /* top of trail */
|
#define TR Yap_REGS.TR_ /* top of trail */
|
||||||
#define HB Yap_REGS.HB_ /* heap (global) stack top at time of latest c.p. */
|
#define HB Yap_REGS.HB_ /* heap (global) stack top at time of latest c.p. */
|
||||||
|
56
H/TermExt.h
56
H/TermExt.h
@ -71,7 +71,7 @@ __IsAttVar (CELL *pt USES_REGS)
|
|||||||
{
|
{
|
||||||
#ifdef YAP_H
|
#ifdef YAP_H
|
||||||
return (pt)[-1] == (CELL)attvar_e
|
return (pt)[-1] == (CELL)attvar_e
|
||||||
&& pt < H;
|
&& pt < HR;
|
||||||
#else
|
#else
|
||||||
return (pt)[-1] == (CELL)attvar_e;
|
return (pt)[-1] == (CELL)attvar_e;
|
||||||
#endif
|
#endif
|
||||||
@ -181,7 +181,7 @@ special_functors;
|
|||||||
|
|
||||||
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
|
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
|
||||||
|
|
||||||
#if SIZEOF_DOUBLE == SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == SIZEOF_INT_P
|
||||||
|
|
||||||
#define MkFloatTerm(fl) __MkFloatTerm((fl) PASS_REGS)
|
#define MkFloatTerm(fl) __MkFloatTerm((fl) PASS_REGS)
|
||||||
|
|
||||||
@ -190,9 +190,9 @@ INLINE_ONLY inline EXTERN Term __MkFloatTerm (Float USES_REGS);
|
|||||||
INLINE_ONLY inline EXTERN Term
|
INLINE_ONLY inline EXTERN Term
|
||||||
__MkFloatTerm (Float dbl USES_REGS)
|
__MkFloatTerm (Float dbl USES_REGS)
|
||||||
{
|
{
|
||||||
return (Term) ((H[0] = (CELL) FunctorDouble, *(Float *) (H + 1) =
|
return (Term) ((HR[0] = (CELL) FunctorDouble, *(Float *) (HR + 1) =
|
||||||
dbl, H[2] = EndSpecials, H +=
|
dbl, HR[2] = EndSpecials, HR +=
|
||||||
3, AbsAppl (H - 3)));
|
3, AbsAppl (HR - 3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ CpFloatUnaligned(CELL *ptr)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
|
|
||||||
#define DOUBLE_ALIGNED(ADDR) ((CELL)(ADDR) & 0x4)
|
#define DOUBLE_ALIGNED(ADDR) ((CELL)(ADDR) & 0x4)
|
||||||
|
|
||||||
@ -228,9 +228,9 @@ AlignGlobalForDouble( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
/* Force Alignment for floats. Note that garbage collector may
|
/* Force Alignment for floats. Note that garbage collector may
|
||||||
break the alignment; */
|
break the alignment; */
|
||||||
if (!DOUBLE_ALIGNED(H)) {
|
if (!DOUBLE_ALIGNED(HR)) {
|
||||||
RESET_VARIABLE(H);
|
RESET_VARIABLE(HR);
|
||||||
H++;
|
HR++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,14 +260,16 @@ CpFloatUnaligned (CELL * ptr)
|
|||||||
|
|
||||||
INLINE_ONLY inline EXTERN Term MkFloatTerm (Float);
|
INLINE_ONLY inline EXTERN Term MkFloatTerm (Float);
|
||||||
|
|
||||||
|
#define MkFloatTerm(fl) __MkFloatTerm((fl) PASS_REGS)
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN Term
|
INLINE_ONLY inline EXTERN Term
|
||||||
MkFloatTerm (Float dbl)
|
__MkFloatTerm (Float dbl USES_REGS)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
return (Term) ((AlignGlobalForDouble ( PASS_REGS1 ), H[0] =
|
return (Term) ((AlignGlobalForDouble ( PASS_REGS1 ), HR[0] =
|
||||||
(CELL) FunctorDouble, *(Float *) (H + 1) = dbl, H[3] =
|
(CELL) FunctorDouble, *(Float *) (HR + 1) = dbl, HR[3] =
|
||||||
EndSpecials, H +=
|
EndSpecials, HR +=
|
||||||
4, AbsAppl (H - 4)));
|
4, AbsAppl (HR - 4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -314,11 +316,11 @@ INLINE_ONLY inline EXTERN Term __MkLongIntTerm (Int USES_REGS);
|
|||||||
INLINE_ONLY inline EXTERN Term
|
INLINE_ONLY inline EXTERN Term
|
||||||
__MkLongIntTerm (Int i USES_REGS)
|
__MkLongIntTerm (Int i USES_REGS)
|
||||||
{
|
{
|
||||||
H[0] = (CELL) FunctorLongInt;
|
HR[0] = (CELL) FunctorLongInt;
|
||||||
H[1] = (CELL) (i);
|
HR[1] = (CELL) (i);
|
||||||
H[2] = EndSpecials;
|
HR[2] = EndSpecials;
|
||||||
H += 3;
|
HR += 3;
|
||||||
return AbsAppl(H - 3);
|
return AbsAppl(HR - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -356,13 +358,13 @@ INLINE_ONLY inline EXTERN Term __MkStringTerm (const char *s USES_REGS);
|
|||||||
INLINE_ONLY inline EXTERN Term
|
INLINE_ONLY inline EXTERN Term
|
||||||
__MkStringTerm (const char *s USES_REGS)
|
__MkStringTerm (const char *s USES_REGS)
|
||||||
{
|
{
|
||||||
Term t = AbsAppl(H);
|
Term t = AbsAppl(HR);
|
||||||
size_t sz = ALIGN_YAPTYPE(strlen(s)+1,CELL);
|
size_t sz = ALIGN_YAPTYPE(strlen(s)+1,CELL);
|
||||||
H[0] = (CELL) FunctorString;
|
HR[0] = (CELL) FunctorString;
|
||||||
H[1] = (CELL) sz;
|
HR[1] = (CELL) sz;
|
||||||
strcpy((char *)(H+2), s);
|
strcpy((char *)(HR+2), s);
|
||||||
H[2+sz] = EndSpecials;
|
HR[2+sz] = EndSpecials;
|
||||||
H += 3+sz;
|
HR += 3+sz;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,7 +693,7 @@ unify_extension (Functor f, CELL d0, CELL * pt0, CELL d1)
|
|||||||
{
|
{
|
||||||
CELL *pt1 = RepAppl (d1);
|
CELL *pt1 = RepAppl (d1);
|
||||||
return (pt0[1] == pt1[1]
|
return (pt0[1] == pt1[1]
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
&& pt0[2] == pt1[2]
|
&& pt0[2] == pt1[2]
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@ -723,7 +725,7 @@ CELL Yap_Int_key(Term t)
|
|||||||
static inline
|
static inline
|
||||||
CELL Yap_DoubleP_key(CELL *pt)
|
CELL Yap_DoubleP_key(CELL *pt)
|
||||||
{
|
{
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE1 == 2*SIZEOF_INT_P
|
||||||
CELL val = pt[0]^pt[1];
|
CELL val = pt[0]^pt[1];
|
||||||
#else
|
#else
|
||||||
CELL val = pt[0];
|
CELL val = pt[0];
|
||||||
|
12
H/YapTags.h
12
H/YapTags.h
@ -168,7 +168,7 @@ INLINE_ONLY inline EXTERN Term MkVarTerm__ ( USES_REGS1 );
|
|||||||
INLINE_ONLY inline EXTERN Term
|
INLINE_ONLY inline EXTERN Term
|
||||||
MkVarTerm__ ( USES_REGS1 )
|
MkVarTerm__ ( USES_REGS1 )
|
||||||
{
|
{
|
||||||
return (Term) ((*H = 0, H++));
|
return (Term) ((*HR = 0, HR++));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ INLINE_ONLY inline EXTERN Term MkVarTerm__ ( USES_REGS1 );
|
|||||||
INLINE_ONLY inline EXTERN Term
|
INLINE_ONLY inline EXTERN Term
|
||||||
MkVarTerm__ ( USES_REGS1 )
|
MkVarTerm__ ( USES_REGS1 )
|
||||||
{
|
{
|
||||||
return (Term) ((*H = (CELL) H, H++));
|
return (Term) ((*HR = (CELL) HR, HR++));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -319,11 +319,11 @@ INLINE_ONLY EXTERN inline Term MkPairTerm__(Term head, Term tail USES_REGS );
|
|||||||
INLINE_ONLY EXTERN inline Term
|
INLINE_ONLY EXTERN inline Term
|
||||||
MkPairTerm__ (Term head, Term tail USES_REGS)
|
MkPairTerm__ (Term head, Term tail USES_REGS)
|
||||||
{
|
{
|
||||||
register CELL *p = H;
|
register CELL *p = HR;
|
||||||
|
|
||||||
H[0] = head;
|
HR[0] = head;
|
||||||
H[1] = tail;
|
HR[1] = tail;
|
||||||
H += 2;
|
HR += 2;
|
||||||
return (AbsPair (p));
|
return (AbsPair (p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
H/YapText.h
14
H/YapText.h
@ -85,12 +85,12 @@ typedef enum internal_encoding {
|
|||||||
} encoding_t;
|
} encoding_t;
|
||||||
|
|
||||||
// string construction
|
// string construction
|
||||||
#ifdef H
|
#ifdef HR
|
||||||
static inline Term
|
static inline Term
|
||||||
init_tstring( USES_REGS1 ) {
|
init_tstring( USES_REGS1 ) {
|
||||||
Term t = AbsAppl(H);
|
Term t = AbsAppl(HR);
|
||||||
|
|
||||||
H[0] = (CELL)FunctorString;
|
HR[0] = (CELL)FunctorString;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,10 +102,10 @@ buf_from_tstring( CELL *p ) {
|
|||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
close_tstring( char *p USES_REGS ) {
|
close_tstring( char *p USES_REGS ) {
|
||||||
CELL *szp = H+1;
|
CELL *szp = HR+1;
|
||||||
H = (CELL *)ALIGN_YAPTYPE( p ,CELL);
|
HR = (CELL *)ALIGN_YAPTYPE( p ,CELL);
|
||||||
*szp = (H - szp)-1;
|
*szp = (HR - szp)-1;
|
||||||
*H++ = EndSpecials;
|
*HR++ = EndSpecials;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
28
H/absmi.h
28
H/absmi.h
@ -769,9 +769,9 @@ Macros to check the limits of stacks
|
|||||||
COUNT_CPS(); \
|
COUNT_CPS(); \
|
||||||
S_YREG = (CELL *)((choiceptr)((S_YREG)-(I))-1); \
|
S_YREG = (CELL *)((choiceptr)((S_YREG)-(I))-1); \
|
||||||
/* Save Information */ \
|
/* Save Information */ \
|
||||||
HBREG = H; \
|
HBREG = HR; \
|
||||||
B_YREG->cp_tr = TR; \
|
B_YREG->cp_tr = TR; \
|
||||||
B_YREG->cp_h = H; \
|
B_YREG->cp_h = HR; \
|
||||||
B_YREG->cp_b = B; \
|
B_YREG->cp_b = B; \
|
||||||
store_yaam_reg_cpdepth(B_YREG); \
|
store_yaam_reg_cpdepth(B_YREG); \
|
||||||
B_YREG->cp_cp = CPREG; \
|
B_YREG->cp_cp = CPREG; \
|
||||||
@ -783,9 +783,9 @@ Macros to check the limits of stacks
|
|||||||
COUNT_CPS(); \
|
COUNT_CPS(); \
|
||||||
pt1 --; /* Jump to CP_BASE */ \
|
pt1 --; /* Jump to CP_BASE */ \
|
||||||
/* Save Information */ \
|
/* Save Information */ \
|
||||||
HBREG = H; \
|
HBREG = HR; \
|
||||||
pt1->cp_tr = TR; \
|
pt1->cp_tr = TR; \
|
||||||
pt1->cp_h = H; \
|
pt1->cp_h = HR; \
|
||||||
pt1->cp_b = B; \
|
pt1->cp_b = B; \
|
||||||
store_yaam_reg_cpdepth(pt1); \
|
store_yaam_reg_cpdepth(pt1); \
|
||||||
pt1->cp_cp = d0; \
|
pt1->cp_cp = d0; \
|
||||||
@ -850,7 +850,7 @@ Macros to check the limits of stacks
|
|||||||
#define restore_yaam_regs(AP) \
|
#define restore_yaam_regs(AP) \
|
||||||
{ register CELL *x1 = B_YREG->cp_env; \
|
{ register CELL *x1 = B_YREG->cp_env; \
|
||||||
register yamop *x2; \
|
register yamop *x2; \
|
||||||
H = HBREG = PROTECT_FROZEN_H(B_YREG); \
|
HR = HBREG = PROTECT_FROZEN_H(B_YREG); \
|
||||||
restore_yaam_reg_cpdepth(B_YREG); \
|
restore_yaam_reg_cpdepth(B_YREG); \
|
||||||
CPREG = B_YREG->cp_cp; \
|
CPREG = B_YREG->cp_cp; \
|
||||||
/* AP may depend on H */ \
|
/* AP may depend on H */ \
|
||||||
@ -914,7 +914,7 @@ Macros to check the limits of stacks
|
|||||||
|
|
||||||
#define pop_yaam_regs() \
|
#define pop_yaam_regs() \
|
||||||
{ \
|
{ \
|
||||||
H = PROTECT_FROZEN_H(B_YREG); \
|
HR = PROTECT_FROZEN_H(B_YREG); \
|
||||||
B = B_YREG->cp_b; \
|
B = B_YREG->cp_b; \
|
||||||
pop_yaam_reg_cpdepth(B_YREG); \
|
pop_yaam_reg_cpdepth(B_YREG); \
|
||||||
CPREG = B_YREG->cp_cp; \
|
CPREG = B_YREG->cp_cp; \
|
||||||
@ -999,20 +999,20 @@ Macros to check the limits of stacks
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define UnifyGlobalCellToCell(b, a) \
|
#define UnifyGlobalCellToCell(b, a) \
|
||||||
if ((a) < H) { /* two globals */ \
|
if ((a) < HR) { /* two globals */ \
|
||||||
UnifyGlobalCells(a,b); \
|
UnifyGlobalCells(a,b); \
|
||||||
} else { \
|
} else { \
|
||||||
Bind_Local((a),(CELL)(b)); \
|
Bind_Local((a),(CELL)(b)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UnifyCells(a, b) \
|
#define UnifyCells(a, b) \
|
||||||
if ((a) < H) { /* at least one global */ \
|
if ((a) < HR) { /* at least one global */ \
|
||||||
if ((b) > H) { Bind_Local((b),(CELL)(a)); } \
|
if ((b) > HR) { Bind_Local((b),(CELL)(a)); } \
|
||||||
else { UnifyGlobalCells(a,b); } \
|
else { UnifyGlobalCells(a,b); } \
|
||||||
} else { \
|
} else { \
|
||||||
if ((b) > (a)) { Bind_Local((a),(CELL)(b)); } \
|
if ((b) > (a)) { Bind_Local((a),(CELL)(b)); } \
|
||||||
else if ((a) > (b)) { \
|
else if ((a) > (b)) { \
|
||||||
if ((b) < H) { Bind_Local((a),(CELL)(b)); } \
|
if ((b) < HR) { Bind_Local((a),(CELL)(b)); } \
|
||||||
else { Bind_Local((b),(CELL)(a)); } \
|
else { Bind_Local((b),(CELL)(a)); } \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -1597,12 +1597,12 @@ void SET_ASP__(CELL *yreg, Int sz USES_REGS) {
|
|||||||
/* l1: bind a, l2 bind b, l3 no binding */
|
/* l1: bind a, l2 bind b, l3 no binding */
|
||||||
#define UnifyAndTrailCells(a, b) \
|
#define UnifyAndTrailCells(a, b) \
|
||||||
if((a) > (b)) { \
|
if((a) > (b)) { \
|
||||||
if ((a) < H) { *(a) = (CELL)(b); DO_TRAIL((a),(CELL)(b)); } \
|
if ((a) < HR) { *(a) = (CELL)(b); DO_TRAIL((a),(CELL)(b)); } \
|
||||||
else if ((b) <= H) { *(a) =(CELL)(b); DO_TRAIL((a),(CELL)(b));} \
|
else if ((b) <= HR) { *(a) =(CELL)(b); DO_TRAIL((a),(CELL)(b));} \
|
||||||
else { *(b) = (CELL)(a); DO_TRAIL((b),(CELL)(a)); } \
|
else { *(b) = (CELL)(a); DO_TRAIL((b),(CELL)(a)); } \
|
||||||
} else if((a) < (b)){ \
|
} else if((a) < (b)){ \
|
||||||
if ((b) <= H) { *(b) = (CELL)(a); DO_TRAIL((b),(CELL)(a)); } \
|
if ((b) <= HR) { *(b) = (CELL)(a); DO_TRAIL((b),(CELL)(a)); } \
|
||||||
else if ((a) <= H) { *(b) = (CELL) (a); DO_TRAIL((b),(CELL)(a));} \
|
else if ((a) <= HR) { *(b) = (CELL) (a); DO_TRAIL((b),(CELL)(a));} \
|
||||||
else { *(a) = (CELL) (b); DO_TRAIL((a),(CELL)(b));} \
|
else { *(a) = (CELL) (b); DO_TRAIL((a),(CELL)(b));} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ extern void Yap_WakeUp(CELL *v);
|
|||||||
|
|
||||||
#define Bind_Local(A,D) { TRAIL_LOCAL(A,D); *(A) = (D); }
|
#define Bind_Local(A,D) { TRAIL_LOCAL(A,D); *(A) = (D); }
|
||||||
#define Bind_Global(A,D) { *(A) = (D); if (__builtin_expect(GlobalIsAttVar(A),0)) Yap_WakeUp(A); else TRAIL_GLOBAL(A,D); }
|
#define Bind_Global(A,D) { *(A) = (D); if (__builtin_expect(GlobalIsAttVar(A),0)) Yap_WakeUp(A); else TRAIL_GLOBAL(A,D); }
|
||||||
#define Bind(A,D) { *(A) = (D); if (A < H) { if (__builtin_expect(GlobalIsAttVar(A),0)) Yap_WakeUp(A); else TRAIL_GLOBAL(A,D); } else { TRAIL_LOCAL(A,D); } }
|
#define Bind(A,D) { *(A) = (D); if (A < HR) { if (__builtin_expect(GlobalIsAttVar(A),0)) Yap_WakeUp(A); else TRAIL_GLOBAL(A,D); } else { TRAIL_LOCAL(A,D); } }
|
||||||
#define Bind_NonAtt(A,D) { *(A) = (D); TRAIL(A,D); }
|
#define Bind_NonAtt(A,D) { *(A) = (D); TRAIL(A,D); }
|
||||||
#define Bind_Global_NonAtt(A,D) { *(A) = (D); TRAIL_GLOBAL(A,D); }
|
#define Bind_Global_NonAtt(A,D) { *(A) = (D); TRAIL_GLOBAL(A,D); }
|
||||||
#define Bind_and_Trail(A,D) { *(A) = (D); DO_TRAIL(A, D); }
|
#define Bind_and_Trail(A,D) { *(A) = (D); DO_TRAIL(A, D); }
|
||||||
|
@ -77,7 +77,7 @@ mul_overflow(Int z, Int i1, Int i2)
|
|||||||
#ifndef OPTIMIZE_MULTIPLI
|
#ifndef OPTIMIZE_MULTIPLI
|
||||||
#if __clang__ && FALSE /* not in OSX yet */
|
#if __clang__ && FALSE /* not in OSX yet */
|
||||||
#define DO_MULTI() if (__builtin_smul_overflow( i1, i2, & z ) ) { goto overflow; }
|
#define DO_MULTI() if (__builtin_smul_overflow( i1, i2, & z ) ) { goto overflow; }
|
||||||
#elif SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#elif SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
#define DO_MULTI() {\
|
#define DO_MULTI() {\
|
||||||
int64_t w = (int64_t)i1*i2; \
|
int64_t w = (int64_t)i1*i2; \
|
||||||
if (w >= 0) {\
|
if (w >= 0) {\
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* is ptr a pointer to the heap? */
|
/* is ptr a pointer to the heap? */
|
||||||
#define ONHEAP(ptr) (CellPtr(ptr) >= H0 && CellPtr(ptr) < H)
|
#define ONHEAP(ptr) (CellPtr(ptr) >= H0 && CellPtr(ptr) < HR)
|
||||||
|
|
||||||
/* is ptr a pointer to code space? */
|
/* is ptr a pointer to code space? */
|
||||||
#if USE_SYSTEM_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
|
27
H/pl-incl.h
27
H/pl-incl.h
@ -573,6 +573,7 @@ extern void PL_cleanup_fork(void);
|
|||||||
extern int PL_rethrow(void);
|
extern int PL_rethrow(void);
|
||||||
extern void PL_get_number(term_t l, number *n);
|
extern void PL_get_number(term_t l, number *n);
|
||||||
extern int PL_unify_atomic(term_t t, PL_atomic_t a);
|
extern int PL_unify_atomic(term_t t, PL_atomic_t a);
|
||||||
|
extern int PL_unify_termv(term_t l, va_list args);
|
||||||
extern int _PL_unify_atomic(term_t t, PL_atomic_t a);
|
extern int _PL_unify_atomic(term_t t, PL_atomic_t a);
|
||||||
extern int _PL_unify_string(term_t t, word w);
|
extern int _PL_unify_string(term_t t, word w);
|
||||||
|
|
||||||
@ -882,6 +883,32 @@ extern void unallocStream(IOSTREAM *s);
|
|||||||
extern atom_t accessLevel(void);
|
extern atom_t accessLevel(void);
|
||||||
int currentBreakLevel(void);
|
int currentBreakLevel(void);
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
int hasConsole(void);
|
||||||
|
int PL_wait_for_console_input(void *handle);
|
||||||
|
void PlMessage(const char *fm, ...);
|
||||||
|
const char *WinError(void);
|
||||||
|
word pl_win_exec(term_t cmd, term_t how);
|
||||||
|
foreign_t pl_win_module_file(term_t module, term_t file);
|
||||||
|
|
||||||
|
#ifdef EMULATE_DLOPEN
|
||||||
|
/* file is in UTF-8, POSIX path */
|
||||||
|
void *dlopen(const char *file, int flags);
|
||||||
|
const char *dlerror(void);
|
||||||
|
void *dlsym(void *handle, char *symbol);
|
||||||
|
int dlclose(void *handle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int ms_snprintf(char *buffer, size_t count, const char *fmt, ...);
|
||||||
|
void getDefaultsFromRegistry(void);
|
||||||
|
|
||||||
|
DWORD RunSilent(const char* strCommand);
|
||||||
|
FILE *pt_popen(const char *cmd, const char *mode);
|
||||||
|
int pt_pclose(FILE *fd);
|
||||||
|
|
||||||
|
int PL_w32thread_raise(DWORD id, int sig);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const PL_extension PL_predicates_from_ctype[];
|
extern const PL_extension PL_predicates_from_ctype[];
|
||||||
extern const PL_extension PL_predicates_from_file[];
|
extern const PL_extension PL_predicates_from_file[];
|
||||||
extern const PL_extension PL_predicates_from_files[];
|
extern const PL_extension PL_predicates_from_files[];
|
||||||
|
@ -309,14 +309,14 @@ OpenList(int n USES_REGS)
|
|||||||
Term t;
|
Term t;
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
|
|
||||||
while (H+2*n > ASP-1024) {
|
while (HR+2*n > ASP-1024) {
|
||||||
if (!Yap_dogc( 0, NULL PASS_REGS )) {
|
if (!Yap_dogc( 0, NULL PASS_REGS )) {
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t = AbsPair(H);
|
t = AbsPair(HR);
|
||||||
H += 2*n;
|
HR += 2*n;
|
||||||
|
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
return t;
|
return t;
|
||||||
|
4
H/qly.h
4
H/qly.h
@ -111,7 +111,7 @@ typedef enum {
|
|||||||
#define CHECK(F) { size_t r = (F); if (!r) return r; }
|
#define CHECK(F) { size_t r = (F); if (!r) return r; }
|
||||||
#define RCHECK(F) if(!(F)) { QLYR_ERROR(MISMATCH); return; }
|
#define RCHECK(F) if(!(F)) { QLYR_ERROR(MISMATCH); return; }
|
||||||
|
|
||||||
#define AllocTempSpace() (H)
|
#define AllocTempSpace() (HR)
|
||||||
#define EnoughTempSpace(sz) ((ASP-H)*sizeof(CELL) > sz)
|
#define EnoughTempSpace(sz) ((ASP-HR)*sizeof(CELL) > sz)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1116,7 +1116,7 @@ INLINE_ONLY inline EXTERN int IsGlobal__ (CELL CACHE_TYPE);
|
|||||||
INLINE_ONLY inline EXTERN int
|
INLINE_ONLY inline EXTERN int
|
||||||
IsGlobal__ (CELL reg USES_REGS)
|
IsGlobal__ (CELL reg USES_REGS)
|
||||||
{
|
{
|
||||||
return (int) (IN_BETWEEN (LOCAL_GlobalBase, reg, H));
|
return (int) (IN_BETWEEN (LOCAL_GlobalBase, reg, HR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
/* skip, this is a problem because we lose information,
|
/* skip, this is a problem because we lose information,
|
||||||
namely active references */
|
namely active references */
|
||||||
pt1 = (tr_fr_ptr)pt;
|
pt1 = (tr_fr_ptr)pt;
|
||||||
} else if (IN_BETWEEN(H0,pt,H) && IsAttVar(pt)) {
|
} else if (IN_BETWEEN(H0,pt,HR) && IsAttVar(pt)) {
|
||||||
CELL val = Deref(*pt);
|
CELL val = Deref(*pt);
|
||||||
if (IsVarTerm(val)) {
|
if (IsVarTerm(val)) {
|
||||||
Bind(pt, MkAtomTerm(AtomCut));
|
Bind(pt, MkAtomTerm(AtomCut));
|
||||||
|
@ -107,7 +107,7 @@ A contains the address of the variable that is to be trailed
|
|||||||
|
|
||||||
#define RESET_VARIABLE(V) (*(CELL *)(V) = 0)
|
#define RESET_VARIABLE(V) (*(CELL *)(V) = 0)
|
||||||
|
|
||||||
#if SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT
|
#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
|
||||||
inline EXTERN void
|
inline EXTERN void
|
||||||
AlignGlobalForDouble(void)
|
AlignGlobalForDouble(void)
|
||||||
{
|
{
|
||||||
@ -118,7 +118,7 @@ AlignGlobalForDouble(void)
|
|||||||
H++;
|
H++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* SIZEOF_DOUBLE == 2*SIZEOF_LONG_INT */
|
#endif /* SIZEOF_DOUBLE == 2*SIZEOF_INT_P */
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
|
|
||||||
|
@ -43,11 +43,11 @@
|
|||||||
gcp = NORM_CP(YENV); \
|
gcp = NORM_CP(YENV); \
|
||||||
SgFr_gen_cp(SG_FR) = gcp; \
|
SgFr_gen_cp(SG_FR) = gcp; \
|
||||||
/* store generator choice point */ \
|
/* store generator choice point */ \
|
||||||
HBREG = H; \
|
HBREG = HR; \
|
||||||
store_yaam_reg_cpdepth(gcp); \
|
store_yaam_reg_cpdepth(gcp); \
|
||||||
gcp->cp_tr = TR; \
|
gcp->cp_tr = TR; \
|
||||||
gcp->cp_ap = (yamop *)(AP); \
|
gcp->cp_ap = (yamop *)(AP); \
|
||||||
gcp->cp_h = H; \
|
gcp->cp_h = HR; \
|
||||||
gcp->cp_b = B; \
|
gcp->cp_b = B; \
|
||||||
gcp->cp_env = ENV; \
|
gcp->cp_env = ENV; \
|
||||||
gcp->cp_cp = CPREG; \
|
gcp->cp_cp = CPREG; \
|
||||||
@ -55,7 +55,7 @@
|
|||||||
/* go local */ \
|
/* go local */ \
|
||||||
register dep_fr_ptr new_dep_fr; \
|
register dep_fr_ptr new_dep_fr; \
|
||||||
/* adjust freeze registers */ \
|
/* adjust freeze registers */ \
|
||||||
H_FZ = H; \
|
H_FZ = HR; \
|
||||||
B_FZ = gcp; \
|
B_FZ = gcp; \
|
||||||
TR_FZ = TR; \
|
TR_FZ = TR; \
|
||||||
/* store dependency frame */ \
|
/* store dependency frame */ \
|
||||||
@ -85,12 +85,12 @@
|
|||||||
gcp = NORM_CP(YENV); \
|
gcp = NORM_CP(YENV); \
|
||||||
SgFr_gen_cp(SG_FR) = gcp; \
|
SgFr_gen_cp(SG_FR) = gcp; \
|
||||||
/* store deterministic generator choice point */ \
|
/* store deterministic generator choice point */ \
|
||||||
HBREG = H; \
|
HBREG = HR; \
|
||||||
store_yaam_reg_cpdepth(gcp); \
|
store_yaam_reg_cpdepth(gcp); \
|
||||||
gcp->cp_ap = COMPLETION; \
|
gcp->cp_ap = COMPLETION; \
|
||||||
gcp->cp_b = B; \
|
gcp->cp_b = B; \
|
||||||
gcp->cp_tr = TR; \
|
gcp->cp_tr = TR; \
|
||||||
gcp->cp_h = H; \
|
gcp->cp_h = HR; \
|
||||||
DET_GEN_CP(gcp)->cp_sg_fr = SG_FR; \
|
DET_GEN_CP(gcp)->cp_sg_fr = SG_FR; \
|
||||||
store_low_level_trace_info(DET_GEN_CP(gcp), TAB_ENT); \
|
store_low_level_trace_info(DET_GEN_CP(gcp), TAB_ENT); \
|
||||||
set_cut((CELL *)gcp, B); \
|
set_cut((CELL *)gcp, B); \
|
||||||
@ -120,11 +120,11 @@
|
|||||||
gccp = NORM_CP(YENV); \
|
gccp = NORM_CP(YENV); \
|
||||||
SgFr_gen_cp(SG_FR) = gccp; \
|
SgFr_gen_cp(SG_FR) = gccp; \
|
||||||
/* store generator choice point */ \
|
/* store generator choice point */ \
|
||||||
HBREG = H; \
|
HBREG = HR; \
|
||||||
store_yaam_reg_cpdepth(gccp); \
|
store_yaam_reg_cpdepth(gccp); \
|
||||||
gccp->cp_tr = TR; \
|
gccp->cp_tr = TR; \
|
||||||
gccp->cp_ap = ANSWER_RESOLUTION_COMPLETION; \
|
gccp->cp_ap = ANSWER_RESOLUTION_COMPLETION; \
|
||||||
gccp->cp_h = H; \
|
gccp->cp_h = HR; \
|
||||||
gccp->cp_b = B; \
|
gccp->cp_b = B; \
|
||||||
gccp->cp_env = ENV; \
|
gccp->cp_env = ENV; \
|
||||||
gccp->cp_cp = CPREG; \
|
gccp->cp_cp = CPREG; \
|
||||||
@ -135,7 +135,7 @@
|
|||||||
GEN_CP(gccp)->cp_dep_fr = LOCAL_top_dep_fr; \
|
GEN_CP(gccp)->cp_dep_fr = LOCAL_top_dep_fr; \
|
||||||
GEN_CP(gccp)->cp_sg_fr = SG_FR; \
|
GEN_CP(gccp)->cp_sg_fr = SG_FR; \
|
||||||
/* adjust freeze registers */ \
|
/* adjust freeze registers */ \
|
||||||
H_FZ = H; \
|
H_FZ = HR; \
|
||||||
B_FZ = gccp; \
|
B_FZ = gccp; \
|
||||||
TR_FZ = TR; \
|
TR_FZ = TR; \
|
||||||
store_low_level_trace_info(GEN_CP(gccp), TAB_ENT); \
|
store_low_level_trace_info(GEN_CP(gccp), TAB_ENT); \
|
||||||
@ -152,7 +152,7 @@
|
|||||||
{ register CELL *pt_args, *x_args; \
|
{ register CELL *pt_args, *x_args; \
|
||||||
register choiceptr gcp = B; \
|
register choiceptr gcp = B; \
|
||||||
/* restore generator choice point */ \
|
/* restore generator choice point */ \
|
||||||
H = HBREG = PROTECT_FROZEN_H(gcp); \
|
HR = HBREG = PROTECT_FROZEN_H(gcp); \
|
||||||
restore_yaam_reg_cpdepth(gcp); \
|
restore_yaam_reg_cpdepth(gcp); \
|
||||||
CPREG = gcp->cp_cp; \
|
CPREG = gcp->cp_cp; \
|
||||||
ENV = gcp->cp_env; \
|
ENV = gcp->cp_env; \
|
||||||
@ -174,7 +174,7 @@
|
|||||||
{ register CELL *pt_args, *x_args; \
|
{ register CELL *pt_args, *x_args; \
|
||||||
register choiceptr gcp = B; \
|
register choiceptr gcp = B; \
|
||||||
/* pop generator choice point */ \
|
/* pop generator choice point */ \
|
||||||
H = PROTECT_FROZEN_H(gcp); \
|
HR = PROTECT_FROZEN_H(gcp); \
|
||||||
pop_yaam_reg_cpdepth(gcp); \
|
pop_yaam_reg_cpdepth(gcp); \
|
||||||
CPREG = gcp->cp_cp; \
|
CPREG = gcp->cp_cp; \
|
||||||
ENV = gcp->cp_env; \
|
ENV = gcp->cp_env; \
|
||||||
@ -202,7 +202,7 @@
|
|||||||
YENV = (CELL *) (CONS_CP(YENV) - 1); \
|
YENV = (CELL *) (CONS_CP(YENV) - 1); \
|
||||||
ccp = NORM_CP(YENV); \
|
ccp = NORM_CP(YENV); \
|
||||||
/* adjust freeze registers */ \
|
/* adjust freeze registers */ \
|
||||||
H_FZ = H; \
|
H_FZ = HR; \
|
||||||
B_FZ = ccp; \
|
B_FZ = ccp; \
|
||||||
TR_FZ = TR; \
|
TR_FZ = TR; \
|
||||||
/* store dependency frame */ \
|
/* store dependency frame */ \
|
||||||
@ -210,11 +210,11 @@
|
|||||||
LEADER_CP, ccp, SG_FR, FALSE, LOCAL_top_dep_fr); \
|
LEADER_CP, ccp, SG_FR, FALSE, LOCAL_top_dep_fr); \
|
||||||
LOCAL_top_dep_fr = new_dep_fr; \
|
LOCAL_top_dep_fr = new_dep_fr; \
|
||||||
/* store consumer choice point */ \
|
/* store consumer choice point */ \
|
||||||
HBREG = H; \
|
HBREG = HR; \
|
||||||
store_yaam_reg_cpdepth(ccp); \
|
store_yaam_reg_cpdepth(ccp); \
|
||||||
ccp->cp_tr = TR; \
|
ccp->cp_tr = TR; \
|
||||||
ccp->cp_ap = ANSWER_RESOLUTION; \
|
ccp->cp_ap = ANSWER_RESOLUTION; \
|
||||||
ccp->cp_h = H; \
|
ccp->cp_h = HR; \
|
||||||
ccp->cp_b = B; \
|
ccp->cp_b = B; \
|
||||||
ccp->cp_env= ENV; \
|
ccp->cp_env= ENV; \
|
||||||
ccp->cp_cp = CPREG; \
|
ccp->cp_cp = CPREG; \
|
||||||
@ -232,7 +232,7 @@
|
|||||||
#define consume_answer_and_procceed(DEP_FR, ANSWER) \
|
#define consume_answer_and_procceed(DEP_FR, ANSWER) \
|
||||||
{ CELL *subs_ptr; \
|
{ CELL *subs_ptr; \
|
||||||
/* restore consumer choice point */ \
|
/* restore consumer choice point */ \
|
||||||
H = HBREG = PROTECT_FROZEN_H(B); \
|
HR = HBREG = PROTECT_FROZEN_H(B); \
|
||||||
restore_yaam_reg_cpdepth(B); \
|
restore_yaam_reg_cpdepth(B); \
|
||||||
CPREG = B->cp_cp; \
|
CPREG = B->cp_cp; \
|
||||||
ENV = B->cp_env; \
|
ENV = B->cp_env; \
|
||||||
@ -257,7 +257,7 @@
|
|||||||
#define consume_answer_and_procceed(DEP_FR, ANSWER) \
|
#define consume_answer_and_procceed(DEP_FR, ANSWER) \
|
||||||
{ CELL *subs_ptr; \
|
{ CELL *subs_ptr; \
|
||||||
/* restore consumer choice point */ \
|
/* restore consumer choice point */ \
|
||||||
H = HBREG = PROTECT_FROZEN_H(B); \
|
HR = HBREG = PROTECT_FROZEN_H(B); \
|
||||||
restore_yaam_reg_cpdepth(B); \
|
restore_yaam_reg_cpdepth(B); \
|
||||||
CPREG = B->cp_cp; \
|
CPREG = B->cp_cp; \
|
||||||
ENV = B->cp_env; \
|
ENV = B->cp_env; \
|
||||||
@ -287,11 +287,11 @@
|
|||||||
/* initialize lcp */ \
|
/* initialize lcp */ \
|
||||||
lcp = NORM_CP(LOAD_CP(YENV) - 1); \
|
lcp = NORM_CP(LOAD_CP(YENV) - 1); \
|
||||||
/* store loader choice point */ \
|
/* store loader choice point */ \
|
||||||
HBREG = H; \
|
HBREG = HR; \
|
||||||
store_yaam_reg_cpdepth(lcp); \
|
store_yaam_reg_cpdepth(lcp); \
|
||||||
lcp->cp_tr = TR; \
|
lcp->cp_tr = TR; \
|
||||||
lcp->cp_ap = LOAD_ANSWER; \
|
lcp->cp_ap = LOAD_ANSWER; \
|
||||||
lcp->cp_h = H; \
|
lcp->cp_h = HR; \
|
||||||
lcp->cp_b = B; \
|
lcp->cp_b = B; \
|
||||||
lcp->cp_env= ENV; \
|
lcp->cp_env= ENV; \
|
||||||
lcp->cp_cp = CPREG; \
|
lcp->cp_cp = CPREG; \
|
||||||
@ -306,7 +306,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define restore_loader_node(ANSWER) \
|
#define restore_loader_node(ANSWER) \
|
||||||
H = HBREG = PROTECT_FROZEN_H(B); \
|
HR = HBREG = PROTECT_FROZEN_H(B); \
|
||||||
restore_yaam_reg_cpdepth(B); \
|
restore_yaam_reg_cpdepth(B); \
|
||||||
CPREG = B->cp_cp; \
|
CPREG = B->cp_cp; \
|
||||||
ENV = B->cp_env; \
|
ENV = B->cp_env; \
|
||||||
@ -315,7 +315,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define pop_loader_node() \
|
#define pop_loader_node() \
|
||||||
H = PROTECT_FROZEN_H(B); \
|
HR = PROTECT_FROZEN_H(B); \
|
||||||
pop_yaam_reg_cpdepth(B); \
|
pop_yaam_reg_cpdepth(B); \
|
||||||
CPREG = B->cp_cp; \
|
CPREG = B->cp_cp; \
|
||||||
TABLING_close_alt(B); \
|
TABLING_close_alt(B); \
|
||||||
@ -412,7 +412,7 @@
|
|||||||
if(ans_node) {
|
if(ans_node) {
|
||||||
CELL *subs_ptr = (CELL *) (GEN_CP(B) + 1) + SgFr_arity(sg_fr);
|
CELL *subs_ptr = (CELL *) (GEN_CP(B) + 1) + SgFr_arity(sg_fr);
|
||||||
|
|
||||||
H = HBREG = PROTECT_FROZEN_H(B);
|
HR = HBREG = PROTECT_FROZEN_H(B);
|
||||||
restore_yaam_reg_cpdepth(B);
|
restore_yaam_reg_cpdepth(B);
|
||||||
CPREG = B->cp_cp;
|
CPREG = B->cp_cp;
|
||||||
ENV = B->cp_env;
|
ENV = B->cp_env;
|
||||||
@ -529,7 +529,9 @@
|
|||||||
} else if (SgFr_state(sg_fr) == evaluating) {
|
} else if (SgFr_state(sg_fr) == evaluating) {
|
||||||
/* subgoal in evaluation */
|
/* subgoal in evaluation */
|
||||||
choiceptr leader_cp;
|
choiceptr leader_cp;
|
||||||
|
#if YAPOR
|
||||||
int leader_dep_on_stack;
|
int leader_dep_on_stack;
|
||||||
|
#endif
|
||||||
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
UNLOCK_SG_FR(sg_fr);
|
UNLOCK_SG_FR(sg_fr);
|
||||||
find_leader_node(leader_cp, leader_dep_on_stack);
|
find_leader_node(leader_cp, leader_dep_on_stack);
|
||||||
@ -669,7 +671,9 @@
|
|||||||
} else if (SgFr_state(sg_fr) == evaluating) {
|
} else if (SgFr_state(sg_fr) == evaluating) {
|
||||||
/* subgoal in evaluation */
|
/* subgoal in evaluation */
|
||||||
choiceptr leader_cp;
|
choiceptr leader_cp;
|
||||||
int leader_dep_on_stack;
|
#if YAPOR
|
||||||
|
int leader_dep_on_stack;
|
||||||
|
#endif
|
||||||
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
UNLOCK_SG_FR(sg_fr);
|
UNLOCK_SG_FR(sg_fr);
|
||||||
find_leader_node(leader_cp, leader_dep_on_stack);
|
find_leader_node(leader_cp, leader_dep_on_stack);
|
||||||
@ -809,7 +813,9 @@
|
|||||||
} else if (SgFr_state(sg_fr) == evaluating) {
|
} else if (SgFr_state(sg_fr) == evaluating) {
|
||||||
/* subgoal in evaluation */
|
/* subgoal in evaluation */
|
||||||
choiceptr leader_cp;
|
choiceptr leader_cp;
|
||||||
|
#if YAPOR
|
||||||
int leader_dep_on_stack;
|
int leader_dep_on_stack;
|
||||||
|
#endif
|
||||||
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
|
||||||
UNLOCK_SG_FR(sg_fr);
|
UNLOCK_SG_FR(sg_fr);
|
||||||
find_leader_node(leader_cp, leader_dep_on_stack);
|
find_leader_node(leader_cp, leader_dep_on_stack);
|
||||||
|
@ -289,8 +289,7 @@ typedef enum {
|
|||||||
DepFr_init_timestamp_field(DEP_FR)
|
DepFr_init_timestamp_field(DEP_FR)
|
||||||
#else
|
#else
|
||||||
#define find_dependency_node(SG_FR, LEADER_CP, DEP_ON_STACK) \
|
#define find_dependency_node(SG_FR, LEADER_CP, DEP_ON_STACK) \
|
||||||
LEADER_CP = SgFr_gen_cp(SG_FR); \
|
LEADER_CP = SgFr_gen_cp(SG_FR)
|
||||||
DEP_ON_STACK = TRUE
|
|
||||||
#define find_leader_node(LEADER_CP, DEP_ON_STACK) \
|
#define find_leader_node(LEADER_CP, DEP_ON_STACK) \
|
||||||
{ dep_fr_ptr chain_dep_fr = LOCAL_top_dep_fr; \
|
{ dep_fr_ptr chain_dep_fr = LOCAL_top_dep_fr; \
|
||||||
while (YOUNGER_CP(DepFr_cons_cp(chain_dep_fr), LEADER_CP)) { \
|
while (YOUNGER_CP(DepFr_cons_cp(chain_dep_fr), LEADER_CP)) { \
|
||||||
@ -1127,7 +1126,7 @@ static inline void __unbind_variables(tr_fr_ptr unbind_tr, tr_fr_ptr end_tr USES
|
|||||||
static inline void __rebind_variables(tr_fr_ptr rebind_tr, tr_fr_ptr end_tr USES_REGS) {
|
static inline void __rebind_variables(tr_fr_ptr rebind_tr, tr_fr_ptr end_tr USES_REGS) {
|
||||||
TABLING_ERROR_CHECKING(rebind_variables, rebind_tr < end_tr);
|
TABLING_ERROR_CHECKING(rebind_variables, rebind_tr < end_tr);
|
||||||
/* rebind loop */
|
/* rebind loop */
|
||||||
Yap_NEW_MAHASH((ma_h_inner_struct *)H PASS_REGS);
|
Yap_NEW_MAHASH((ma_h_inner_struct *)HR PASS_REGS);
|
||||||
while (rebind_tr != end_tr) {
|
while (rebind_tr != end_tr) {
|
||||||
CELL ref = (CELL) TrailTerm(--rebind_tr);
|
CELL ref = (CELL) TrailTerm(--rebind_tr);
|
||||||
/* check for global or local variables */
|
/* check for global or local variables */
|
||||||
@ -1162,7 +1161,7 @@ static inline void __restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr U
|
|||||||
|
|
||||||
TABLING_ERROR_CHECKING(restore_variables, unbind_tr < rebind_tr);
|
TABLING_ERROR_CHECKING(restore_variables, unbind_tr < rebind_tr);
|
||||||
end_tr = rebind_tr;
|
end_tr = rebind_tr;
|
||||||
Yap_NEW_MAHASH((ma_h_inner_struct *)H PASS_REGS);
|
Yap_NEW_MAHASH((ma_h_inner_struct *)HR PASS_REGS);
|
||||||
while (unbind_tr != end_tr) {
|
while (unbind_tr != end_tr) {
|
||||||
/* unbind loop */
|
/* unbind loop */
|
||||||
while (unbind_tr > end_tr) {
|
while (unbind_tr > end_tr) {
|
||||||
|
1474
OPTYap/tab.tries.c
1474
OPTYap/tab.tries.c
File diff suppressed because it is too large
Load Diff
@ -18,7 +18,7 @@
|
|||||||
#ifdef MODE_GLOBAL_TRIE_ENTRY
|
#ifdef MODE_GLOBAL_TRIE_ENTRY
|
||||||
#define INCREMENT_GLOBAL_TRIE_REFERENCE(ENTRY) \
|
#define INCREMENT_GLOBAL_TRIE_REFERENCE(ENTRY) \
|
||||||
{ register gt_node_ptr entry_node = (gt_node_ptr) (ENTRY); \
|
{ register gt_node_ptr entry_node = (gt_node_ptr) (ENTRY); \
|
||||||
TrNode_child(entry_node) = (gt_node_ptr) ((unsigned long int) TrNode_child(entry_node) + 1); \
|
TrNode_child(entry_node) = (gt_node_ptr) ((UInt) TrNode_child(entry_node) + 1); \
|
||||||
}
|
}
|
||||||
#define NEW_SUBGOAL_TRIE_NODE(NODE, ENTRY, CHILD, PARENT, NEXT) \
|
#define NEW_SUBGOAL_TRIE_NODE(NODE, ENTRY, CHILD, PARENT, NEXT) \
|
||||||
INCREMENT_GLOBAL_TRIE_REFERENCE(ENTRY); \
|
INCREMENT_GLOBAL_TRIE_REFERENCE(ENTRY); \
|
||||||
|
@ -88,10 +88,10 @@
|
|||||||
{ register choiceptr cp; \
|
{ register choiceptr cp; \
|
||||||
TOP_STACK = (CELL *) (NORM_CP(TOP_STACK) - 1); \
|
TOP_STACK = (CELL *) (NORM_CP(TOP_STACK) - 1); \
|
||||||
cp = NORM_CP(TOP_STACK); \
|
cp = NORM_CP(TOP_STACK); \
|
||||||
HBREG = H; \
|
HBREG = HR; \
|
||||||
store_yaam_reg_cpdepth(cp); \
|
store_yaam_reg_cpdepth(cp); \
|
||||||
cp->cp_tr = TR; \
|
cp->cp_tr = TR; \
|
||||||
cp->cp_h = H; \
|
cp->cp_h = HR; \
|
||||||
cp->cp_b = B; \
|
cp->cp_b = B; \
|
||||||
cp->cp_cp = CPREG; \
|
cp->cp_cp = CPREG; \
|
||||||
cp->cp_ap = (yamop *) AP; \
|
cp->cp_ap = (yamop *) AP; \
|
||||||
@ -104,7 +104,7 @@
|
|||||||
copy_aux_stack()
|
copy_aux_stack()
|
||||||
|
|
||||||
#define restore_trie_node(AP) \
|
#define restore_trie_node(AP) \
|
||||||
H = HBREG = PROTECT_FROZEN_H(B); \
|
HR = HBREG = PROTECT_FROZEN_H(B); \
|
||||||
restore_yaam_reg_cpdepth(B); \
|
restore_yaam_reg_cpdepth(B); \
|
||||||
CPREG = B->cp_cp; \
|
CPREG = B->cp_cp; \
|
||||||
ENV = B->cp_env; \
|
ENV = B->cp_env; \
|
||||||
@ -116,7 +116,7 @@
|
|||||||
|
|
||||||
#define really_pop_trie_node() \
|
#define really_pop_trie_node() \
|
||||||
TOP_STACK = (CELL *) PROTECT_FROZEN_B((B + 1)); \
|
TOP_STACK = (CELL *) PROTECT_FROZEN_B((B + 1)); \
|
||||||
H = PROTECT_FROZEN_H(B); \
|
HR = PROTECT_FROZEN_H(B); \
|
||||||
pop_yaam_reg_cpdepth(B); \
|
pop_yaam_reg_cpdepth(B); \
|
||||||
CPREG = B->cp_cp; \
|
CPREG = B->cp_cp; \
|
||||||
TABLING_close_alt(B); \
|
TABLING_close_alt(B); \
|
||||||
@ -182,16 +182,16 @@
|
|||||||
|
|
||||||
#define aux_stack_term_in_pair_instr() \
|
#define aux_stack_term_in_pair_instr() \
|
||||||
if (heap_arity) { \
|
if (heap_arity) { \
|
||||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(H)); \
|
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||||
} else { \
|
} else { \
|
||||||
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(H)); \
|
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||||
TOP_STACK = &aux_stack[-1]; \
|
TOP_STACK = &aux_stack[-1]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
||||||
} \
|
} \
|
||||||
Bind_Global(H, TrNode_entry(node)); \
|
Bind_Global(HR, TrNode_entry(node)); \
|
||||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (H + 1); \
|
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (HR + 1); \
|
||||||
H += 2; \
|
HR += 2; \
|
||||||
next_trie_instruction(node)
|
next_trie_instruction(node)
|
||||||
|
|
||||||
|
|
||||||
@ -202,33 +202,33 @@
|
|||||||
|
|
||||||
#define aux_stack_new_pair_instr() /* for term 'CompactPairInit' */ \
|
#define aux_stack_new_pair_instr() /* for term 'CompactPairInit' */ \
|
||||||
if (heap_arity) { \
|
if (heap_arity) { \
|
||||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(H)); \
|
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||||
TOP_STACK = &aux_stack[-1]; \
|
TOP_STACK = &aux_stack[-1]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + 1; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + 1; \
|
||||||
} else { \
|
} else { \
|
||||||
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(H)); \
|
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||||
TOP_STACK = &aux_stack[-2]; \
|
TOP_STACK = &aux_stack[-2]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = 2; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = 2; \
|
||||||
} \
|
} \
|
||||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) H; \
|
TOP_STACK[HEAP_ENTRY(1)] = (CELL) HR; \
|
||||||
TOP_STACK[HEAP_ENTRY(2)] = (CELL) (H + 1); \
|
TOP_STACK[HEAP_ENTRY(2)] = (CELL) (HR + 1); \
|
||||||
H += 2; \
|
HR += 2; \
|
||||||
next_trie_instruction(node)
|
next_trie_instruction(node)
|
||||||
|
|
||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
#define aux_stack_pair_instr() /* for term 'CompactPairEndList' */ \
|
#define aux_stack_pair_instr() /* for term 'CompactPairEndList' */ \
|
||||||
if (heap_arity) { \
|
if (heap_arity) { \
|
||||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(H)); \
|
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||||
} else { \
|
} else { \
|
||||||
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(H)); \
|
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||||
TOP_STACK = &aux_stack[-1]; \
|
TOP_STACK = &aux_stack[-1]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
||||||
} \
|
} \
|
||||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) H; \
|
TOP_STACK[HEAP_ENTRY(1)] = (CELL) HR; \
|
||||||
Bind_Global(H + 1, TermNil); \
|
Bind_Global(HR + 1, TermNil); \
|
||||||
H += 2; \
|
HR += 2; \
|
||||||
next_trie_instruction(node)
|
next_trie_instruction(node)
|
||||||
#else
|
#else
|
||||||
#define aux_stack_pair_instr() \
|
#define aux_stack_pair_instr() \
|
||||||
@ -243,43 +243,43 @@
|
|||||||
|
|
||||||
#define aux_stack_appl_instr() \
|
#define aux_stack_appl_instr() \
|
||||||
if (heap_arity) { \
|
if (heap_arity) { \
|
||||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsAppl(H)); \
|
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsAppl(HR)); \
|
||||||
TOP_STACK = &aux_stack[-func_arity + 1]; \
|
TOP_STACK = &aux_stack[-func_arity + 1]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + func_arity - 1; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + func_arity - 1; \
|
||||||
} else { \
|
} else { \
|
||||||
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsAppl(H)); \
|
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsAppl(HR)); \
|
||||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||||
TOP_STACK = &aux_stack[-func_arity]; \
|
TOP_STACK = &aux_stack[-func_arity]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = func_arity; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = func_arity; \
|
||||||
} \
|
} \
|
||||||
*H = (CELL) func; \
|
*HR = (CELL) func; \
|
||||||
{ int i; \
|
{ int i; \
|
||||||
for (i = 1; i <= func_arity; i++) \
|
for (i = 1; i <= func_arity; i++) \
|
||||||
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (H + i); \
|
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (HR + i); \
|
||||||
} \
|
} \
|
||||||
H += 1 + func_arity; \
|
HR += 1 + func_arity; \
|
||||||
next_trie_instruction(node)
|
next_trie_instruction(node)
|
||||||
|
|
||||||
#define aux_stack_appl_in_pair_instr() \
|
#define aux_stack_appl_in_pair_instr() \
|
||||||
if (heap_arity) { \
|
if (heap_arity) { \
|
||||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(H)); \
|
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||||
TOP_STACK = &aux_stack[-func_arity]; \
|
TOP_STACK = &aux_stack[-func_arity]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + func_arity; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + func_arity; \
|
||||||
} else { \
|
} else { \
|
||||||
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(H)); \
|
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||||
TOP_STACK = &aux_stack[-func_arity - 1]; \
|
TOP_STACK = &aux_stack[-func_arity - 1]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = func_arity + 1; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = func_arity + 1; \
|
||||||
} \
|
} \
|
||||||
TOP_STACK[HEAP_ENTRY(func_arity + 1)] = (CELL) (H + 1); \
|
TOP_STACK[HEAP_ENTRY(func_arity + 1)] = (CELL) (HR + 1); \
|
||||||
Bind_Global(H, AbsAppl(H + 2)); \
|
Bind_Global(HR, AbsAppl(HR + 2)); \
|
||||||
H += 2; \
|
HR += 2; \
|
||||||
*H = (CELL) func; \
|
*HR = (CELL) func; \
|
||||||
{ int i; \
|
{ int i; \
|
||||||
for (i = 1; i <= func_arity; i++) \
|
for (i = 1; i <= func_arity; i++) \
|
||||||
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (H + i); \
|
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (HR + i); \
|
||||||
} \
|
} \
|
||||||
H += 1 + func_arity; \
|
HR += 1 + func_arity; \
|
||||||
next_trie_instruction(node)
|
next_trie_instruction(node)
|
||||||
|
|
||||||
|
|
||||||
@ -312,23 +312,23 @@
|
|||||||
#define aux_stack_var_in_pair_instr() \
|
#define aux_stack_var_in_pair_instr() \
|
||||||
if (heap_arity) { \
|
if (heap_arity) { \
|
||||||
int i; \
|
int i; \
|
||||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(H)); \
|
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||||
TOP_STACK = &aux_stack[-1]; \
|
TOP_STACK = &aux_stack[-1]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity; \
|
||||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (H + 1); \
|
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (HR + 1); \
|
||||||
for (i = 2; i <= heap_arity; i++) \
|
for (i = 2; i <= heap_arity; i++) \
|
||||||
TOP_STACK[HEAP_ENTRY(i)] = aux_stack[HEAP_ENTRY(i)]; \
|
TOP_STACK[HEAP_ENTRY(i)] = aux_stack[HEAP_ENTRY(i)]; \
|
||||||
} else { \
|
} else { \
|
||||||
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(H)); \
|
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||||
TOP_STACK = &aux_stack[-2]; \
|
TOP_STACK = &aux_stack[-2]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
||||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (H + 1); \
|
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (HR + 1); \
|
||||||
} \
|
} \
|
||||||
aux_stack[VARS_ARITY_ENTRY - 1] = vars_arity + 1; \
|
aux_stack[VARS_ARITY_ENTRY - 1] = vars_arity + 1; \
|
||||||
aux_stack[VARS_ENTRY(vars_arity + 1)] = (CELL) H; \
|
aux_stack[VARS_ENTRY(vars_arity + 1)] = (CELL) HR; \
|
||||||
RESET_VARIABLE((CELL) H); \
|
RESET_VARIABLE((CELL) HR); \
|
||||||
H += 2; \
|
HR += 2; \
|
||||||
next_trie_instruction(node)
|
next_trie_instruction(node)
|
||||||
|
|
||||||
|
|
||||||
@ -358,19 +358,19 @@
|
|||||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||||
aux_var = aux_stack[VARS_ENTRY(var_index + 1)]; \
|
aux_var = aux_stack[VARS_ENTRY(var_index + 1)]; \
|
||||||
if (aux_sub > aux_var) { \
|
if (aux_sub > aux_var) { \
|
||||||
if ((CELL *) aux_sub <= H) { \
|
if ((CELL *) aux_sub <= HR) { \
|
||||||
Bind_Global((CELL *) aux_sub, aux_var); \
|
Bind_Global((CELL *) aux_sub, aux_var); \
|
||||||
} else if ((CELL *) aux_var <= H) { \
|
} else if ((CELL *) aux_var <= HR) { \
|
||||||
Bind_Local((CELL *) aux_sub, aux_var); \
|
Bind_Local((CELL *) aux_sub, aux_var); \
|
||||||
} else { \
|
} else { \
|
||||||
Bind_Local((CELL *) aux_var, aux_sub); \
|
Bind_Local((CELL *) aux_var, aux_sub); \
|
||||||
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
if ((CELL *) aux_var <= H) { \
|
if ((CELL *) aux_var <= HR) { \
|
||||||
Bind_Global((CELL *) aux_var, aux_sub); \
|
Bind_Global((CELL *) aux_var, aux_sub); \
|
||||||
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
||||||
} else if ((CELL *) aux_sub <= H) { \
|
} else if ((CELL *) aux_sub <= HR) { \
|
||||||
Bind_Local((CELL *) aux_var, aux_sub); \
|
Bind_Local((CELL *) aux_var, aux_sub); \
|
||||||
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
||||||
} else { \
|
} else { \
|
||||||
@ -382,15 +382,15 @@
|
|||||||
|
|
||||||
#define aux_stack_val_in_pair_instr() \
|
#define aux_stack_val_in_pair_instr() \
|
||||||
if (heap_arity) { \
|
if (heap_arity) { \
|
||||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(H)); \
|
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||||
} else { \
|
} else { \
|
||||||
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(H)); \
|
Bind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||||
TOP_STACK = &aux_stack[-1]; \
|
TOP_STACK = &aux_stack[-1]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
||||||
} \
|
} \
|
||||||
{ CELL aux_sub, aux_var; \
|
{ CELL aux_sub, aux_var; \
|
||||||
aux_sub = (CELL) H; \
|
aux_sub = (CELL) HR; \
|
||||||
aux_var = aux_stack[VARS_ENTRY(var_index + 1)]; \
|
aux_var = aux_stack[VARS_ENTRY(var_index + 1)]; \
|
||||||
if (aux_sub > aux_var) { \
|
if (aux_sub > aux_var) { \
|
||||||
Bind_Global((CELL *) aux_sub, aux_var); \
|
Bind_Global((CELL *) aux_sub, aux_var); \
|
||||||
@ -400,8 +400,8 @@
|
|||||||
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (H + 1); \
|
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (HR + 1); \
|
||||||
H += 2; \
|
HR += 2; \
|
||||||
next_trie_instruction(node)
|
next_trie_instruction(node)
|
||||||
|
|
||||||
|
|
||||||
|
24
configure
vendored
24
configure
vendored
@ -852,7 +852,6 @@ enable_use_malloc
|
|||||||
enable_condor
|
enable_condor
|
||||||
enable_chr
|
enable_chr
|
||||||
enable_clpqr
|
enable_clpqr
|
||||||
enable_win64
|
|
||||||
enable_april
|
enable_april
|
||||||
enable_dlcompat
|
enable_dlcompat
|
||||||
enable_clpbn_bp
|
enable_clpbn_bp
|
||||||
@ -1529,7 +1528,6 @@ Optional Features:
|
|||||||
--enable-condor allow YAP to be used from condor
|
--enable-condor allow YAP to be used from condor
|
||||||
--enable-chr install chr library
|
--enable-chr install chr library
|
||||||
--enable-clpqr install clpqr library
|
--enable-clpqr install clpqr library
|
||||||
--enable-win64 compile YAP for win64
|
|
||||||
--enable-april compile Yap to support April ILP system
|
--enable-april compile Yap to support April ILP system
|
||||||
--enable-dlcompat use dlcompat library for dynamic loading on Mac OS X
|
--enable-dlcompat use dlcompat library for dynamic loading on Mac OS X
|
||||||
--enable-clpbn-bp enable belief propagation solver in CLPBN.
|
--enable-clpbn-bp enable belief propagation solver in CLPBN.
|
||||||
@ -4247,13 +4245,6 @@ else
|
|||||||
use_clpqr=yes
|
use_clpqr=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check whether --enable-win64 was given.
|
|
||||||
if test "${enable_win64+set}" = set; then :
|
|
||||||
enableval=$enable_win64; target_win64="$enableval"
|
|
||||||
else
|
|
||||||
target_win64=no
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-april was given.
|
# Check whether --enable-april was given.
|
||||||
if test "${enable_april+set}" = set; then :
|
if test "${enable_april+set}" = set; then :
|
||||||
@ -5096,9 +5087,7 @@ then
|
|||||||
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
|
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
|
||||||
if test "$cygwin" = "no" -o "$target_os" = "mingw32"
|
if test "$cygwin" = "no" -o "$target_os" = "mingw32"
|
||||||
then
|
then
|
||||||
if test "$target_win64" = yes
|
if test "$target_cpu" = x86_64; then
|
||||||
then
|
|
||||||
target_cpu=x86_64
|
|
||||||
YAP_TARGET=amd64
|
YAP_TARGET=amd64
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lws2_32" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lws2_32" >&5
|
||||||
@ -5219,8 +5208,7 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
EXTRA_LIBS_FOR_DLLS="-lws2_32"
|
EXTRA_LIBS_FOR_DLLS="-lws2_32"
|
||||||
elif test "$target_os" = "cygwin"
|
elif test "$target_os" = "cygwin"; then
|
||||||
then
|
|
||||||
CC="${CC} -mno-cygwin"
|
CC="${CC} -mno-cygwin"
|
||||||
CXX="${CXX} -mno-cygwin"
|
CXX="${CXX} -mno-cygwin"
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcomdlg32" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcomdlg32" >&5
|
||||||
@ -11721,7 +11709,7 @@ else
|
|||||||
JAVA_TEST=Test.java
|
JAVA_TEST=Test.java
|
||||||
CLASS_TEST=Test.class
|
CLASS_TEST=Test.class
|
||||||
cat << \EOF > $JAVA_TEST
|
cat << \EOF > $JAVA_TEST
|
||||||
/* #line 11724 "configure" */
|
/* #line 11712 "configure" */
|
||||||
public class Test {
|
public class Test {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -11897,7 +11885,7 @@ EOF
|
|||||||
if uudecode$EXEEXT Test.uue; then
|
if uudecode$EXEEXT Test.uue; then
|
||||||
ac_cv_prog_uudecode_base64=yes
|
ac_cv_prog_uudecode_base64=yes
|
||||||
else
|
else
|
||||||
echo "configure: 11900: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
|
echo "configure: 11888: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
|
||||||
echo "configure: failed file was:" >&5
|
echo "configure: failed file was:" >&5
|
||||||
cat Test.uue >&5
|
cat Test.uue >&5
|
||||||
ac_cv_prog_uudecode_base64=no
|
ac_cv_prog_uudecode_base64=no
|
||||||
@ -12028,7 +12016,7 @@ else
|
|||||||
JAVA_TEST=Test.java
|
JAVA_TEST=Test.java
|
||||||
CLASS_TEST=Test.class
|
CLASS_TEST=Test.class
|
||||||
cat << \EOF > $JAVA_TEST
|
cat << \EOF > $JAVA_TEST
|
||||||
/* #line 12031 "configure" */
|
/* #line 12019 "configure" */
|
||||||
public class Test {
|
public class Test {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -12063,7 +12051,7 @@ JAVA_TEST=Test.java
|
|||||||
CLASS_TEST=Test.class
|
CLASS_TEST=Test.class
|
||||||
TEST=Test
|
TEST=Test
|
||||||
cat << \EOF > $JAVA_TEST
|
cat << \EOF > $JAVA_TEST
|
||||||
/* [#]line 12066 "configure" */
|
/* [#]line 12054 "configure" */
|
||||||
public class Test {
|
public class Test {
|
||||||
public static void main (String args[]) {
|
public static void main (String args[]) {
|
||||||
System.exit (0);
|
System.exit (0);
|
||||||
|
11
configure.in
11
configure.in
@ -140,9 +140,6 @@ AC_ARG_ENABLE(chr,
|
|||||||
AC_ARG_ENABLE(clpqr,
|
AC_ARG_ENABLE(clpqr,
|
||||||
[ --enable-clpqr install clpqr library ],
|
[ --enable-clpqr install clpqr library ],
|
||||||
use_clpqr="$enableval", use_clpqr=yes)
|
use_clpqr="$enableval", use_clpqr=yes)
|
||||||
AC_ARG_ENABLE(win64,
|
|
||||||
[ --enable-win64 compile YAP for win64 ],
|
|
||||||
target_win64="$enableval", target_win64=no)
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(april,
|
AC_ARG_ENABLE(april,
|
||||||
[ --enable-april compile Yap to support April ILP system],
|
[ --enable-april compile Yap to support April ILP system],
|
||||||
@ -523,17 +520,13 @@ then
|
|||||||
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
|
EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows"
|
||||||
if test "$cygwin" = "no" -o "$target_os" = "mingw32"
|
if test "$cygwin" = "no" -o "$target_os" = "mingw32"
|
||||||
then
|
then
|
||||||
if test "$target_win64" = yes
|
if test "$target_cpu" = x86_64; then
|
||||||
then
|
|
||||||
dnl configure messes up badly on this.
|
|
||||||
target_cpu=x86_64
|
|
||||||
YAP_TARGET=amd64
|
YAP_TARGET=amd64
|
||||||
AC_CHECK_LIB(ws2_32,main)
|
AC_CHECK_LIB(ws2_32,main)
|
||||||
AC_CHECK_LIB(comdlg32,main)
|
AC_CHECK_LIB(comdlg32,main)
|
||||||
AC_CHECK_LIB(shell32,main)
|
AC_CHECK_LIB(shell32,main)
|
||||||
EXTRA_LIBS_FOR_DLLS="-lws2_32"
|
EXTRA_LIBS_FOR_DLLS="-lws2_32"
|
||||||
elif test "$target_os" = "cygwin"
|
elif test "$target_os" = "cygwin"; then
|
||||||
then
|
|
||||||
CC="${CC} -mno-cygwin"
|
CC="${CC} -mno-cygwin"
|
||||||
CXX="${CXX} -mno-cygwin"
|
CXX="${CXX} -mno-cygwin"
|
||||||
AC_CHECK_LIB(comdlg32,main)
|
AC_CHECK_LIB(comdlg32,main)
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
#include "SWI-Prolog.h"
|
#include "SWI-Prolog.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
int APP_main(int argc, char **argv);
|
||||||
|
/* decode ANSI color sequences (ESC[...m) */
|
||||||
|
void PL_w32_wrap_ansi_console(void);
|
||||||
|
|
||||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
This is the simple main program of swipl.exe; the SWI-Prolog console
|
This is the simple main program of swipl.exe; the SWI-Prolog console
|
||||||
application. It can be used as a basis for console-based applications
|
application. It can be used as a basis for console-based applications
|
||||||
|
@ -498,7 +498,7 @@ do_complete(RlcCompleteData data)
|
|||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
rlc_console
|
rlc_console
|
||||||
PL_current_console()
|
PL_current_console(void)
|
||||||
{ if ( Suser_input->functions->read == Srlc_read )
|
{ if ( Suser_input->functions->read == Srlc_read )
|
||||||
return Suser_input->handle;
|
return Suser_input->handle;
|
||||||
|
|
||||||
@ -765,7 +765,7 @@ pl_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
|
|
||||||
static TCHAR *
|
static TCHAR *
|
||||||
HiddenFrameClass()
|
HiddenFrameClass(void)
|
||||||
{ static TCHAR winclassname[32];
|
{ static TCHAR winclassname[32];
|
||||||
static WNDCLASS wndClass;
|
static WNDCLASS wndClass;
|
||||||
HINSTANCE instance = rlc_hinstance();
|
HINSTANCE instance = rlc_hinstance();
|
||||||
@ -842,7 +842,7 @@ fatalSignal(int sig)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initSignals()
|
initSignals(void)
|
||||||
{ signal(SIGABRT, fatalSignal);
|
{ signal(SIGABRT, fatalSignal);
|
||||||
signal(SIGFPE, fatalSignal);
|
signal(SIGFPE, fatalSignal);
|
||||||
signal(SIGILL, fatalSignal);
|
signal(SIGILL, fatalSignal);
|
||||||
|
@ -133,7 +133,7 @@ typedef enum
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define LOCAL_ERROR(v) \
|
#define LOCAL_ERROR(v) \
|
||||||
if (H + (v) > ASP-1024) { \
|
if (HR + (v) > ASP-1024) { \
|
||||||
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;\
|
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;\
|
||||||
LOCAL_Error_Term = t;\
|
LOCAL_Error_Term = t;\
|
||||||
LOCAL_Error_Size = 2*(v)*sizeof(CELL);\
|
LOCAL_Error_Size = 2*(v)*sizeof(CELL);\
|
||||||
@ -141,7 +141,7 @@ typedef enum
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define LOCAL_TERM_ERROR(v) \
|
#define LOCAL_TERM_ERROR(v) \
|
||||||
if (H + (v) > ASP-1024) { \
|
if (HR + (v) > ASP-1024) { \
|
||||||
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;\
|
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;\
|
||||||
LOCAL_Error_Term = t;\
|
LOCAL_Error_Term = t;\
|
||||||
LOCAL_Error_Size = 2*(v)*sizeof(CELL);\
|
LOCAL_Error_Size = 2*(v)*sizeof(CELL);\
|
||||||
|
@ -724,7 +724,7 @@ X_API int PL_cons_functor(term_t d, functor_t f,...)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
arity = ArityOfFunctor(ff);
|
arity = ArityOfFunctor(ff);
|
||||||
if (Unsigned(H)+arity > Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(HR)+arity > Unsigned(ASP)-CreepFlag) {
|
||||||
if (!do_gc(arity*sizeof(CELL))) {
|
if (!do_gc(arity*sizeof(CELL))) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -757,7 +757,7 @@ X_API int PL_cons_functor_v(term_t d, functor_t f, term_t a0)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
arity = ArityOfFunctor(ff);
|
arity = ArityOfFunctor(ff);
|
||||||
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(HR) > Unsigned(ASP)-CreepFlag) {
|
||||||
if (!do_gc(0)) {
|
if (!do_gc(0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -780,7 +780,7 @@ X_API int PL_cons_functor_v(term_t d, functor_t f, term_t a0)
|
|||||||
X_API int PL_cons_list(term_t d, term_t h, term_t t)
|
X_API int PL_cons_list(term_t d, term_t h, term_t t)
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(HR) > Unsigned(ASP)-CreepFlag) {
|
||||||
if (!do_gc(0)) {
|
if (!do_gc(0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -839,7 +839,7 @@ X_API int PL_put_functor(term_t t, functor_t f)
|
|||||||
Yap_PutInSlot(t,(Term)ff PASS_REGS);
|
Yap_PutInSlot(t,(Term)ff PASS_REGS);
|
||||||
} else {
|
} else {
|
||||||
arity = ArityOfFunctor(ff);
|
arity = ArityOfFunctor(ff);
|
||||||
if (Unsigned(H)+arity > Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(HR)+arity > Unsigned(ASP)-CreepFlag) {
|
||||||
if (!do_gc(arity*sizeof(CELL))) {
|
if (!do_gc(arity*sizeof(CELL))) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -888,7 +888,7 @@ X_API int PL_put_list(term_t t)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Yap_PutInSlot(t,YAP_MkNewPairTerm() PASS_REGS);
|
Yap_PutInSlot(t,YAP_MkNewPairTerm() PASS_REGS);
|
||||||
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(HR) > Unsigned(ASP)-CreepFlag) {
|
||||||
if (!do_gc(0)) {
|
if (!do_gc(0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1060,7 +1060,7 @@ X_API int PL_unify_functor(term_t t, functor_t f)
|
|||||||
Term tt = Yap_GetFromSlot(t PASS_REGS);
|
Term tt = Yap_GetFromSlot(t PASS_REGS);
|
||||||
Functor ff = SWIFunctorToFunctor(f);
|
Functor ff = SWIFunctorToFunctor(f);
|
||||||
if (IsVarTerm(tt)) {
|
if (IsVarTerm(tt)) {
|
||||||
if (Unsigned(H)+ArityOfFunctor(ff) > Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(HR)+ArityOfFunctor(ff) > Unsigned(ASP)-CreepFlag) {
|
||||||
if (!do_gc(0)) {
|
if (!do_gc(0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1112,7 +1112,7 @@ X_API int PL_unify_list(term_t tt, term_t h, term_t tail)
|
|||||||
{
|
{
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Term t;
|
Term t;
|
||||||
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(HR) > Unsigned(ASP)-CreepFlag) {
|
||||||
if (!do_gc(0)) {
|
if (!do_gc(0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1336,7 +1336,7 @@ int PL_unify_termv(term_t l, va_list ap)
|
|||||||
stack_el stack[MAX_DEPTH];
|
stack_el stack[MAX_DEPTH];
|
||||||
|
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
if (Unsigned(H) > Unsigned(ASP)-CreepFlag) {
|
if (Unsigned(HR) > Unsigned(ASP)-CreepFlag) {
|
||||||
if (!do_gc(0)) {
|
if (!do_gc(0)) {
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2086,7 +2086,7 @@ PL_open_foreign_frame(void)
|
|||||||
/* initialise a new marker choicepoint */
|
/* initialise a new marker choicepoint */
|
||||||
choiceptr cp_b = ((choiceptr)(ASP-1))-1;
|
choiceptr cp_b = ((choiceptr)(ASP-1))-1;
|
||||||
cp_b->cp_tr = TR;
|
cp_b->cp_tr = TR;
|
||||||
cp_b->cp_h = H;
|
cp_b->cp_h = HR;
|
||||||
cp_b->cp_b = B;
|
cp_b->cp_b = B;
|
||||||
cp_b->cp_cp = CP;
|
cp_b->cp_cp = CP;
|
||||||
cp_b->cp_env = ENV;
|
cp_b->cp_env = ENV;
|
||||||
@ -2095,7 +2095,7 @@ PL_open_foreign_frame(void)
|
|||||||
cp_b->cp_depth = DEPTH;
|
cp_b->cp_depth = DEPTH;
|
||||||
#endif /* DEPTH_LIMIT */
|
#endif /* DEPTH_LIMIT */
|
||||||
cp_b->cp_a1 = MkIntTerm(LOCAL_CurSlot);
|
cp_b->cp_a1 = MkIntTerm(LOCAL_CurSlot);
|
||||||
HB = H;
|
HB = HR;
|
||||||
B = cp_b;
|
B = cp_b;
|
||||||
ASP = (CELL *)B;
|
ASP = (CELL *)B;
|
||||||
Yap_StartSlots( PASS_REGS1 );
|
Yap_StartSlots( PASS_REGS1 );
|
||||||
|
@ -235,7 +235,7 @@ AccessFile(const char *path, int mode)
|
|||||||
|
|
||||||
return access(OsPath(path, tmp), m) == 0 ? TRUE : FALSE;
|
return access(OsPath(path, tmp), m) == 0 ? TRUE : FALSE;
|
||||||
#else
|
#else
|
||||||
#error "No implementation for AccessFile()"
|
# error "No implementation for AccessFile()"
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ locale_grouping_property(PL_locale *l, term_t prop ARG_LD)
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{ functor_t functor; /* functor of property */
|
{ functor_t functor; /* functor of property */
|
||||||
int (*function)(); /* function to generate */
|
int (*function)(); /* function to generate */
|
||||||
} lprop;
|
} lprop;
|
||||||
|
|
||||||
static const lprop lprop_list [] =
|
static const lprop lprop_list [] =
|
||||||
@ -482,7 +482,7 @@ PRED_IMPL("locale_property", 2, locale_property, PL_FA_NONDETERMINISTIC)
|
|||||||
term_t locale = A1;
|
term_t locale = A1;
|
||||||
term_t property = A2;
|
term_t property = A2;
|
||||||
lprop_enum statebuf;
|
lprop_enum statebuf;
|
||||||
lprop_enum *state;
|
lprop_enum *state = NULL;
|
||||||
|
|
||||||
switch( CTX_CNTRL )
|
switch( CTX_CNTRL )
|
||||||
{ case FRG_FIRST_CALL:
|
{ case FRG_FIRST_CALL:
|
||||||
|
@ -1051,7 +1051,7 @@ PRED_IMPL("win_registry_get_value", 3, win_registry_get_value, 0)
|
|||||||
case REG_DWORD:
|
case REG_DWORD:
|
||||||
return PL_unify_integer(Value, *((DWORD *)data));
|
return PL_unify_integer(Value, *((DWORD *)data));
|
||||||
default:
|
default:
|
||||||
warning("get_registry_value/2: Unknown registery-type: %d", type);
|
warning("get_registry_value/2: Unknown registry-type: %d", type);
|
||||||
fail;
|
fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
40
os/pl-read.c
40
os/pl-read.c
@ -39,46 +39,6 @@ free_read_data(ReadData _PL_rd)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
ptr_to_location(const unsigned char *here, source_location *pos, ReadData _PL_rd)
|
|
||||||
{ unsigned char const *s, *ll = NULL;
|
|
||||||
int c;
|
|
||||||
|
|
||||||
*pos = _PL_rd->start_of_term;
|
|
||||||
|
|
||||||
/* update line number */
|
|
||||||
for(s=rdbase; s<here; s = utf8_get_uchar(s, &c))
|
|
||||||
{ pos->position.charno++;
|
|
||||||
|
|
||||||
if ( c == '\n' )
|
|
||||||
{ pos->position.lineno++;
|
|
||||||
ll = s+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* update line position */
|
|
||||||
if ( ll )
|
|
||||||
{ s = ll;
|
|
||||||
pos->position.linepos = 0;
|
|
||||||
} else
|
|
||||||
{ s = rdbase;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(; s<here; s++)
|
|
||||||
{ switch(*s)
|
|
||||||
{ case '\b':
|
|
||||||
if ( pos->position.linepos > 0 )
|
|
||||||
pos->position.linepos--;
|
|
||||||
break;
|
|
||||||
case '\t':
|
|
||||||
pos->position.linepos |= 7; /* TBD: set tab distance */
|
|
||||||
default:
|
|
||||||
pos->position.linepos++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pos->position.byteno = 0; /* we do not know */
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
read_term(term_t t, ReadData _PL_rd ARG_LD)
|
read_term(term_t t, ReadData _PL_rd ARG_LD)
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,7 @@ extern IOENC initEncoding(void);
|
|||||||
extern int reportStreamError(IOSTREAM *s);
|
extern int reportStreamError(IOSTREAM *s);
|
||||||
extern record_t PL_record(term_t t);
|
extern record_t PL_record(term_t t);
|
||||||
extern int PL_thread_self(void);
|
extern int PL_thread_self(void);
|
||||||
|
extern void unallocStream(IOSTREAM *s);
|
||||||
|
|
||||||
/*******************************
|
/*******************************
|
||||||
* BUFFER *
|
* BUFFER *
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
typedef void *SYM_REC_PTR;
|
typedef void *SYM_REC_PTR;
|
||||||
|
|
||||||
#define heap_top H
|
#define heap_top HR
|
||||||
#define local_top ASP
|
#define local_top ASP
|
||||||
#define trail_top TR
|
#define trail_top TR
|
||||||
#define trail_up_addr ((tr_fr_ptr)LCL0)
|
#define trail_up_addr ((tr_fr_ptr)LCL0)
|
||||||
@ -168,7 +168,7 @@ INLINE_ONLY extern inline int is_IDENTICAL(TERM t1, TERM t2)
|
|||||||
|
|
||||||
#define float_psc ((YAP_Functor)FunctorDouble)
|
#define float_psc ((YAP_Functor)FunctorDouble)
|
||||||
|
|
||||||
#define NEW_HEAP_FREE (*H = (CELL)H); H++
|
#define NEW_HEAP_FREE (*HR = (CELL)HR); HR++
|
||||||
|
|
||||||
#define nil_sym YAP_TermNil()
|
#define nil_sym YAP_TermNil()
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ int pc_import_occ_switches_3(void)
|
|||||||
|
|
||||||
#ifdef __YAP_PROLOG__
|
#ifdef __YAP_PROLOG__
|
||||||
if ( heap_top + 64*1024 >= local_top ) {
|
if ( heap_top + 64*1024 >= local_top ) {
|
||||||
H = hstart;
|
HR = hstart;
|
||||||
/* running out of stack */
|
/* running out of stack */
|
||||||
extern int Yap_gcl(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop);
|
extern int Yap_gcl(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop);
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ static int rlc_from_queue(RlcQueue q);
|
|||||||
static int rlc_is_empty_queue(RlcQueue q);
|
static int rlc_is_empty_queue(RlcQueue q);
|
||||||
static void rlc_empty_queue(RlcQueue q);
|
static void rlc_empty_queue(RlcQueue q);
|
||||||
|
|
||||||
extern int main();
|
extern int main(void);
|
||||||
|
|
||||||
static RlcUpdateHook _rlc_update_hook;
|
static RlcUpdateHook _rlc_update_hook;
|
||||||
static RlcTimerHook _rlc_timer_hook;
|
static RlcTimerHook _rlc_timer_hook;
|
||||||
@ -551,7 +551,7 @@ rlc_kill_wnd_proc(HWND hwnd, UINT message, UINT wParam, LONG lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static TCHAR *
|
static TCHAR *
|
||||||
rlc_kill_window_class()
|
rlc_kill_window_class(void)
|
||||||
{ static TCHAR winclassname[32];
|
{ static TCHAR winclassname[32];
|
||||||
static WNDCLASS wndClass;
|
static WNDCLASS wndClass;
|
||||||
HINSTANCE instance = _rlc_hinstance;
|
HINSTANCE instance = _rlc_hinstance;
|
||||||
@ -1383,7 +1383,7 @@ rlc_yield()
|
|||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rlc_init_word_chars()
|
rlc_init_word_chars(void)
|
||||||
{ int i;
|
{ int i;
|
||||||
|
|
||||||
for(i=0; i<CHAR_MAX; i++)
|
for(i=0; i<CHAR_MAX; i++)
|
||||||
@ -1411,7 +1411,7 @@ rlc_is_word_char(int chr)
|
|||||||
* SELECTION *
|
* SELECTION *
|
||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
#define SelLT(l1, c1, l2, c2) ((l1) < (l2) || (l1) == (l2) && (c1) < (c2))
|
#define SelLT(l1, c1, l2, c2) ((l1) < (l2) || ((l1) == (l2) && (c1) < (c2)))
|
||||||
#define SelEQ(l1, c1, l2, c2) ((l1) == (l2) && (c1) == (c2))
|
#define SelEQ(l1, c1, l2, c2) ((l1) == (l2) && (c1) == (c2))
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1652,7 +1652,7 @@ rlc_read_from_window(RlcData b, int sl, int sc, int el, int ec)
|
|||||||
TCHAR *buf;
|
TCHAR *buf;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if ( el < sl || el == sl && ec < sc )
|
if ( el < sl || (el == sl && ec < sc) )
|
||||||
return NULL; /* invalid region */
|
return NULL; /* invalid region */
|
||||||
if ( !(buf = rlc_malloc(bufsize * sizeof(TCHAR))) )
|
if ( !(buf = rlc_malloc(bufsize * sizeof(TCHAR))) )
|
||||||
return NULL; /* not enough memory */
|
return NULL; /* not enough memory */
|
||||||
|
Reference in New Issue
Block a user