more speed stuff.

This commit is contained in:
Vítor Santos Costa 2011-10-02 21:01:14 -03:00
parent 66ae65fe09
commit 43c07f5051
5 changed files with 123 additions and 108 deletions

198
C/absmi.c
View File

@ -806,7 +806,7 @@ Yap_absmi(int inp)
saveregs();
/* do a garbage collection first to check if we can recover memory */
if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_HEAP_ERROR, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
setregs();
FAIL();
}
@ -838,7 +838,7 @@ Yap_absmi(int inp)
cut_b = LCL0-(CELL *)(ASP[E_CB]);
saveregs();
if(!Yap_growtrail (0, FALSE)) {
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
Yap_NilError(OUT_OF_TRAIL_ERROR,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
setregs();
FAIL();
}
@ -1189,14 +1189,14 @@ Yap_absmi(int inp)
LOCAL_ReductionsCounter--;
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
saveregs();
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(CALL_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -1214,7 +1214,7 @@ Yap_absmi(int inp)
/* act as if we had backtracked */
ENV = B->cp_env;
saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -1222,7 +1222,7 @@ Yap_absmi(int inp)
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
ENV = B->cp_env;
saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -1251,14 +1251,14 @@ Yap_absmi(int inp)
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -1295,14 +1295,14 @@ Yap_absmi(int inp)
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0) {
saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -1330,14 +1330,14 @@ Yap_absmi(int inp)
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0) {
saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -1375,14 +1375,14 @@ Yap_absmi(int inp)
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0) {
saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -1563,7 +1563,7 @@ Yap_absmi(int inp)
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage);
FAIL();
}
} else {
@ -1573,7 +1573,7 @@ Yap_absmi(int inp)
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage);
FAIL();
}
}
@ -1693,7 +1693,7 @@ Yap_absmi(int inp)
PREG = NEXTOP(PREG,Osbpa);
saveregs();
if (!Yap_gcl(sz, arity, YENV, PREG)) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
setregs();
FAIL();
} else {
@ -1783,14 +1783,14 @@ Yap_absmi(int inp)
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0) {
saveregs();
Yap_Error(RETRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -2023,7 +2023,7 @@ Yap_absmi(int inp)
#endif /* LOW_LEVEL_TRACER */
#ifdef FROZEN_STACKS
#ifdef YAPOR_SBA
if (pt0 < TR_FZ || pt0 > CurrentTrailTop+MinTrailGap)
if (pt0 < TR_FZ || pt0 > (ADDR)CurrentTrailTop+MinTrailGap)
#else
if (pt0 < TR_FZ)
#endif /* YAPOR_SBA */
@ -2073,7 +2073,7 @@ Yap_absmi(int inp)
#ifdef YAPOR_SBA
(ADDR) pt1 >= HeapTop
#else
IN_BETWEEN(LOCAL_TrailBase, pt1, CurrentTrailTop+MinTrailGap)
IN_BETWEEN(LOCAL_TrailBase, pt1, (ADDR)CurrentTrailTop+MinTrailGap)
#endif /* YAPOR_SBA */
)
{
@ -2617,7 +2617,7 @@ Yap_absmi(int inp)
SET_ASP(YREG, PREG->u.Osbpp.s);
saveregs();
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, YREG, NEXTOP(PREG, Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
}
setregs();
@ -2671,7 +2671,7 @@ Yap_absmi(int inp)
}
saveregs();
if (!Yap_gc(0, ENV, CPREG)) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
}
setregs();
SREG = ASP;
@ -2850,7 +2850,7 @@ Yap_absmi(int inp)
ASP = (CELL *)PROTECT_FROZEN_B(B);
saveregs();
if (!Yap_gc(0, YREG, NEXTOP(PREG, Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
}
setregs();
JMPNext();
@ -2975,7 +2975,7 @@ Yap_absmi(int inp)
ASP = (CELL *)PROTECT_FROZEN_B(B);
saveregs();
if (!Yap_gc(((PredEntry *)(SREG))->ArityOfPE, (CELL *)YREG[E_E], (yamop *)YREG[E_CP])) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
}
setregs();
/* hopefully, gc will succeeded, and we will retry
@ -2997,7 +2997,7 @@ Yap_absmi(int inp)
ASP = (CELL *)PROTECT_FROZEN_B(B);
saveregs();
if (!Yap_gc(((PredEntry *)(SREG))->ArityOfPE, ENV, CPREG)) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
}
setregs();
/* hopefully, gc will succeeded, and we will retry
@ -3122,7 +3122,7 @@ Yap_absmi(int inp)
ARG2 = Yap_ListOfWokenGoals();
SREG = (CELL *) (WakeUpCode);
/* no more goals to wake up */
Yap_UpdateTimedVar(LOCAL_WokenGoals, TermNil);
Yap_UpdateTimedVar(LOCAL_WokenGoals,TermNil);
} else
#endif
{
@ -7570,7 +7570,7 @@ Yap_absmi(int inp)
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
UNLOCKPE(20,pe);
saveregs();
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(CALL_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -7578,7 +7578,7 @@ Yap_absmi(int inp)
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
UNLOCKPE(21,pe);
saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
setregs();
JMPNext();
}
@ -9117,7 +9117,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, plus_vv_unk, plus_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is _+B");
Yap_NilError(INSTANTIATION_ERROR, "X is _+B");
setregs();
FAIL();
ENDP(pt0);
@ -9125,7 +9125,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, plus_vv_nvar_unk, plus_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A+B");
Yap_NilError(INSTANTIATION_ERROR, "X is A+B");
setregs();
FAIL();
ENDP(pt0);
@ -9163,7 +9163,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, plus_vc_unk, plus_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A+ " Int_FORMAT, PREG->u.xxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is A+ " Int_FORMAT, PREG->u.xxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -9206,7 +9206,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, plus_y_vv_unk, plus_y_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A+B");
Yap_NilError(INSTANTIATION_ERROR, "X is A+B");
setregs();
FAIL();
ENDP(pt0);
@ -9214,7 +9214,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, plus_y_vv_nvar_unk, plus_y_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A+B");
Yap_NilError(INSTANTIATION_ERROR, "X is A+B");
setregs();
FAIL();
ENDP(pt0);
@ -9255,7 +9255,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, plus_y_vc_unk, plus_y_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A+ " Int_FORMAT, PREG->u.yxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is A+ " Int_FORMAT, PREG->u.yxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -9295,7 +9295,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, minus_vv_unk, minus_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A-B");
Yap_NilError(INSTANTIATION_ERROR, "X is A-B");
setregs();
FAIL();
ENDP(pt0);
@ -9303,7 +9303,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, minus_vv_nvar_unk, minus_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A-B");
Yap_NilError(INSTANTIATION_ERROR, "X is A-B");
setregs();
FAIL();
ENDP(pt0);
@ -9341,7 +9341,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, minus_cv_unk, minus_cv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is " Int_FORMAT "-A", PREG->u.xxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is " Int_FORMAT "-A", PREG->u.xxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -9384,7 +9384,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, minus_y_vv_unk, minus_y_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A-B");
Yap_NilError(INSTANTIATION_ERROR, "X is A-B");
setregs();
FAIL();
ENDP(pt0);
@ -9392,7 +9392,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, minus_y_vv_nvar_unk, minus_y_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A-B");
Yap_NilError(INSTANTIATION_ERROR, "X is A-B");
setregs();
FAIL();
ENDP(pt0);
@ -9433,7 +9433,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, minus_y_cv_unk, minus_y_cv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is " Int_FORMAT "-A", PREG->u.yxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is " Int_FORMAT "-A", PREG->u.yxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -9473,7 +9473,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, times_vv_unk, times_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A*B");
Yap_NilError(INSTANTIATION_ERROR, "X is A*B");
setregs();
FAIL();
ENDP(pt0);
@ -9481,7 +9481,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, times_vv_nvar_unk, times_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A*B");
Yap_NilError(INSTANTIATION_ERROR, "X is A*B");
setregs();
FAIL();
ENDP(pt0);
@ -9519,7 +9519,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, times_vc_unk, times_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A* " Int_FORMAT, PREG->u.xxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is A* " Int_FORMAT, PREG->u.xxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -9562,7 +9562,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, times_y_vv_unk, times_y_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A*B");
Yap_NilError(INSTANTIATION_ERROR, "X is A*B");
setregs();
FAIL();
ENDP(pt0);
@ -9570,7 +9570,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, times_y_vv_nvar_unk, times_y_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A*B");
Yap_NilError(INSTANTIATION_ERROR, "X is A*B");
setregs();
FAIL();
ENDP(pt0);
@ -9611,7 +9611,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, times_y_vc_unk, times_y_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A* " Int_FORMAT, PREG->u.yxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is A* " Int_FORMAT, PREG->u.yxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -9634,7 +9634,7 @@ Yap_absmi(int inp)
Int div = IntOfTerm(d1);
if (div == 0) {
saveregs();
Yap_Error(EVALUATION_ERROR_ZERO_DIVISOR,TermNil,"// /2");
Yap_NilError(EVALUATION_ERROR_ZERO_DIVISOR,"// /2");
setregs();
FAIL();
}
@ -9658,7 +9658,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, div_vv_unk, div_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A//B");
Yap_NilError(INSTANTIATION_ERROR, "X is A//B");
setregs();
FAIL();
ENDP(pt0);
@ -9666,7 +9666,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, div_vv_nvar_unk, div_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A//B");
Yap_NilError(INSTANTIATION_ERROR, "X is A//B");
setregs();
FAIL();
ENDP(pt0);
@ -9704,7 +9704,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, div_vc_unk, div_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A//B");
Yap_NilError(INSTANTIATION_ERROR, "X is A//B");
setregs();
FAIL();
ENDP(pt0);
@ -9723,7 +9723,7 @@ Yap_absmi(int inp)
Int div = IntOfTerm(d0);
if (div == 0){
saveregs();
Yap_Error(EVALUATION_ERROR_ZERO_DIVISOR,TermNil,"// /2");
Yap_NilError(EVALUATION_ERROR_ZERO_DIVISOR,"// /2");
setregs();
FAIL();
}
@ -9747,7 +9747,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, div_cv_unk, div_cv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is " Int_FORMAT "// A", PREG->u.xxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is " Int_FORMAT "// A", PREG->u.xxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -9770,7 +9770,7 @@ Yap_absmi(int inp)
Int div = IntOfTerm(d1);
if (div == 0) {
saveregs();
Yap_Error(EVALUATION_ERROR_ZERO_DIVISOR,TermNil,"// /2");
Yap_NilError(EVALUATION_ERROR_ZERO_DIVISOR,"// /2");
setregs();
FAIL();
}
@ -9797,7 +9797,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, div_y_vv_unk, div_y_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A//B");
Yap_NilError(INSTANTIATION_ERROR, "X is A//B");
setregs();
FAIL();
ENDP(pt0);
@ -9805,7 +9805,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, div_y_vv_nvar_unk, div_y_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A//B");
Yap_NilError(INSTANTIATION_ERROR, "X is A//B");
setregs();
FAIL();
ENDP(pt0);
@ -9846,7 +9846,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, div_y_vc_unk, div_y_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A//B");
Yap_NilError(INSTANTIATION_ERROR, "X is A//B");
setregs();
FAIL();
ENDP(pt0);
@ -9865,7 +9865,7 @@ Yap_absmi(int inp)
Int div = IntOfTerm(d0);
if (div == 0) {
saveregs();
Yap_Error(EVALUATION_ERROR_ZERO_DIVISOR,TermNil,"// /2");
Yap_NilError(EVALUATION_ERROR_ZERO_DIVISOR,"// /2");
setregs();
FAIL();
}
@ -9893,7 +9893,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, div_y_cv_unk, div_y_cv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is " Int_FORMAT "// A", PREG->u.yxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is " Int_FORMAT "// A", PREG->u.yxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -9934,7 +9934,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, and_vv_unk, and_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A/\\B");
Yap_NilError(INSTANTIATION_ERROR, "X is A/\\B");
setregs();
FAIL();
ENDP(pt0);
@ -9942,7 +9942,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, and_vv_nvar_unk, and_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A/\\B");
Yap_NilError(INSTANTIATION_ERROR, "X is A/\\B");
setregs();
FAIL();
ENDP(pt0);
@ -9980,7 +9980,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, and_vc_unk, and_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A /\\ " Int_FORMAT , PREG->u.xxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is A /\\ " Int_FORMAT , PREG->u.xxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -10023,7 +10023,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, and_y_vv_unk, and_y_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A/\\B");
Yap_NilError(INSTANTIATION_ERROR, "X is A/\\B");
setregs();
FAIL();
ENDP(pt0);
@ -10031,7 +10031,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, and_y_vv_nvar_unk, and_y_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A/\\B");
Yap_NilError(INSTANTIATION_ERROR, "X is A/\\B");
setregs();
FAIL();
ENDP(pt0);
@ -10072,7 +10072,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, and_y_vc_unk, and_y_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A /\\ " Int_FORMAT , PREG->u.yxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is A /\\ " Int_FORMAT , PREG->u.yxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -10113,7 +10113,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, or_vv_unk, or_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A\\/B");
Yap_NilError(INSTANTIATION_ERROR, "X is A\\/B");
setregs();
FAIL();
ENDP(pt0);
@ -10121,7 +10121,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, or_vv_nvar_unk, or_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A\\/B");
Yap_NilError(INSTANTIATION_ERROR, "X is A\\/B");
setregs();
FAIL();
ENDP(pt0);
@ -10158,7 +10158,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, or_vc_unk, or_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A \\/ " Int_FORMAT , PREG->u.xxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is A \\/ " Int_FORMAT , PREG->u.xxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -10201,7 +10201,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, or_y_vv_unk, or_y_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A\\/B");
Yap_NilError(INSTANTIATION_ERROR, "X is A\\/B");
setregs();
FAIL();
ENDP(pt0);
@ -10209,7 +10209,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, or_y_vv_nvar_unk, or_y_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A\\/B");
Yap_NilError(INSTANTIATION_ERROR, "X is A\\/B");
setregs();
FAIL();
ENDP(pt0);
@ -10250,7 +10250,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, or_y_vc_unk, or_y_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A \\/ " Int_FORMAT , PREG->u.yxn.c);
Yap_NilError(INSTANTIATION_ERROR, "X is A \\/ " Int_FORMAT , PREG->u.yxn.c);
setregs();
FAIL();
ENDP(pt0);
@ -10294,7 +10294,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, sll_vv_unk, sll_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A<<B");
Yap_NilError(INSTANTIATION_ERROR, "X is A<<B");
setregs();
FAIL();
ENDP(pt0);
@ -10302,7 +10302,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, sll_vv_nvar_unk, sll_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A<<B");
Yap_NilError(INSTANTIATION_ERROR, "X is A<<B");
setregs();
FAIL();
ENDP(pt0);
@ -10340,7 +10340,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, sll_vc_unk, sll_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A<<B");
Yap_NilError(INSTANTIATION_ERROR, "X is A<<B");
setregs();
FAIL();
ENDP(pt0);
@ -10381,7 +10381,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, sll_cv_unk, sll_cv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A<<B");
Yap_NilError(INSTANTIATION_ERROR, "X is A<<B");
setregs();
FAIL();
ENDP(pt0);
@ -10428,7 +10428,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, sll_y_vv_unk, sll_y_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A<<B");
Yap_NilError(INSTANTIATION_ERROR, "X is A<<B");
setregs();
FAIL();
ENDP(pt0);
@ -10436,7 +10436,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, sll_y_vv_nvar_unk, sll_y_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A<<B");
Yap_NilError(INSTANTIATION_ERROR, "X is A<<B");
setregs();
FAIL();
ENDP(pt0);
@ -10477,7 +10477,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, sll_y_vc_unk, sll_y_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A<<B");
Yap_NilError(INSTANTIATION_ERROR, "X is A<<B");
setregs();
FAIL();
ENDP(pt0);
@ -10522,7 +10522,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, sll_y_cv_unk, sll_y_cv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A<<B");
Yap_NilError(INSTANTIATION_ERROR, "X is A<<B");
setregs();
FAIL();
ENDP(pt0);
@ -10566,7 +10566,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, slr_vv_unk, slr_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A>>B");
Yap_NilError(INSTANTIATION_ERROR, "X is A>>B");
setregs();
FAIL();
ENDP(pt0);
@ -10574,7 +10574,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, slr_vv_nvar_unk, slr_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A>>B");
Yap_NilError(INSTANTIATION_ERROR, "X is A>>B");
setregs();
FAIL();
ENDP(pt0);
@ -10612,7 +10612,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, slr_vc_unk, slr_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A>>B");
Yap_NilError(INSTANTIATION_ERROR, "X is A>>B");
setregs();
FAIL();
ENDP(pt0);
@ -10653,7 +10653,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, slr_cv_unk, slr_cv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A>>B");
Yap_NilError(INSTANTIATION_ERROR, "X is A>>B");
setregs();
FAIL();
ENDP(pt0);
@ -10700,7 +10700,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, slr_y_vv_unk, slr_y_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A>>B");
Yap_NilError(INSTANTIATION_ERROR, "X is A>>B");
setregs();
FAIL();
ENDP(pt0);
@ -10708,7 +10708,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d1, pt0, slr_y_vv_nvar_unk, slr_y_vv_nvar_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A>>B");
Yap_NilError(INSTANTIATION_ERROR, "X is A>>B");
setregs();
FAIL();
ENDP(pt0);
@ -10749,7 +10749,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, slr_y_vc_unk, slr_y_vc_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A>>B");
Yap_NilError(INSTANTIATION_ERROR, "X is A>>B");
setregs();
ENDP(pt0);
ENDD(d0);
@ -10792,7 +10792,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, slr_y_cv_unk, slr_y_cv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A>>B");
Yap_NilError(INSTANTIATION_ERROR, "X is A>>B");
setregs();
FAIL();
ENDP(pt0);
@ -11856,7 +11856,7 @@ Yap_absmi(int inp)
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxx),Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -11973,7 +11973,7 @@ Yap_absmi(int inp)
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxc),Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -12083,7 +12083,7 @@ Yap_absmi(int inp)
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gc(0, YREG, NEXTOP(NEXTOP(PREG,xxn),Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -12190,7 +12190,7 @@ Yap_absmi(int inp)
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxx),Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -12317,7 +12317,7 @@ Yap_absmi(int inp)
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxn),Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -12445,7 +12445,7 @@ Yap_absmi(int inp)
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxn),Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -12821,7 +12821,7 @@ Yap_absmi(int inp)
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP(PREG,e),Osbmp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13066,7 +13066,7 @@ Yap_absmi(int inp)
}
saveregs_and_ycache();
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
}
setregs_and_ycache();
goto execute2_end;
@ -13271,7 +13271,7 @@ Yap_absmi(int inp)
}
saveregs_and_ycache();
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, Osbmp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
}
setregs_and_ycache();
goto execute_end;
@ -13501,7 +13501,7 @@ Yap_absmi(int inp)
UNLOCK(LOCAL_SignalLock);
saveregs_and_ycache();
if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_HEAP_ERROR, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
setregs_and_ycache();
FAIL();
}
@ -13521,7 +13521,7 @@ Yap_absmi(int inp)
#endif
saveregs_and_ycache();
if(!Yap_growtrail (0, FALSE)) {
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
Yap_NilError(OUT_OF_TRAIL_ERROR,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
setregs_and_ycache();
FAIL();
}
@ -13545,7 +13545,7 @@ Yap_absmi(int inp)
UNLOCK(LOCAL_SignalLock);
saveregs_and_ycache();
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
}
setregs_and_ycache();
goto execute_after_comma;

View File

@ -380,6 +380,20 @@ Yap_bug_location(yamop *pc)
static char tmpbuf[YAP_BUF_SIZE];
yamop *
Yap_NilError(yap_error_number type, char *format,...)
{
va_list ap;
yamop *res;
va_start (ap, format);
/* now build the error string */
res = Yap_Error(type, TermNil, format, ap);
va_end (ap);
return res;
}
yamop *
Yap_Error(yap_error_number type, Term where, char *format,...)
{

View File

@ -97,20 +97,20 @@ typedef struct regstore_t
tr_fr_ptr TR_; /* 24 top of trail */
CELL *H_; /* 25 top of heap (global) stack */
choiceptr B_; /* 26 latest choice point */
#ifdef DEPTH_LIMIT
CELL DEPTH_; /* 27 */
#endif /* DEPTH_LIMIT */
yamop *CP_; /* 28 continuation program counter */
CELL *ENV_; /* 1 current environment */
#ifdef CUT_C
cut_c_str_ptr CUT_C_TOP;
#endif
#if defined CUT_C && (defined MYDDAS_ODBC || defined MYDDAS_MYSQL)
MYDDAS_GLOBAL MYDDAS_GLOBAL_POINTER;
#endif
#ifdef DEPTH_LIMIT
CELL DEPTH_; /* 27 */
#endif /* DEPTH_LIMIT */
yamop *CP_; /* 28 continuation program counter */
yamop *P_; /* 7 prolog machine program counter */
CELL *YENV_; /* 5 current environment (may differ from ENV)*/
CELL *S_; /* 6 structure pointer */
CELL *ENV_; /* 1 current environment */
CELL *ASP_; /* 8 top of local stack */
CELL *LCL0_; /* 3 local stack base */
tr_fr_ptr CurrentTrailTop_; /* 10 Auxiliary stack top */

View File

@ -165,6 +165,7 @@ void STD_PROTO(Yap_InitDBPreds,(void));
/* errors.c */
void STD_PROTO(Yap_exit,(int));
yamop *STD_PROTO(Yap_Error,(yap_error_number,Term,char *msg, ...));
yamop *STD_PROTO(Yap_NilError,(yap_error_number,char *msg, ...));
/* eval.c */
void STD_PROTO(Yap_InitEval,(void));

View File

@ -681,20 +681,20 @@ Macros to check the limits of stacks
#else
#define check_trail(x) if (Unsigned(CurrentTrailTop) > Unsigned(x)) \
#define check_trail(x) if (__builtin_expect((Unsigned(CurrentTrailTop) < Unsigned(x)),0)) \
goto notrailleft
#define check_trail_in_indexing(x) if (Unsigned(CurrentTrailTop) < Unsigned(x)) \
#define check_trail_in_indexing(x) if (__builtin_expect((Unsigned(CurrentTrailTop) < Unsigned(x)),0)) \
goto notrailleft_from_index
#endif
#if (defined(YAPOR_SBA) && defined(YAPOR)) || defined(TABLING)
#define check_stack(Label, GLOB) \
if ( (Int)(Unsigned(YOUNGEST_CP((choiceptr)ENV_YREG,B_FZ)) - Unsigned(YOUNGEST_H(H_FZ,GLOB))) < CreepFlag ) goto Label
if (__builtin_expect( ((Int)(Unsigned(YOUNGEST_CP((choiceptr)ENV_YREG,B_FZ)) - Unsigned(YOUNGEST_H(H_FZ,GLOB))) < CreepFlag), 0) ) goto Label
#else
#define check_stack(Label, GLOB) \
if ( (Int)(Unsigned(ENV_YREG) - Unsigned(GLOB)) < CreepFlag ) goto Label
if (__builtin_expect(((Int)(Unsigned(ENV_YREG) - Unsigned(GLOB)) < CreepFlag ), 0) ) goto Label
#endif /* YAPOR_SBA && YAPOR */
/***************************************************************