Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3

This commit is contained in:
Vitor Santos Costa 2011-09-24 21:40:22 +01:00
commit 1e43c59cd5
9 changed files with 129 additions and 286 deletions

340
C/absmi.c
View File

@ -2145,6 +2145,7 @@ Yap_absmi(int inp)
PELOCK(9,ap);
DEC_CLREF_COUNT(cl);
// fprintf(stderr,"%d %p=%lx\n",worker_id, cl, cl->ClRefCount);
erase = (cl->ClFlags & ErasedMask) && !(cl->ClRefCount);
if (erase) {
saveregs();
@ -2320,11 +2321,11 @@ Yap_absmi(int inp)
/* save_b_y Yi */
Op(save_b_y, y);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.y.y,MkIntegerTerm((Int)B));
#if defined(YAPOR_SBA)
INITIALIZE_PERMVAR(YREG+PREG->u.y.y,MkIntegerTerm((Int)B));
#else
YREG[PREG->u.y.y] = MkIntegerTerm(LCL0-(CELL *) (B));
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.y.y,MkIntegerTerm(LCL0-(CELL *)(B)));
#endif /* YAPOR_SBA*/
PREG = NEXTOP(PREG, y);
GONext();
ENDOp();
@ -3303,11 +3304,7 @@ Yap_absmi(int inp)
pt0 = YREG + PREG->u.yx.y;
d0 = XREG(PREG->u.yx.x);
PREG = NEXTOP(PREG, yx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
GONext();
ENDP(pt0);
ENDD(d0);
@ -3324,16 +3321,8 @@ Yap_absmi(int inp)
pt1 = S_YREG + PREG->u.yyx.y2;
d1 = XREG(PREG->u.yyxx.x2);
PREG = NEXTOP(PREG, yyxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d1);
#else
*pt1 = d1;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
INITIALIZE_PERMVAR(pt1,d1);
ENDP(pt1);
ENDD(d1);
GONext();
@ -4414,11 +4403,7 @@ Yap_absmi(int inp)
pt0 = RepPair(d0);
d0 = pt0[1];
ENDP(pt0);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.yx.y,d0);
#else
YREG[PREG->u.yx.y] = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.yx.y,d0);
PREG = NEXTOP(PREG, yx);
GONext();
@ -4428,11 +4413,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = H;
/* include XREG on it */
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.yx.y,Unsigned(pt1 + 1));
#else
YREG[PREG->u.yx.y] = Unsigned(pt1 + 1);
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.yx.y,Unsigned(pt1 + 1));
PREG = NEXTOP(PREG, yx);
RESET_VARIABLE(pt1);
RESET_VARIABLE(pt1+1);
@ -4779,21 +4760,12 @@ Yap_absmi(int inp)
Op(unify_y_var, oy);
BEGD(d0);
d0 = *SREG++;
#if defined(YAPOR_SBA)
#ifdef FROZEN_STACKS
#ifdef YAPOR_SBA
if (d0 == 0) {
Bind_Local(YREG+PREG->u.oy.y,(CELL)(SREG-1));
} else {
Bind_Local(YREG+PREG->u.oy.y,d0);
}
#else
if (d0 == 0) {
YREG[PREG->u.oy.y] = (CELL)(SREG-1);
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,(CELL)(SREG-1));
} else
YREG[PREG->u.oy.y] = d0;
#endif /* FROZEN_STACKS */
#else
YREG[PREG->u.oy.y] = d0;
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,d0);
#endif /* YAPOR_SBA */
PREG = NEXTOP(PREG, oy);
GONext();
@ -4803,11 +4775,7 @@ Yap_absmi(int inp)
OpW(unify_y_var_write, oy);
CACHE_S();
READ_IN_S();
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.oy.y,(CELL) S_SREG);
#else
YREG[PREG->u.oy.y] = (CELL) S_SREG;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,(CELL) S_SREG);
PREG = NEXTOP(PREG, oy);
RESET_VARIABLE(S_SREG);
WRITEBACK_S(S_SREG+1);
@ -4819,21 +4787,11 @@ Yap_absmi(int inp)
BEGD(d0);
d0 = SREG[0];
#ifdef YAPOR_SBA
#ifdef FROZEN_STACKS
if (d0 == 0) {
Bind_Local(YREG+PREG->u.oy.y,(CELL)SREG);
} else {
Bind_Local(YREG+PREG->u.oy.y,d0);
}
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,(CELL)SREG);
} else
#else
if (d0 == 0) {
YREG[PREG->u.oy.y] = (CELL)SREG;
} else {
YREG[PREG->u.oy.y] = d0;
}
#endif /* FROZEN_STACKS */
#else
YREG[PREG->u.oy.y] = d0;
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,d0);
#endif /* YAPOR_SBA */
PREG = NEXTOP(PREG, oy);
GONext();
@ -4843,11 +4801,7 @@ Yap_absmi(int inp)
Op(unify_l_y_var_write, oy);
CACHE_S();
READ_IN_S();
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.oy.y,(CELL) S_SREG);
#else
YREG[PREG->u.oy.y] = (CELL) S_SREG;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,(CELL) S_SREG);
PREG = NEXTOP(PREG, oy);
RESET_VARIABLE(S_SREG);
ENDCACHE_S();
@ -4885,7 +4839,7 @@ Yap_absmi(int inp)
SREG++;
Bind(pt1, d0);
GONext();
ENDP(pt1);
ENDP(pt1);
/* first argument may be unbound */
derefa_body(d0, pt0, uvalx_unk, uvalx_nonvar);
@ -6260,7 +6214,7 @@ Yap_absmi(int inp)
*pt0 = (CELL)STACK_TO_SBA(pt0);
} else
#endif /* YAPOR_SBA && FROZEN_STACKS */
RESET_VARIABLE(pt0);
INITIALIZE_PERMVAR(pt0, (CELL)pt0);
ENDP(pt0);
GONext();
ENDOp();
@ -6464,11 +6418,7 @@ Yap_absmi(int inp)
ENDOp();
Op(write_y_var, y);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.y.y,Unsigned(SREG));
#else
YREG[PREG->u.y.y] = Unsigned(SREG);
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.y.y,Unsigned(SREG));
PREG = NEXTOP(PREG, y);
RESET_VARIABLE(SREG);
SREG++;
@ -6715,21 +6665,13 @@ Yap_absmi(int inp)
ENDOpW();
Op(save_pair_y, oy);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.oy.y,AbsPair(SREG));
#else
YREG[PREG->u.oy.y] = AbsPair(SREG);
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,AbsPair(SREG));
PREG = NEXTOP(PREG, oy);
GONext();
ENDOp();
OpW(save_pair_y_write, oy);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.oy.y,AbsPair(SREG));
#else
YREG[PREG->u.oy.y] = AbsPair(SREG);
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,AbsPair(SREG));
PREG = NEXTOP(PREG, oy);
GONextW();
ENDOpW();
@ -6747,21 +6689,13 @@ Yap_absmi(int inp)
ENDOpW();
Op(save_appl_y, oy);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.oy.y,AbsAppl(SREG-1));
#else
YREG[PREG->u.oy.y] = AbsAppl(SREG - 1);
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,AbsAppl(SREG-1));
PREG = NEXTOP(PREG, oy);
GONext();
ENDOp();
OpW(save_appl_y_write, oy);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(YREG+PREG->u.oy.y,AbsAppl(SREG-1));
#else
YREG[PREG->u.oy.y] = AbsAppl(SREG - 1);
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(YREG+PREG->u.oy.y,AbsAppl(SREG-1));
PREG = NEXTOP(PREG, oy);
GONextW();
ENDOpW();
@ -9265,11 +9199,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -9318,11 +9248,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -9451,11 +9377,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -9504,11 +9426,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -9637,11 +9555,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -9690,11 +9604,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -9880,11 +9790,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -9933,11 +9839,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -9984,11 +9886,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10118,11 +10016,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10171,11 +10065,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10304,11 +10194,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10357,11 +10243,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10539,11 +10421,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10592,11 +10470,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10641,11 +10515,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10823,11 +10693,7 @@ Yap_absmi(int inp)
}
pt0 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10876,11 +10742,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -10923,11 +10785,7 @@ Yap_absmi(int inp)
BEGP(pt0);
pt0 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt0,d0);
#else
*pt0 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt0,d0);
ENDP(pt0);
GONext();
@ -11779,11 +11637,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,pt0[d0]);
#else
*pt1 = pt0[d0];
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,pt0[d0]);
ENDP(pt1);
GONext();
ENDP(pt0);
@ -11803,11 +11657,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(PREG, yxx);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,pt0[d0-1]);
#else
*pt1 = pt0[d0-1];
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,pt0[d0-1]);
GONext();
ENDP(pt1);
ENDP(pt0);
@ -11885,11 +11735,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,pt0[d0]);
#else
*pt1 = pt0[d0];
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,pt0[d0]);
ENDP(pt1);
GONext();
ENDP(pt0);
@ -11909,11 +11755,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(PREG, yxn);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,pt0[d0-1]);
#else
*pt1 = pt0[d0-1];
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,pt0[d0-1]);
ENDP(pt1);
GONext();
ENDP(pt0);
@ -12324,11 +12166,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxx),Osbpp),l);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d0);
#else
*pt1 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
} else if ((Int)d1 > 0) {
@ -12372,22 +12210,14 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxx),Osbpp),l);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d0);
#else
*pt1 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
} else if (d1 == 0) {
BEGP(pt1);
pt1 = YREG + PREG->u.yxx.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxx),Osbpp),l);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d0);
#else
*pt1 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
} else {
@ -12462,11 +12292,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxn),Osbpp),l);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d0);
#else
*pt1 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
}
@ -12511,22 +12337,14 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxn),Osbpp),l);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d0);
#else
*pt1 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
} else if (d1 == 0) {
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxn),Osbpp),l);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d0);
#else
*pt1 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
} else {
@ -12589,11 +12407,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxn),Osbpp),l);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d0);
#else
*pt1 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
}
@ -12601,11 +12415,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxn),Osbpp),l);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d0);
#else
*pt1 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
GONext();
}
@ -12655,11 +12465,7 @@ Yap_absmi(int inp)
BEGP(pt1);
pt1 = YREG + PREG->u.yxn.y;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, yxn),Osbpp),l);
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
Bind_Local(pt1,d0);
#else
*pt1 = d0;
#endif /* YAPOR_SBA && FROZEN_STACKS */
INITIALIZE_PERMVAR(pt1,d0);
ENDP(pt1);
ENDD(d1);
GONext();
@ -12742,24 +12548,24 @@ Yap_absmi(int inp)
if (IsExtensionFunctor(d1)) {
XREG(PREG->u.xxy.x1) = d0;
PREG = NEXTOP(PREG, xxy);
*pt0 = MkIntTerm(0);
INITIALIZE_PERMVAR(pt0, MkIntTerm(0));
GONext();
}
XREG(PREG->u.xxy.x1) = MkAtomTerm(NameOfFunctor(d1));
PREG = NEXTOP(PREG, xxy);
*pt0 = MkIntegerTerm(ArityOfFunctor(d1));
INITIALIZE_PERMVAR(pt0, MkIntegerTerm(ArityOfFunctor(d1)));
GONext();
} else if (IsPairTerm(d0)) {
CELL *pt0 = YREG+PREG->u.xxy.y2;
XREG(PREG->u.xxy.x1) = TermDot;
PREG = NEXTOP(PREG, xxy);
*pt0 = MkIntTerm(2);
INITIALIZE_PERMVAR(pt0, MkIntTerm(2));
GONext();
} else {
CELL *pt0 = YREG+PREG->u.xxy.y2;
XREG(PREG->u.xxy.x1) = d0;
PREG = NEXTOP(PREG, xxy);
*pt0 = MkIntTerm(0);
INITIALIZE_PERMVAR(pt0, MkIntTerm(0));
GONext();
}
@ -12793,24 +12599,24 @@ Yap_absmi(int inp)
if (IsExtensionFunctor(d1)) {
XREG(PREG->u.yxx.x1) = MkIntTerm(0);
PREG = NEXTOP(PREG, yxx);
*pt0 = d0;
INITIALIZE_PERMVAR(pt0, d0);
GONext();
}
XREG(PREG->u.yxx.x1) = MkIntegerTerm(ArityOfFunctor(d1));
PREG = NEXTOP(PREG, yxx);
*pt0 = MkAtomTerm(NameOfFunctor(d1));
INITIALIZE_PERMVAR(pt0, MkAtomTerm(NameOfFunctor(d1)));
GONext();
} else if (IsPairTerm(d0)) {
CELL *pt0 = YREG+PREG->u.yxx.y;
XREG(PREG->u.yxx.x1) = MkIntTerm(2);
PREG = NEXTOP(PREG, yxx);
*pt0 = TermDot;
INITIALIZE_PERMVAR(pt0 ,TermDot);
GONext();
} else {
CELL *pt0 = YREG+PREG->u.yxx.y;
XREG(PREG->u.yxx.x1) = MkIntTerm(0);
PREG = NEXTOP(PREG, yxx);
*pt0 = d0;
INITIALIZE_PERMVAR(pt0, d0);
GONext();
}
@ -12844,27 +12650,27 @@ Yap_absmi(int inp)
CELL *pt1 = YREG+PREG->u.yyx.y2;
if (IsExtensionFunctor(d1)) {
PREG = NEXTOP(PREG, yyx);
*pt0 = d0;
*pt1 = MkIntTerm(0);
INITIALIZE_PERMVAR(pt0, d0);
INITIALIZE_PERMVAR(pt1, MkIntTerm(0));
GONext();
}
PREG = NEXTOP(PREG, yyx);
*pt0 = MkAtomTerm(NameOfFunctor(d1));
*pt1 = MkIntegerTerm(ArityOfFunctor(d1));
INITIALIZE_PERMVAR(pt0, MkAtomTerm(NameOfFunctor(d1)));
INITIALIZE_PERMVAR(pt1, MkIntegerTerm(ArityOfFunctor(d1)));
GONext();
} else if (IsPairTerm(d0)) {
CELL *pt0 = YREG+PREG->u.yyx.y1;
CELL *pt1 = YREG+PREG->u.yyx.y2;
PREG = NEXTOP(PREG, yyx);
*pt0 = TermDot;
*pt1 = MkIntTerm(2);
INITIALIZE_PERMVAR(pt0, TermDot);
INITIALIZE_PERMVAR(pt1, MkIntTerm(2));
GONext();
} else {
CELL *pt0 = YREG+PREG->u.yyx.y1;
CELL *pt1 = YREG+PREG->u.yyx.y2;
PREG = NEXTOP(PREG, yyx);
*pt0 = d0;
*pt1 = MkIntTerm(0);
INITIALIZE_PERMVAR(pt0, d0);
INITIALIZE_PERMVAR(pt1, MkIntTerm(0));
GONext();
}

View File

@ -186,9 +186,10 @@ int Yap_CleanOpaqueVariable(CELL *pt)
Opaque_CallOnWrite
Yap_blob_write_handler_from_slot(Int slot)
{
CACHE_REGS
CELL blob_info, blob_tag;
MP_INT *blobp;
Term t = Yap_GetFromSlot(slot);
Term t = Yap_GetFromSlot(slot PASS_REGS);
CELL *pt = RepAppl(t);
#ifdef DEBUG
@ -213,7 +214,8 @@ Yap_blob_write_handler_from_slot(Int slot)
extern Int Yap_blob_tag_from_slot(Int slot)
{
Term t = Yap_GetFromSlot(slot);
CACHE_REGS
Term t = Yap_GetFromSlot(slot PASS_REGS);
CELL *pt = RepAppl(t);
#ifdef DEBUG
@ -229,9 +231,10 @@ extern Int Yap_blob_tag_from_slot(Int slot)
void *
Yap_blob_info_from_slot(Int slot)
{
CACHE_REGS
CELL blob_info, blob_tag;
MP_INT *blobp;
Term t = Yap_GetFromSlot(slot);
Term t = Yap_GetFromSlot(slot PASS_REGS);
CELL *pt = RepAppl(t);
#ifdef DEBUG

View File

@ -961,7 +961,7 @@ exec_absmi(int top USES_REGS)
restore_H();
/* set stack */
ASP = (CELL *)PROTECT_FROZEN_B(B);
Yap_PopSlots();
Yap_PopSlots( PASS_REGS1 );
LOCK(LOCAL_SignalLock);
/* forget any signals active, we're reborne */
LOCAL_ActiveSignals = 0;

View File

@ -209,8 +209,10 @@ IsPrefixOp(Atom op,int *pptr, int *rpptr USES_REGS)
if (!opp)
return FALSE;
if (opp->OpModule &&
opp->OpModule != CurrentModule)
opp->OpModule != CurrentModule) {
READ_UNLOCK(opp->OpRWLock);
return FALSE;
}
if ((p = opp->Prefix) != 0) {
READ_UNLOCK(opp->OpRWLock);
*pptr = *rpptr = p & MaskPrio;
@ -239,8 +241,10 @@ IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr USES_REGS)
if (!opp)
return FALSE;
if (opp->OpModule &&
opp->OpModule != CurrentModule)
opp->OpModule != CurrentModule) {
READ_UNLOCK(opp->OpRWLock);
return FALSE;
}
if ((p = opp->Infix) != 0) {
READ_UNLOCK(opp->OpRWLock);
*pptr = *rpptr = *lpptr = p & MaskPrio;
@ -271,8 +275,10 @@ IsPosfixOp(Atom op, int *pptr, int *lpptr USES_REGS)
if (!opp)
return FALSE;
if (opp->OpModule &&
opp->OpModule != CurrentModule)
opp->OpModule != CurrentModule) {
READ_UNLOCK(opp->OpRWLock);
return FALSE;
}
if ((p = opp->Posfix) != 0) {
READ_UNLOCK(opp->OpRWLock);
*pptr = *lpptr = p & MaskPrio;

View File

@ -69,7 +69,8 @@ ERROR(qlfr_err_t my_err)
static Atom
LookupAtom(Atom oat)
{
CELL hash = (CELL)(oat) % LOCAL_ImportAtomHashTableSize;
CACHE_REGS
CELL hash = (CELL)(oat) % LOCAL_ImportAtomHashTableSize;
import_atom_hash_entry_t *a;
a = LOCAL_ImportAtomHashChain[hash];
@ -86,6 +87,7 @@ LookupAtom(Atom oat)
static void
InsertAtom(Atom oat, Atom at)
{
CACHE_REGS
CELL hash = (CELL)(oat) % LOCAL_ImportAtomHashTableSize;
import_atom_hash_entry_t *a;
@ -109,6 +111,7 @@ InsertAtom(Atom oat, Atom at)
static Functor
LookupFunctor(Functor ofun)
{
CACHE_REGS
CELL hash = (CELL)(ofun) % LOCAL_ImportFunctorHashTableSize;
import_functor_hash_entry_t *f;
@ -126,6 +129,7 @@ LookupFunctor(Functor ofun)
static void
InsertFunctor(Functor ofun, Functor fun)
{
CACHE_REGS
CELL hash = (CELL)(ofun) % LOCAL_ImportFunctorHashTableSize;
import_functor_hash_entry_t *f;
@ -149,6 +153,7 @@ InsertFunctor(Functor ofun, Functor fun)
static PredEntry *
LookupPredEntry(PredEntry *op)
{
CACHE_REGS
CELL hash = (CELL)(op) % LOCAL_ImportPredEntryHashTableSize;
import_pred_entry_hash_entry_t *p;
@ -166,6 +171,7 @@ LookupPredEntry(PredEntry *op)
static void
InsertPredEntry(PredEntry *op, PredEntry *pe)
{
CACHE_REGS
CELL hash = (CELL)(op) % LOCAL_ImportPredEntryHashTableSize;
import_pred_entry_hash_entry_t *p;
@ -189,6 +195,7 @@ InsertPredEntry(PredEntry *op, PredEntry *pe)
static OPCODE
LookupOPCODE(OPCODE op)
{
CACHE_REGS
CELL hash = (CELL)(op) % LOCAL_ImportOPCODEHashTableSize;
import_opcode_hash_entry_t *f;
@ -206,6 +213,7 @@ LookupOPCODE(OPCODE op)
static int
OpcodeID(OPCODE op)
{
CACHE_REGS
CELL hash = (CELL)(op) % LOCAL_ImportOPCODEHashTableSize;
import_opcode_hash_entry_t *f;
@ -223,6 +231,7 @@ OpcodeID(OPCODE op)
static void
InsertOPCODE(OPCODE op0, int i, OPCODE op)
{
CACHE_REGS
CELL hash = (CELL)(op0) % LOCAL_ImportOPCODEHashTableSize;
import_opcode_hash_entry_t *f;
f = LOCAL_ImportOPCODEHashChain[hash];
@ -246,6 +255,7 @@ InsertOPCODE(OPCODE op0, int i, OPCODE op)
static DBRef
LookupDBRef(DBRef dbr)
{
CACHE_REGS
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
import_dbref_hash_entry_t *p;
@ -264,6 +274,7 @@ LookupDBRef(DBRef dbr)
static LogUpdClause *
LookupMayFailDBRef(DBRef dbr)
{
CACHE_REGS
CELL hash = (CELL)(dbr) % LOCAL_ImportDBRefHashTableSize;
import_dbref_hash_entry_t *p;
@ -281,6 +292,7 @@ LookupMayFailDBRef(DBRef dbr)
static void
InsertDBRef(DBRef dbr0, DBRef dbr)
{
CACHE_REGS
CELL hash = (CELL)(dbr0) % LOCAL_ImportDBRefHashTableSize;
import_dbref_hash_entry_t *p;
@ -305,6 +317,7 @@ InsertDBRef(DBRef dbr0, DBRef dbr)
static void
InitHash(void)
{
CACHE_REGS
LOCAL_ImportFunctorHashTableSize = EXPORT_FUNCTOR_TABLE_SIZE;
LOCAL_ImportFunctorHashChain = (import_functor_hash_entry_t **)calloc(1, sizeof(import_functor_hash_entry_t *)* LOCAL_ImportFunctorHashTableSize);
LOCAL_ImportAtomHashTableSize = EXPORT_ATOM_TABLE_SIZE;
@ -320,6 +333,7 @@ InitHash(void)
static void
CloseHash(void)
{
CACHE_REGS
UInt i;
for (i=0; i < LOCAL_ImportFunctorHashTableSize; i++) {
import_functor_hash_entry_t *a = LOCAL_ImportFunctorHashChain[i];
@ -667,6 +681,7 @@ read_header(IOSTREAM *stream)
static void
ReadHash(IOSTREAM *stream)
{
CACHE_REGS
UInt i;
RCHECK(read_tag(stream) == QLY_START_X);
LOCAL_XDiff = (char *)(&ARG1) - (char *)read_uint(stream);
@ -791,6 +806,7 @@ ReadHash(IOSTREAM *stream)
static void
read_clauses(IOSTREAM *stream, PredEntry *pp, UInt nclauses, UInt flags) {
CACHE_REGS
if (pp->PredFlags & LogUpdatePredFlag) {
pp->TimeStampOfPred = 0L;
/* first, clean up whatever was there */
@ -821,7 +837,7 @@ read_clauses(IOSTREAM *stream, PredEntry *pp, UInt nclauses, UInt flags) {
cl->ClFlags &= ~InUseMask;
cl->ClRefCount = nrefs;
LOCAL_HDiff = (char *)cl-base;
RestoreLUClause(cl, pp);
RestoreLUClause(cl, pp PASS_REGS);
Yap_AssertzClause(pp, cl->ClCode);
}
} else if (pp->PredFlags & MegaClausePredFlag) {
@ -855,7 +871,8 @@ read_clauses(IOSTREAM *stream, PredEntry *pp, UInt nclauses, UInt flags) {
LOCAL_HDiff = (char *)cl-base;
read_bytes(stream, cl, size);
RestoreDynamicClause(cl, pp);
INIT_LOCK(cl->ClLock);
RestoreDynamicClause(cl, pp PASS_REGS);
Yap_AssertzClause(pp, cl->ClCode);
}
@ -927,6 +944,7 @@ read_ops(IOSTREAM *stream) {
op->Prefix = read_bits16(stream);
op->Infix = read_bits16(stream);
op->Posfix = read_bits16(stream);
WRITE_UNLOCK(op->OpRWLock);
}
}
@ -977,7 +995,7 @@ p_read_program( USES_REGS1 )
read_module(stream);
Sclose( stream );
/* back to the top level we go */
Yap_CloseSlots();
Yap_CloseSlots(PASS_REGS1);
siglongjmp(LOCAL_RestartEnv, 3);
return TRUE;

View File

@ -35,6 +35,7 @@ STATIC_PROTO(void CleanCode, (PredEntry * USES_REGS));
static void
LookupAtom(Atom at)
{
CACHE_REGS
char *p = RepAtom(at)->StrOfAE;
CELL hash = HashFunction((unsigned char *)p) % LOCAL_ExportAtomHashTableSize;
export_atom_hash_entry_t *a;
@ -59,6 +60,7 @@ LookupAtom(Atom at)
static void
LookupFunctor(Functor fun)
{
CACHE_REGS
CELL hash = (CELL)(fun) % LOCAL_ExportFunctorHashTableSize;
export_functor_hash_entry_t *f;
Atom name = NameOfFunctor(fun);
@ -87,6 +89,7 @@ LookupFunctor(Functor fun)
static void
LookupPredEntry(PredEntry *pe)
{
CACHE_REGS
CELL hash = (CELL)(pe) % LOCAL_ExportPredEntryHashTableSize;
export_pred_entry_hash_entry_t *p;
UInt arity = pe->ArityOfPE;
@ -139,6 +142,7 @@ LookupPredEntry(PredEntry *pe)
static void
LookupDBRef(DBRef ref)
{
CACHE_REGS
CELL hash = Unsigned(ref) % LOCAL_ExportDBRefHashTableSize;
export_dbref_hash_entry_t *a;
@ -165,6 +169,7 @@ LookupDBRef(DBRef ref)
static void
InitHash(void)
{
CACHE_REGS
LOCAL_ExportFunctorHashTableNum = 0;
LOCAL_ExportFunctorHashTableSize = EXPORT_FUNCTOR_TABLE_SIZE;
LOCAL_ExportFunctorHashChain = (export_functor_hash_entry_t **)calloc(1, sizeof(export_functor_hash_entry_t *)* LOCAL_ExportFunctorHashTableSize);
@ -182,6 +187,7 @@ InitHash(void)
static void
CloseHash(void)
{
CACHE_REGS
LOCAL_ExportFunctorHashTableNum = 0;
LOCAL_ExportFunctorHashTableSize = 0L;
free(LOCAL_ExportFunctorHashChain);
@ -391,6 +397,7 @@ static size_t save_tag(IOSTREAM *stream, qlf_tag_t tag)
static int
SaveHash(IOSTREAM *stream)
{
CACHE_REGS
UInt i;
/* first, current opcodes */
CHECK(save_tag(stream, QLY_START_X));
@ -554,6 +561,7 @@ clean_pred(PredEntry *pp USES_REGS) {
static size_t
mark_pred(PredEntry *ap)
{
CACHE_REGS
if (ap->ModuleOfPred != IDB_MODULE) {
if (ap->ArityOfPE) {
FuncAdjust(ap->FunctorOfPred);

View File

@ -461,6 +461,3 @@ Yap_InitLowLevelTrace(void)
}
#endif

View File

@ -1578,5 +1578,9 @@ void SET_ASP__(CELL *yreg, Int sz USES_REGS) {
ASP = (CELL *)PROTECT_FROZEN_B(B);
}
#if YAPOR
#define INITIALIZE_PERMVAR(PTR, V) Bind_Local((PTR), (V))
#else
#define INITIALIZE_PERMVAR(PTR, V) *(PTR) = (V)
#endif

View File

@ -57,11 +57,11 @@ static void share_private_nodes(int worker_q);
REMOTE_end_trail_copy(Q) = (CELL) (TR)
#else
#define COMPUTE_SEGMENTS_TO_COPY_TO(Q) \
REMOTE_start_global_copy(Q) = (CELL) (H0); \
REMOTE_end_global_copy(Q) = (CELL) (H); \
REMOTE_start_global_copy(Q) = (CELL) (H0); \
REMOTE_end_global_copy(Q) = (CELL) (H); \
REMOTE_start_local_copy(Q) = (CELL) (B); \
REMOTE_end_local_copy(Q) = (CELL) (LCL0); \
REMOTE_start_trail_copy(Q) = (CELL) (LOCAL_TrailBase); \
REMOTE_end_local_copy(Q) = (CELL) (GLOBAL_root_cp); \
REMOTE_start_trail_copy(Q) = (CELL) (GLOBAL_root_cp->cp_tr); \
REMOTE_end_trail_copy(Q) = (CELL) (TR)
#endif
@ -702,3 +702,4 @@ void share_private_nodes(int worker_q) {
return;
}
#endif /* YAPOR_COPY */