more fixes to make rclause.h automatic:
define new type n for Integers, as they were mistaken for Term. define early return cases and ifdef exceptions.
This commit is contained in:
180
C/absmi.c
180
C/absmi.c
@@ -1523,7 +1523,7 @@ Yap_absmi(int inp)
|
||||
|
||||
/* only meaningful with THREADS on! */
|
||||
/* lock logical updates predicate. */
|
||||
Op(lock_lu, e);
|
||||
Op(lock_lu, p);
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (PP) {
|
||||
GONext();
|
||||
@@ -9569,14 +9569,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_plus_vc, xxc);
|
||||
Op(p_plus_vc, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, plus_vc_unk);
|
||||
plus_vc_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = MkIntegerTerm(IntOfTerm(d0) + d1);
|
||||
}
|
||||
@@ -9588,8 +9588,8 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -9739,14 +9739,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_minus_cv, xxc);
|
||||
Op(p_minus_cv, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, minus_cv_unk);
|
||||
minus_cv_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = MkIntegerTerm(d1 - IntOfTerm(d0));
|
||||
}
|
||||
@@ -9758,8 +9758,8 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -9909,14 +9909,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_times_vc, xxc);
|
||||
Op(p_times_vc, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, times_vc_unk);
|
||||
times_vc_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = times_int(IntOfTerm(d0), d1);
|
||||
}
|
||||
@@ -9928,8 +9928,8 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -10086,14 +10086,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_div_vc, xxc);
|
||||
Op(p_div_vc, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, div_vc_unk);
|
||||
div_vc_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = MkIntTerm(IntOfTerm(d0) / d1);
|
||||
}
|
||||
@@ -10105,8 +10105,8 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -10119,14 +10119,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_div_cv, xxc);
|
||||
Op(p_div_cv, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, div_cv_unk);
|
||||
div_cv_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
Int div = IntOfTerm(d0);
|
||||
if (div == 0){
|
||||
@@ -10144,8 +10144,8 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -10350,14 +10350,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_and_vc, xxc);
|
||||
Op(p_and_vc, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, and_vc_unk);
|
||||
and_vc_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = MkIntegerTerm(IntOfTerm(d0) & d1);
|
||||
}
|
||||
@@ -10369,8 +10369,8 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -10521,14 +10521,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_or_vc, xxc);
|
||||
Op(p_or_vc, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, or_vc_unk);
|
||||
or_vc_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = MkIntegerTerm(IntOfTerm(d0) | d1);
|
||||
}
|
||||
@@ -10539,8 +10539,8 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -10694,14 +10694,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_sll_vc, xxc);
|
||||
Op(p_sll_vc, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, sll_vc_unk);
|
||||
sll_vc_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = do_sll(IntOfTerm(d0), (Int)d1);
|
||||
}
|
||||
@@ -10713,8 +10713,8 @@ Yap_absmi(int inp)
|
||||
}
|
||||
if (PREG == (yamop *)FAILCODE)
|
||||
FAIL();
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -10727,14 +10727,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_sll_cv, xxc);
|
||||
Op(p_sll_cv, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, sll_cv_unk);
|
||||
sll_cv_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
Int i2 = IntOfTerm(d0);
|
||||
if (i2 < 0)
|
||||
@@ -10750,8 +10750,8 @@ Yap_absmi(int inp)
|
||||
}
|
||||
if (PREG == (yamop *)FAILCODE)
|
||||
FAIL();
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -10954,14 +10954,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_slr_vc, xxc);
|
||||
Op(p_slr_vc, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, slr_vc_unk);
|
||||
slr_vc_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
d0 = MkIntTerm(IntOfTerm(d0) >> d1);
|
||||
}
|
||||
@@ -10973,8 +10973,8 @@ Yap_absmi(int inp)
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -10987,14 +10987,14 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_slr_cv, xxc);
|
||||
Op(p_slr_cv, xxn);
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
/* first check pt1 */
|
||||
deref_head(d0, slr_cv_unk);
|
||||
slr_cv_nvar:
|
||||
{
|
||||
Int d1 = PREG->u.xxc.c;
|
||||
Int d1 = PREG->u.xxn.c;
|
||||
if (IsIntTerm(d0)) {
|
||||
Int i2 = IntOfTerm(d0);
|
||||
if (i2 < 0)
|
||||
@@ -11010,8 +11010,8 @@ Yap_absmi(int inp)
|
||||
}
|
||||
if (PREG == (yamop *)FAILCODE)
|
||||
FAIL();
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
|
||||
BEGP(pt0);
|
||||
@@ -11839,23 +11839,23 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_arg_cv, xxc);
|
||||
Op(p_arg_cv, xxn);
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
if (Yap_do_low_level_trace) {
|
||||
CELL *Ho = H;
|
||||
Term t = MkIntegerTerm(PREG->u.xxc.c);
|
||||
Term t = MkIntegerTerm(PREG->u.xxn.c);
|
||||
H[0] = t;
|
||||
H[1] = XREG(PREG->u.xxc.xi);
|
||||
H[1] = XREG(PREG->u.xxn.xi);
|
||||
RESET_VARIABLE(H+2);
|
||||
low_level_trace(enter_pred,RepPredProp(Yap_GetPredPropByFunc(Yap_MkFunctor(Yap_LookupAtom("arg"),3),0)),H);
|
||||
H = Ho;
|
||||
}
|
||||
#endif /* LOW_LEVEL_TRACE */
|
||||
BEGD(d0);
|
||||
d0 = PREG->u.xxc.c;
|
||||
d0 = PREG->u.xxn.c;
|
||||
/* d0 now got the argument we want */
|
||||
BEGD(d1);
|
||||
d1 = XREG(PREG->u.xxc.xi);
|
||||
d1 = XREG(PREG->u.xxn.xi);
|
||||
deref_head(d1, arg_arg2_vc_unk);
|
||||
arg_arg2_vc_nvar:
|
||||
/* d1 now got the structure we want to fetch the argument
|
||||
@@ -11879,8 +11879,8 @@ Yap_absmi(int inp)
|
||||
*/
|
||||
FAIL();
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = pt0[d0];
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = pt0[d0];
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
ENDP(pt0);
|
||||
}
|
||||
@@ -11896,8 +11896,8 @@ Yap_absmi(int inp)
|
||||
}
|
||||
FAIL();
|
||||
}
|
||||
XREG(PREG->u.xxc.x) = pt0[d0-1];
|
||||
PREG = NEXTOP(PREG, xxc);
|
||||
XREG(PREG->u.xxn.x) = pt0[d0-1];
|
||||
PREG = NEXTOP(PREG, xxn);
|
||||
GONext();
|
||||
ENDP(pt0);
|
||||
}
|
||||
@@ -12033,7 +12033,7 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_arg_y_cv, xxc);
|
||||
Op(p_arg_y_cv, yxc);
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
if (Yap_do_low_level_trace) {
|
||||
CELL *Ho = H;
|
||||
@@ -12250,23 +12250,23 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_func2s_cv, xxc);
|
||||
Op(p_func2s_cv, xxn);
|
||||
/* A1 is a variable */
|
||||
restart_func2s_cv:
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
if (Yap_do_low_level_trace) {
|
||||
RESET_VARIABLE(H);
|
||||
H[1] = PREG->u.xxc.c;
|
||||
H[2] = XREG(PREG->u.xxc.xi);
|
||||
H[1] = PREG->u.xxn.c;
|
||||
H[2] = XREG(PREG->u.xxn.xi);
|
||||
low_level_trace(enter_pred,RepPredProp(Yap_GetPredPropByFunc(Yap_MkFunctor(Yap_LookupAtom("functor"),3),0)),H);
|
||||
}
|
||||
#endif /* LOW_LEVEL_TRACE */
|
||||
BEGD(d0);
|
||||
/* We have to build the structure */
|
||||
d0 = PREG->u.xxc.c;
|
||||
d0 = PREG->u.xxn.c;
|
||||
/* we do, let's get the third argument */
|
||||
BEGD(d1);
|
||||
d1 = XREG(PREG->u.xxc.xi);
|
||||
d1 = XREG(PREG->u.xxn.xi);
|
||||
deref_head(d1, func2s_unk2_cv);
|
||||
func2s_nvar2_cv:
|
||||
/* Uuuff, the second and third argument are bound */
|
||||
@@ -12287,8 +12287,8 @@ Yap_absmi(int inp)
|
||||
H += 2;
|
||||
/* else if arity is 0 just pass d0 through */
|
||||
/* Ding, ding, we made it */
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxc),sbpp),l);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxn),sbpp),l);
|
||||
GONext();
|
||||
} else if ((Int)d1 > 0) {
|
||||
/* now let's build a compound term */
|
||||
@@ -12310,7 +12310,7 @@ Yap_absmi(int inp)
|
||||
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) {
|
||||
/* make sure we have something to show for our trouble */
|
||||
saveregs();
|
||||
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxc),sbpp))) {
|
||||
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxn),sbpp))) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
|
||||
setregs();
|
||||
JMPNext();
|
||||
@@ -12328,12 +12328,12 @@ Yap_absmi(int inp)
|
||||
ENDP(pt1);
|
||||
/* else if arity is 0 just pass d0 through */
|
||||
/* Ding, ding, we made it */
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxc),sbpp),l);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxn),sbpp),l);
|
||||
GONext();
|
||||
} else if (d1 == 0) {
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxc),sbpp),l);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxn),sbpp),l);
|
||||
GONext();
|
||||
} else {
|
||||
saveregs();
|
||||
@@ -12354,7 +12354,7 @@ Yap_absmi(int inp)
|
||||
ENDD(d0);
|
||||
ENDOp();
|
||||
|
||||
Op(p_func2s_vc, xxc);
|
||||
Op(p_func2s_vc, xxn);
|
||||
/* A1 is a variable */
|
||||
restart_func2s_vc:
|
||||
#ifdef LOW_LEVEL_TRACER
|
||||
@@ -12362,9 +12362,9 @@ Yap_absmi(int inp)
|
||||
Term ti;
|
||||
CELL *hi = H;
|
||||
|
||||
ti = MkIntegerTerm((Int)(PREG->u.xxc.c));
|
||||
ti = MkIntegerTerm((Int)(PREG->u.xxn.c));
|
||||
RESET_VARIABLE(H);
|
||||
H[1] = XREG(PREG->u.xxc.xi);
|
||||
H[1] = XREG(PREG->u.xxn.xi);
|
||||
H[2] = ti;
|
||||
low_level_trace(enter_pred,RepPredProp(Yap_GetPredPropByFunc(Yap_MkFunctor(Yap_LookupAtom("functor"),3),0)),H);
|
||||
H = hi;
|
||||
@@ -12372,11 +12372,11 @@ Yap_absmi(int inp)
|
||||
#endif /* LOW_LEVEL_TRACE */
|
||||
/* We have to build the structure */
|
||||
BEGD(d0);
|
||||
d0 = XREG(PREG->u.xxc.xi);
|
||||
d0 = XREG(PREG->u.xxn.xi);
|
||||
deref_head(d0, func2s_unk_vc);
|
||||
func2s_nvar_vc:
|
||||
BEGD(d1);
|
||||
d1 = PREG->u.xxc.c;
|
||||
d1 = PREG->u.xxn.c;
|
||||
if (!IsAtomicTerm(d0)) {
|
||||
saveregs();
|
||||
Yap_Error(TYPE_ERROR_ATOM,d0,"functor/3");
|
||||
@@ -12392,14 +12392,14 @@ Yap_absmi(int inp)
|
||||
H += 2;
|
||||
/* else if arity is 0 just pass d0 through */
|
||||
/* Ding, ding, we made it */
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxc),sbpp),l);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxn),sbpp),l);
|
||||
GONext();
|
||||
}
|
||||
/* now let's build a compound term */
|
||||
if (d1 == 0) {
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxc),sbpp),l);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxn),sbpp),l);
|
||||
GONext();
|
||||
}
|
||||
if (!IsAtomTerm(d0)) {
|
||||
@@ -12420,7 +12420,7 @@ Yap_absmi(int inp)
|
||||
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) {
|
||||
/* make sure we have something to show for our trouble */
|
||||
saveregs();
|
||||
if (!Yap_gc(0, YREG, NEXTOP(NEXTOP(PREG,xxc),sbpp))) {
|
||||
if (!Yap_gc(0, YREG, NEXTOP(NEXTOP(PREG,xxn),sbpp))) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
|
||||
setregs();
|
||||
JMPNext();
|
||||
@@ -12439,8 +12439,8 @@ Yap_absmi(int inp)
|
||||
ENDD(d1);
|
||||
/* else if arity is 0 just pass d0 through */
|
||||
/* Ding, ding, we made it */
|
||||
XREG(PREG->u.xxc.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxc),sbpp),l);
|
||||
XREG(PREG->u.xxn.x) = d0;
|
||||
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxn),sbpp),l);
|
||||
GONext();
|
||||
|
||||
BEGP(pt1);
|
||||
|
||||
10
C/agc.c
10
C/agc.c
@@ -115,9 +115,17 @@ AtomAdjust(Atom a)
|
||||
|
||||
#define CharP(X) ((char *)(X))
|
||||
|
||||
#define IntegerAdjust(D) (D)
|
||||
#define AddrAdjust(P) (P)
|
||||
#define CodeVarAdjust(P) (P)
|
||||
#define MFileAdjust(P) (P)
|
||||
#define CodeVarAdjust(P) (P)
|
||||
#define ConstantAdjust(P) (P)
|
||||
#define ArityAdjust(P) (P)
|
||||
#define DoubleInCodeAdjust(P)
|
||||
#define IntegerInCodeAdjust(P)
|
||||
#define OpcodeAdjust(P) (P)
|
||||
#define ModuleAdjust(P) (P)
|
||||
#define ExternalFunctionAdjust(P) (P)
|
||||
#define PredEntryAdjust(P) (P)
|
||||
#define AtomEntryAdjust(P) (P)
|
||||
#define GlobalEntryAdjust(P) (P)
|
||||
|
||||
16
C/amasm.c
16
C/amasm.c
@@ -2642,11 +2642,11 @@ a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermed
|
||||
code_p->opc = emit_op(_p_func2s_cv);
|
||||
break;
|
||||
}
|
||||
code_p->u.xxc.x = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
code_p->u.xxc.c = cmp_info->c_arg;
|
||||
code_p->u.xxc.xi = cmp_info->x1_arg;
|
||||
code_p->u.xxn.x = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
code_p->u.xxn.c = cmp_info->c_arg;
|
||||
code_p->u.xxn.xi = cmp_info->x1_arg;
|
||||
}
|
||||
GONEXT(xxc);
|
||||
GONEXT(xxn);
|
||||
break;
|
||||
case TYPE_XC:
|
||||
if (pass_no) {
|
||||
@@ -2696,11 +2696,11 @@ a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermed
|
||||
code_p->opc = emit_op(_p_func2s_vc);
|
||||
break;
|
||||
}
|
||||
code_p->u.xxc.x = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
code_p->u.xxc.c = cmp_info->c_arg;
|
||||
code_p->u.xxc.xi = cmp_info->x1_arg;
|
||||
code_p->u.xxn.x = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
code_p->u.xxn.c = cmp_info->c_arg;
|
||||
code_p->u.xxn.xi = cmp_info->x1_arg;
|
||||
}
|
||||
GONEXT(xxc);
|
||||
GONEXT(xxn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
40
C/cdmgr.c
40
C/cdmgr.c
@@ -708,6 +708,9 @@ get_pred(Term t, Term tmod, char *pname)
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#define DoubleInCodeAdjust(D)
|
||||
#define IntegerInCodeAdjust(D)
|
||||
#define IntegerAdjust(D) (D)
|
||||
#define PtoPredAdjust(X) (X)
|
||||
#define PtoOpAdjust(X) (X)
|
||||
#define PtoLUClauseAdjust(P) (P)
|
||||
@@ -719,6 +722,12 @@ get_pred(Term t, Term tmod, char *pname)
|
||||
#define FuncAdjust(X) (X)
|
||||
#define CodeAddrAdjust(X) (X)
|
||||
#define CodeComposedTermAdjust(X) (X)
|
||||
#define ConstantAdjust(X) (X)
|
||||
#define ArityAdjust(X) (X)
|
||||
#define OpcodeAdjust(X) (X)
|
||||
#define ModuleAdjust(X) (X)
|
||||
#define ExternalFunctionAdjust(X) (X)
|
||||
#define AdjustSwitchTable(X,Y,Z)
|
||||
#define rehash(A,B,C)
|
||||
static Term BlobTermAdjust(Term t)
|
||||
{
|
||||
@@ -729,6 +738,23 @@ static Term BlobTermAdjust(Term t)
|
||||
#endif
|
||||
}
|
||||
|
||||
static Term ConstantTermAdjust (Term);
|
||||
|
||||
static Term
|
||||
ConstantTermAdjust (Term t)
|
||||
{
|
||||
if (IsAtomTerm(t))
|
||||
return AtomTermAdjust(t);
|
||||
else if (IsIntTerm(t))
|
||||
return t;
|
||||
else if (IsApplTerm(t))
|
||||
return BlobTermAdjust(t);
|
||||
else if (IsPairTerm(t))
|
||||
return CodeComposedTermAdjust(t);
|
||||
else return t;
|
||||
}
|
||||
|
||||
|
||||
#include "rclause.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -3180,7 +3206,7 @@ search_for_static_predicate_in_use(PredEntry *p, int check_everything)
|
||||
only for retracts
|
||||
*/
|
||||
while (env_ptr && b_ptr > (choiceptr)env_ptr) {
|
||||
PredEntry *pe = EnvPreg(env_ptr[E_CP]);
|
||||
PredEntry *pe = EnvPreg((yamop *)env_ptr[E_CP]);
|
||||
if (p == pe) return(TRUE);
|
||||
if (env_ptr != NULL)
|
||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
||||
@@ -3257,7 +3283,7 @@ do_toggle_static_predicates_in_use(int mask)
|
||||
PredEntry *pe;
|
||||
/* check first environments that are younger than our latest choicepoint */
|
||||
while (b_ptr > (choiceptr)env_ptr) {
|
||||
PredEntry *pe = EnvPreg(env_ptr[E_CP]);
|
||||
PredEntry *pe = EnvPreg((yamop *)env_ptr[E_CP]);
|
||||
|
||||
mark_pred(mask, pe);
|
||||
env_ptr = (CELL *)(env_ptr[E_E]);
|
||||
@@ -4305,7 +4331,7 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,xxx);
|
||||
break;
|
||||
/* instructions type xxc */
|
||||
/* instructions type xxn */
|
||||
case _p_plus_vc:
|
||||
case _p_minus_cv:
|
||||
case _p_times_vc:
|
||||
@@ -4316,18 +4342,18 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _p_slr_vc:
|
||||
case _p_func2s_vc:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,xxc);
|
||||
pc = NEXTOP(pc,xxn);
|
||||
break;
|
||||
case _p_div_vc:
|
||||
case _p_sll_cv:
|
||||
case _p_slr_cv:
|
||||
case _p_arg_cv:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,xxc);
|
||||
pc = NEXTOP(pc,xxn);
|
||||
break;
|
||||
case _p_func2s_cv:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,xxc);
|
||||
pc = NEXTOP(pc,xxn);
|
||||
break;
|
||||
/* instructions type xxy */
|
||||
case _p_func2f_xy:
|
||||
@@ -5868,7 +5894,7 @@ p_predicate_lu_cps(void)
|
||||
static Int
|
||||
p_program_continuation(void)
|
||||
{
|
||||
PredEntry *pe = EnvPreg(((CELL *)ENV[E_E])[E_CP]);
|
||||
PredEntry *pe = EnvPreg((yamop *)((ENV_Parent(ENV))[E_CP]));
|
||||
if (pe->ModuleOfPred) {
|
||||
if (!Yap_unify(ARG1,pe->ModuleOfPred))
|
||||
return FALSE;
|
||||
|
||||
20
C/index.c
20
C/index.c
@@ -1373,7 +1373,7 @@ has_cut(yamop *pc)
|
||||
case _p_func2f_xx:
|
||||
pc = NEXTOP(pc,xxx);
|
||||
break;
|
||||
/* instructions type xxc */
|
||||
/* instructions type xxn */
|
||||
case _p_plus_vc:
|
||||
case _p_minus_cv:
|
||||
case _p_times_vc:
|
||||
@@ -1383,16 +1383,16 @@ has_cut(yamop *pc)
|
||||
case _p_sll_vc:
|
||||
case _p_slr_vc:
|
||||
case _p_func2s_vc:
|
||||
pc = NEXTOP(pc,xxc);
|
||||
pc = NEXTOP(pc,xxn);
|
||||
break;
|
||||
case _p_div_vc:
|
||||
case _p_sll_cv:
|
||||
case _p_slr_cv:
|
||||
case _p_arg_cv:
|
||||
pc = NEXTOP(pc,xxc);
|
||||
pc = NEXTOP(pc,xxn);
|
||||
break;
|
||||
case _p_func2s_cv:
|
||||
pc = NEXTOP(pc,xxc);
|
||||
pc = NEXTOP(pc,xxn);
|
||||
break;
|
||||
/* instructions type xxy */
|
||||
case _p_func2f_xy:
|
||||
@@ -2321,26 +2321,26 @@ add_info(ClauseDef *clause, UInt regno)
|
||||
case _p_sll_vc:
|
||||
case _p_slr_vc:
|
||||
case _p_func2s_vc:
|
||||
if (regcopy_in(myregs, nofregs, cl->u.xxc.x) &&
|
||||
(nofregs = delete_regcopy(myregs, nofregs, cl->u.xxc.x)) == 0 &&
|
||||
if (regcopy_in(myregs, nofregs, cl->u.xxn.x) &&
|
||||
(nofregs = delete_regcopy(myregs, nofregs, cl->u.xxn.x)) == 0 &&
|
||||
!ycopy) {
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
}
|
||||
cl = NEXTOP(cl,xxc);
|
||||
cl = NEXTOP(cl,xxn);
|
||||
break;
|
||||
case _p_div_vc:
|
||||
case _p_sll_cv:
|
||||
case _p_slr_cv:
|
||||
case _p_arg_cv:
|
||||
case _p_func2s_cv:
|
||||
if (regcopy_in(myregs, nofregs, cl->u.xxc.x) &&
|
||||
(nofregs = delete_regcopy(myregs, nofregs, cl->u.xxc.x)) == 0 &&
|
||||
if (regcopy_in(myregs, nofregs, cl->u.xxn.x) &&
|
||||
(nofregs = delete_regcopy(myregs, nofregs, cl->u.xxn.x)) == 0 &&
|
||||
!ycopy) {
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
}
|
||||
cl = NEXTOP(cl,xxc);
|
||||
cl = NEXTOP(cl,xxn);
|
||||
break;
|
||||
case _p_func2f_xy:
|
||||
if (regcopy_in(myregs, nofregs, cl->u.xxy.x) &&
|
||||
|
||||
@@ -164,7 +164,8 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
||||
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
sc = Yap_heap_regs;
|
||||
vsc_count++;
|
||||
return;
|
||||
if (vsc_count < 82500)
|
||||
return;
|
||||
#ifdef THREADS
|
||||
Yap_heap_regs->thread_handle[worker_id].thread_inst_count++;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user