diff --git a/C/absmi.c b/C/absmi.c index 7cff8fffb..4b2d9086b 100755 --- a/C/absmi.c +++ b/C/absmi.c @@ -3338,11 +3338,7 @@ Yap_absmi(int inp) deref_body(d1, pt0, gvalx_nonvar_unk, gvalx_nonvar_nonvar); /* first argument bound, second unbound */ PREG = NEXTOP(PREG, xx); - BIND_AND_JUMP(pt0, d0); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, d0); GONext(); ENDP(pt0); @@ -3359,31 +3355,15 @@ Yap_absmi(int inp) gvalx_var_nonvar: /* first unbound, second bound */ PREG = NEXTOP(PREG, xx); - BIND(pt0, d1, bind_gvalx_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_gvalx_var_nonvar: -#endif + Bind(pt0, d1); GONext(); BEGP(pt1); deref_body(d1, pt1, gvalx_var_unk, gvalx_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, xx); - UnifyCells(pt0, pt1, uc1, uc2); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc1: -#endif + UnifyCells(pt0, pt1); GONext(); -#ifdef COROUTINING - uc2: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDD(d1); ENDP(pt0); @@ -3420,12 +3400,7 @@ Yap_absmi(int inp) deref_body(d1, pt1, gvaly_nonvar_unk, gvaly_nonvar_nonvar); /* first argument bound, second unbound */ PREG = NEXTOP(PREG, yx); - BIND(pt1, d0, bind_gvaly_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_gvaly_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -3439,31 +3414,15 @@ Yap_absmi(int inp) gvaly_var_nonvar: /* first unbound, second bound */ PREG = NEXTOP(PREG, yx); - BIND(pt0, d1, bind_gvaly_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_gvaly_var_nonvar: -#endif + Bind(pt0, d1); GONext(); BEGP(pt1); deref_body(d1, pt1, gvaly_var_unk, gvaly_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, yx); - UnifyCells(pt0, pt1, uc3, uc4); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc3: -#endif + UnifyCells(pt0, pt1); GONext(); -#ifdef COROUTINING - uc4: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); ENDD(d1); @@ -3492,12 +3451,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_unk, gatom_nonvar); /* argument is a variable */ PREG = NEXTOP(PREG, xc); - BIND(pt0, d1, bind_gatom); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_gatom: -#endif + Bind(pt0, d1); GONext(); ENDP(pt0); ENDD(d1); @@ -3523,11 +3477,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_2unk, gatom_2nonvar); /* argument is a variable */ - BIND(pt0, PREG->u.cc.c1, gatom_2b); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.cc.c1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.cc.c1); ENDP(pt0); gatom_2b: /* fetch arguments */ @@ -3549,12 +3499,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_2bunk, gatom_2bnonvar); /* argument is a variable */ PREG = NEXTOP(PREG, cc); - BIND(pt0, d1, gatom_2c); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - gatom_2c: -#endif + Bind(pt0, d1); GONext(); ENDP(pt0); ENDD(d1); @@ -3580,11 +3525,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_3unk, gatom_3nonvar); /* argument is a variable */ - BIND(pt0, PREG->u.ccc.c1, gatom_3b); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.ccc.c1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.ccc.c1); ENDP(pt0); gatom_3b: /* fetch arguments */ @@ -3603,11 +3544,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_3bunk, gatom_3bnonvar); /* argument is a variable */ - BIND(pt0, PREG->u.ccc.c2, gatom_3c); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.ccc.c2); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.ccc.c2); ENDP(pt0); gatom_3c: /* fetch arguments */ @@ -3629,12 +3566,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_3cunk, gatom_3cnonvar); /* argument is a variable */ PREG = NEXTOP(PREG, ccc); - BIND(pt0, d1, gatom_3d); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - gatom_3d: -#endif + Bind(pt0, d1); GONext(); ENDP(pt0); ENDD(d1); @@ -3660,11 +3592,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_4unk, gatom_4nonvar); /* argument is a variable */ - BIND(pt0, PREG->u.cccc.c1, gatom_4b); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.cccc.c1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.cccc.c1); ENDP(pt0); gatom_4b: /* fetch arguments */ @@ -3683,11 +3611,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_4bunk, gatom_4bnonvar); /* argument is a variable */ - BIND(pt0, PREG->u.cccc.c2, gatom_4c); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.cccc.c2); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.cccc.c2); ENDP(pt0); gatom_4c: /* fetch arguments */ @@ -3706,11 +3630,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_4cunk, gatom_4cnonvar); /* argument is a variable */ - BIND(pt0, PREG->u.cccc.c3, gatom_4d); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.cccc.c3); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.cccc.c3); ENDP(pt0); gatom_4d: /* fetch arguments */ @@ -3732,12 +3652,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_4dunk, gatom_4dnonvar); /* argument is a variable */ PREG = NEXTOP(PREG, cccc); - BIND(pt0, d1, gatom_4e); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - gatom_4e: -#endif + Bind(pt0, d1); GONext(); ENDP(pt0); ENDD(d1); @@ -3763,11 +3678,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_5unk, gatom_5nonvar); /* argument is a variable */ - BIND(pt0, PREG->u.ccccc.c1, gatom_5b); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.ccccc.c1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.ccccc.c1); ENDP(pt0); gatom_5b: /* fetch arguments */ @@ -3786,11 +3697,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_5bunk, gatom_5bnonvar); /* argument is a variable */ - BIND(pt0, PREG->u.ccccc.c2, gatom_5c); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.ccccc.c2); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.ccccc.c2); ENDP(pt0); gatom_5c: /* fetch arguments */ @@ -3809,11 +3716,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_5cunk, gatom_5cnonvar); /* argument is a variable */ - BIND(pt0, PREG->u.ccccc.c3, gatom_5d); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.ccccc.c3); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.ccccc.c3); ENDP(pt0); gatom_5d: /* fetch arguments */ @@ -3832,11 +3735,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_5dunk, gatom_5dnonvar); /* argument is a variable */ - BIND(pt0, PREG->u.ccccc.c4, gatom_5e); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.ccccc.c4); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.ccccc.c4); ENDP(pt0); gatom_5e: /* fetch arguments */ @@ -3858,12 +3757,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_5eunk, gatom_5enonvar); /* argument is a variable */ PREG = NEXTOP(PREG, ccccc); - BIND(pt0, d1, gatom_5f); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - gatom_5f: -#endif + Bind(pt0, d1); GONext(); ENDP(pt0); ENDD(d1); @@ -3889,11 +3783,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_6unk, gatom_6nonvar); /* argument is a variable */ - BIND(pt0, PREG->u.cccccc.c1, gatom_6b); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.cccccc.c1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.cccccc.c1); ENDP(pt0); gatom_6b: /* fetch arguments */ @@ -3912,11 +3802,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_6bunk, gatom_6bnonvar); /* argument is a variable */ - BIND(pt0, PREG->u.cccccc.c2, gatom_6c); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.cccccc.c2); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.cccccc.c2); ENDP(pt0); gatom_6c: /* fetch arguments */ @@ -3935,11 +3821,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_6cunk, gatom_6cnonvar); /* argument is a variable */ - BIND(pt0, PREG->u.cccccc.c3, gatom_6d); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.cccccc.c3); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.cccccc.c3); ENDP(pt0); gatom_6d: /* fetch arguments */ @@ -3958,11 +3840,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_6dunk, gatom_6dnonvar); /* argument is a variable */ - BIND(pt0, PREG->u.cccccc.c4, gatom_6e); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.cccccc.c4); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.cccccc.c4); ENDP(pt0); gatom_6e: /* fetch arguments */ @@ -3981,11 +3859,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_6eunk, gatom_6enonvar); /* argument is a variable */ - BIND(pt0, PREG->u.cccccc.c5, gatom_6f); -#ifdef COROUTINING - DO_TRAIL(pt0, PREG->u.cccccc.c5); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); -#endif + Bind(pt0, PREG->u.cccccc.c5); ENDP(pt0); gatom_6f: /* fetch arguments */ @@ -4007,12 +3881,7 @@ Yap_absmi(int inp) deref_body(d0, pt0, gatom_6funk, gatom_6fnonvar); /* argument is a variable */ PREG = NEXTOP(PREG, cccccc); - BIND(pt0, d1, gatom_6g); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - gatom_6g: -#endif + Bind(pt0, d1); GONext(); ENDP(pt0); ENDD(d1); @@ -4049,15 +3918,8 @@ Yap_absmi(int inp) PREG = NEXTOP(PREG, x); BEGD(d0); d0 = AbsPair(S_SREG); - BIND(pt0, d0, bind_glist); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) { - Yap_WakeUp(pt0); - S_SREG = H; - } - bind_glist: -#endif + Bind(pt0, d0); + S_SREG = H; /* don't put an ENDD just after a label */ H = S_SREG + 2; ENDD(d0); @@ -4103,14 +3965,7 @@ Yap_absmi(int inp) START_PREFETCH_W(xfa); BEGD(d1); d1 = AbsAppl(H); - BIND(pt0, d1, bind_gstruct); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) { - Yap_WakeUp(pt0); - } - bind_gstruct: -#endif + Bind(pt0, d1); /* now, set pt0 to point to the heap where we are going to * build our term */ pt0 = H; @@ -4169,12 +4024,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = AbsAppl(PREG->u.xd.d); PREG = NEXTOP(PREG, xd); - BIND(pt0, d1, bind_gfloat); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_gfloat: -#endif + Bind(pt0, d1); GONext(); ENDD(d1); END_PREFETCH(); @@ -4214,12 +4064,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = AbsAppl(PREG->u.xi.i); PREG = NEXTOP(PREG, xi); - BIND(pt0, d1, bind_glongint); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_glongint: -#endif + Bind(pt0, d1); GONext(); ENDD(d1); END_PREFETCH(); @@ -4262,12 +4107,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = PREG->u.xN.b; PREG = NEXTOP(PREG, xN); - BIND(pt0, d1, bind_gbigint); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_gbigint: -#endif + Bind(pt0, d1); GONext(); ENDD(d1); END_PREFETCH(); @@ -4301,12 +4141,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = PREG->u.xD.D; PREG = NEXTOP(PREG, xD); - BIND(pt0, d1, bind_gdbterm); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_gdbterm: -#endif + Bind(pt0, d1); GONext(); ENDD(d1); END_PREFETCH(); @@ -4353,12 +4188,7 @@ Yap_absmi(int inp) deref_body(d1, pt1, glist_valx_nonvar_unk, glist_valx_nonvar_nonvar); /* head bound, argument unbound */ PREG = NEXTOP(PREG, xx); - BIND(pt1, d0, bind_glist_valx_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_glist_valx_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -4374,31 +4204,15 @@ Yap_absmi(int inp) glist_valx_var_nonvar: /* head is unbound, second arg bound */ PREG = NEXTOP(PREG, xx); - BIND_GLOBAL(pt0, d0, bind_glist_valx_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_glist_valx_var_nonvar: -#endif + Bind_Global(pt0, d0); GONext(); BEGP(pt1); deref_body(d0, pt1, glist_valx_var_unk, glist_valx_var_nonvar); /* head and second argument are unbound */ PREG = NEXTOP(PREG, xx); - UnifyGlobalRegCells(pt0, pt1, uc5, uc6); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc5: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc6: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); END_PREFETCH(); @@ -4414,24 +4228,10 @@ Yap_absmi(int inp) S_SREG[0] = d1; ENDD(d1); ALWAYS_START_PREFETCH_W(xx); -#ifdef COROUTINING PREG = NEXTOP(PREG, xx); H = S_SREG + 2; WRITEBACK_S(S_SREG+1); -#endif - DBIND(pt0, d0, dbind); -#ifndef COROUTINING - /* include XREG on it */ - PREG = NEXTOP(PREG, xx); - H = S_SREG + 2; - WRITEBACK_S(S_SREG+1); -#endif - -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - dbind: -#endif + Bind(pt0, d0); ALWAYS_GONextW(); ALWAYS_END_PREFETCH_W(); ENDCACHE_S(); @@ -4475,12 +4275,7 @@ Yap_absmi(int inp) /* deref second argument */ derefa_body(d1, pt1, glist_valy_nonvar_unk, glist_valy_nonvar_nonvar); /* first argument bound, second unbound */ - BIND(pt1, d0, bind_glist_valy_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_glist_valy_nonvar_var: -#endif + Bind(pt1, d0); GONext(); @@ -4496,30 +4291,14 @@ Yap_absmi(int inp) glist_valy_var_nonvar: /* first unbound, second bound */ PREG = NEXTOP(PREG, yx); - BIND_GLOBAL(pt0, d1, bind_glist_valy_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_glist_valy_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); derefa_body(d1, pt1, glist_valy_var_unk, glist_valy_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, yx); - UnifyGlobalRegCells(pt0, pt1, uc7, uc8); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc7: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc8: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDD(d1); @@ -4533,15 +4312,7 @@ Yap_absmi(int inp) BEGP(pt1); pt1 = H; d0 = AbsPair(pt1); - BIND(pt0, d0, bind_glist_valy_write); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) { - Yap_WakeUp(pt0); - pt1 = H; - } - bind_glist_valy_write: -#endif + Bind(pt0, d0); BEGD(d0); /* include XREG on it */ d0 = YREG[PREG->u.yx.y]; @@ -4590,12 +4361,7 @@ Yap_absmi(int inp) H = pt1 + 2; BEGD(d0); d0 = AbsPair(pt1); - BIND(pt0, d0, bind_glist_varx_write); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_glist_varx_write: -#endif + Bind(pt0, d0); PREG = NEXTOP(PREG, xx); ENDD(d0); ENDP(pt1); @@ -4641,12 +4407,7 @@ Yap_absmi(int inp) RESET_VARIABLE(pt1+1); d0 = AbsPair(pt1); H = pt1 + 2; - BIND(pt0, d0, bind_glist_void_vary_write); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_glist_void_vary_write: -#endif + Bind(pt0, d0); GONext(); ENDP(pt1); ENDP(pt0); @@ -4686,12 +4447,7 @@ Yap_absmi(int inp) deref_body(d1, pt1, glist_void_valx_nonvar_unk, glist_void_valx_nonvar_nonvar); /* first argument bound, second unbound */ PREG = NEXTOP(PREG, xx); - BIND(pt1, d0, bind_glist_void_valx_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_glist_void_valx_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); ENDD(d1); @@ -4706,31 +4462,15 @@ Yap_absmi(int inp) glist_void_valx_var_nonvar: /* first unbound, second bound */ PREG = NEXTOP(PREG, xx); - BIND_GLOBAL(pt0, d1, bind_glist_void_valx_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_glist_void_valx_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); BEGP(pt1); deref_body(d1, pt1, glist_void_valx_var_unk, glist_void_valx_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, xx); - UnifyGlobalRegCells(pt0, pt1, uc9, uc10); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc9: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc10: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDD(d1); ENDP(pt0); @@ -4741,15 +4481,8 @@ Yap_absmi(int inp) BEGP(pt1); pt1 = H; d0 = AbsPair(pt1); - BIND(pt0, d0, bind_glist_void_valx_write); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) { - Yap_WakeUp(pt0); - pt1 = H; - } - bind_glist_void_valx_write: -#endif + Bind(pt0, d0); + pt1 = H; BEGD(d0); /* include XREG on it */ d0 = XREG(PREG->u.xx.xr); @@ -4798,12 +4531,7 @@ Yap_absmi(int inp) derefa_body(d1, pt1, glist_void_valy_nonvar_unk, glist_void_valy_nonvar_nonvar); /* first argument bound, second unbound */ PREG = NEXTOP(PREG, yx); - BIND(pt1, d0, bind_glist_void_valy_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_glist_void_valy_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -4819,30 +4547,14 @@ Yap_absmi(int inp) glist_void_valy_var_nonvar: /* first unbound, second bound */ PREG = NEXTOP(PREG, yx); - BIND_GLOBAL(pt0, d1, bind_glist_void_valy_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_glist_void_valy_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); deref_body(d1, pt1, glist_void_valy_var_unk, glist_void_valy_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, yx); - UnifyGlobalRegCells(pt0, pt1, uc11, uc12); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc11: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc12: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDD(d1); ENDP(pt0); @@ -4853,15 +4565,8 @@ Yap_absmi(int inp) CACHE_S(); S_SREG = H; d0 = AbsPair(S_SREG); - BIND(pt0, d0, bind_glist_void_valy_write); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) { - Yap_WakeUp(pt0); - S_SREG = H; - } - bind_glist_void_valy_write: -#endif + Bind(pt0, d0); + S_SREG = H; /* include XREG on it */ BEGD(d1); d1 = YREG[PREG->u.yx.y]; @@ -5147,12 +4852,7 @@ Yap_absmi(int inp) /* first argument bound, second unbound */ PREG = NEXTOP(PREG, ox); SREG++; - BIND(pt1, d0, bind_uvalx_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_uvalx_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -5166,12 +4866,7 @@ Yap_absmi(int inp) /* first unbound, second bound */ PREG = NEXTOP(PREG, ox); SREG++; - BIND_GLOBAL(pt0, d1, bind_uvalx_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_uvalx_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); BEGP(pt1); @@ -5179,19 +4874,8 @@ Yap_absmi(int inp) /* both arguments are unbound */ PREG = NEXTOP(PREG, ox); SREG++; - UnifyGlobalRegCells(pt0, pt1, uc13, uc14); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc13: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc14: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); ENDD(d1); @@ -5231,12 +4915,7 @@ Yap_absmi(int inp) deref_body(d1, pt1, ulvalx_nonvar_unk, ulvalx_nonvar_nonvar); /* first argument bound, second unbound */ PREG = NEXTOP(PREG, ox); - BIND(pt1, d0, bind_ulvalx_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_ulvalx_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -5249,31 +4928,15 @@ Yap_absmi(int inp) ulvalx_var_nonvar: /* first unbound, second bound */ PREG = NEXTOP(PREG, ox); - BIND_GLOBAL(pt0, d1, bind_ulvalx_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ulvalx_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); BEGP(pt1); deref_body(d1, pt1, ulvalx_var_unk, ulvalx_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, ox); - UnifyGlobalRegCells(pt0, pt1, uc15, uc16); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc15: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc16: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); ENDD(d1); @@ -5316,12 +4979,7 @@ Yap_absmi(int inp) /* first argument bound, second unbound */ PREG = NEXTOP(PREG, oy); SREG++; - BIND(pt1, d0, bind_uvaly_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_uvaly_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -5337,31 +4995,15 @@ Yap_absmi(int inp) /* first unbound, second bound */ PREG = NEXTOP(PREG, oy); SREG++; - BIND_GLOBAL(pt0, d1, bind_uvaly_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_uvaly_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); derefa_body(d1, pt1, uvaly_var_unk, uvaly_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, oy); SREG++; - UnifyGlobalRegCells(pt0, pt1, uc17, uc18); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc17: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc18: - DO_TRAIL(pt1, (CELL)pt1); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); ENDD(d1); @@ -5410,12 +5052,7 @@ Yap_absmi(int inp) derefa_body(d1, pt1, ulvaly_nonvar_unk, ulvaly_nonvar_nonvar); /* first argument bound, second unbound */ PREG = NEXTOP(PREG, oy); - BIND(pt1, d0, bind_ulvaly_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_ulvaly_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -5430,12 +5067,7 @@ Yap_absmi(int inp) ulvaly_var_nonvar: /* first unbound, second bound */ PREG = NEXTOP(PREG, oy); - BIND_GLOBAL(pt0, d1, bind_ulvaly_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ulvaly_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); /* Here we are in trouble: we have a clash between pt1 and @@ -5443,19 +5075,8 @@ Yap_absmi(int inp) derefa_body(d1, pt1, ulvaly_var_unk, ulvaly_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, oy); - UnifyGlobalRegCells(pt0, pt1, uc19, uc20); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc19: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc20: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); ENDD(d1); @@ -5505,12 +5126,7 @@ Yap_absmi(int inp) /* first argument bound, second unbound */ PREG = NEXTOP(PREG, ox); SREG++; - BIND(pt1, d0, bind_uvalx_loc_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_uvalx_loc_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -5525,12 +5141,7 @@ Yap_absmi(int inp) /* first unbound, second bound */ PREG = NEXTOP(PREG, ox); SREG++; - BIND_GLOBAL(pt0, d1, bind_uvalx_loc_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_uvalx_loc_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); /* Here we are in trouble: we have a clash between pt1 and @@ -5540,19 +5151,8 @@ Yap_absmi(int inp) /* both arguments are unbound */ PREG = NEXTOP(PREG, ox); SREG++; - UnifyGlobalRegCells(pt0, pt1, uc21, uc22); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc21: -#endif + UnifyCells(pt0, pt1); GONext(); -#ifdef COROUTINING - uc22: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); ENDD(d1); @@ -5618,12 +5218,7 @@ Yap_absmi(int inp) deref_body(d1, pt0, ulvalx_loc_nonvar_unk, ulvalx_loc_nonvar_nonvar); /* first argument bound, second unbound */ PREG = NEXTOP(PREG, ox); - BIND(pt0, d0, bind_ulvalx_loc_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ulvalx_loc_nonvar_var: -#endif + Bind(pt0, d0); GONext(); /* first argument may be unbound */ @@ -5635,31 +5230,15 @@ Yap_absmi(int inp) ulvalx_loc_var_nonvar: /* first unbound, second bound */ PREG = NEXTOP(PREG, ox); - BIND_GLOBAL(pt0, d1, bind_ulvalx_loc_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ulvalx_loc_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); BEGP(pt1); deref_body(d1, pt1, ulvalx_loc_var_unk, ulvalx_loc_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, ox); - UnifyGlobalRegCells(pt0, pt1, uc23, uc24); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc23: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc24: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); ENDD(d1); @@ -5723,12 +5302,7 @@ Yap_absmi(int inp) /* first argument bound, second unbound */ PREG = NEXTOP(PREG, oy); SREG++; - BIND(pt1, d0, bind_uvaly_loc_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_uvaly_loc_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -5744,12 +5318,7 @@ Yap_absmi(int inp) /* first unbound, second bound */ PREG = NEXTOP(PREG, oy); SREG++; - BIND_GLOBAL(pt0, d1, bind_uvaly_loc_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_uvaly_loc_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); /* Here we are in trouble: we have a clash between pt1 and @@ -5758,19 +5327,8 @@ Yap_absmi(int inp) /* both arguments are unbound */ PREG = NEXTOP(PREG, oy); SREG++; - UnifyGlobalRegCells(pt0, pt1, uc25, uc26); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc25: -#endif + UnifyCells(pt0, pt1); GONext(); -#ifdef COROUTINING - uc26: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); ENDD(d1); @@ -5837,12 +5395,7 @@ Yap_absmi(int inp) derefa_body(d1, pt1, ulvaly_loc_nonvar_unk, ulvaly_loc_nonvar_nonvar); /* first argument bound, second unbound */ PREG = NEXTOP(PREG, oy); - BIND(pt1, d0, bind_ulvaly_loc_nonvar_var); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_ulvaly_loc_nonvar_var: -#endif + Bind(pt1, d0); GONext(); ENDP(pt1); @@ -5857,12 +5410,7 @@ Yap_absmi(int inp) ulvaly_loc_var_nonvar: /* first unbound, second bound */ PREG = NEXTOP(PREG, oy); - BIND_GLOBAL(pt0, d1, bind_ulvaly_loc_var_nonvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ulvaly_loc_var_nonvar: -#endif + Bind_Global(pt0, d1); GONext(); /* Here we are in trouble: we have a clash between pt1 and @@ -5870,19 +5418,8 @@ Yap_absmi(int inp) derefa_body(d1, pt1, ulvaly_loc_var_unk, ulvaly_loc_var_nonvar); /* both arguments are unbound */ PREG = NEXTOP(PREG, oy); - UnifyGlobalRegCells(pt0, pt1, uc27, uc28); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc27: -#endif + UnifyGlobalCellToCell(pt0, pt1); GONext(); -#ifdef COROUTINING - uc28: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - GONext(); -#endif ENDP(pt1); ENDP(pt0); ENDD(d1); @@ -6007,12 +5544,7 @@ Yap_absmi(int inp) derefa_body(d0, pt0, uatom_unk, uatom_nonvar); d0 = PREG->u.oc.c; PREG = NEXTOP(PREG, oc); - BIND_GLOBAL(pt0, d0, bind_uatom); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_uatom: -#endif + Bind_Global(pt0, d0); GONext(); ENDP(pt0); ENDD(d0); @@ -6040,12 +5572,7 @@ Yap_absmi(int inp) derefa_body(d0, pt0, ulatom_unk, ulatom_nonvar); d0 = PREG->u.oc.c; PREG = NEXTOP(PREG, oc); - BIND_GLOBAL(pt0, d0, bind_ulatom); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ulatom: -#endif + Bind_Global(pt0, d0); GONext(); ENDP(pt0); ENDD(d0); @@ -6076,13 +5603,8 @@ Yap_absmi(int inp) continue; derefa_body(d0, pt0, uatom_n_var, uatom_n_nonvar); - BIND_GLOBAL(pt0, d1, bind_unlatom); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_unlatom: + Bind_Global(pt0, d1); continue; -#endif ENDP(pt0); ENDD(d0); } @@ -6146,12 +5668,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = AbsAppl(PREG->u.od.d); PREG = NEXTOP(PREG, od); - BIND_GLOBAL(pt0, d1, bind_ufloat); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ufloat: -#endif + Bind_Global(pt0, d1); GONext(); ENDD(d1); ENDP(pt0); @@ -6199,12 +5716,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = AbsAppl(PREG->u.od.d); PREG = NEXTOP(PREG, od); - BIND_GLOBAL(S_SREG, d1, bind_ulfloat); -#ifdef COROUTINING - DO_TRAIL(S_SREG, d1); - if (IsAttVar(S_SREG)) Yap_WakeUp(S_SREG); - bind_ulfloat: -#endif + Bind_Global(S_SREG, d1); GONext(); ENDD(d1); ENDCACHE_S(); @@ -6248,12 +5760,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = AbsAppl(PREG->u.oi.i); PREG = NEXTOP(PREG, oi); - BIND_GLOBAL(pt0, d1, bind_ulongint); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ulongint: -#endif + Bind_Global(pt0, d1); GONext(); ENDD(d1); ENDP(pt0); @@ -6296,12 +5803,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = AbsAppl(PREG->u.oi.i); PREG = NEXTOP(PREG, oi); - BIND_GLOBAL(S_SREG, d1, bind_ullongint); -#ifdef COROUTINING - DO_TRAIL(S_SREG, d1); - if (IsAttVar(S_SREG)) Yap_WakeUp(S_SREG); - bind_ullongint: -#endif + Bind_Global(S_SREG, d1); GONext(); ENDD(d1); ENDCACHE_S(); @@ -6345,12 +5847,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = PREG->u.oN.b; PREG = NEXTOP(PREG, oN); - BIND_GLOBAL(pt0, d1, bind_ubigint); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ubigint: -#endif + Bind_Global(pt0, d1); GONext(); ENDD(d1); ENDP(pt0); @@ -6390,12 +5887,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = PREG->u.oN.b; PREG = NEXTOP(PREG, oN); - BIND_GLOBAL(S_SREG, d1, bind_ulbigint); -#ifdef COROUTINING - DO_TRAIL(S_SREG, d1); - if (IsAttVar(S_SREG)) Yap_WakeUp(S_SREG); - bind_ulbigint: -#endif + Bind_Global(S_SREG, d1); GONext(); ENDD(d1); ENDCACHE_S(); @@ -6423,12 +5915,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = PREG->u.oD.D; PREG = NEXTOP(PREG, oD); - BIND_GLOBAL(pt0, d1, bind_udbterm); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_udbterm: -#endif + Bind_Global(pt0, d1); GONext(); ENDD(d1); ENDP(pt0); @@ -6453,12 +5940,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = PREG->u.oD.D; PREG = NEXTOP(PREG, oD); - BIND_GLOBAL(S_SREG, d1, bind_uldbterm); -#ifdef COROUTINING - DO_TRAIL(S_SREG, d1); - if (IsAttVar(S_SREG)) Yap_WakeUp(S_SREG); - bind_uldbterm: -#endif + Bind_Global(S_SREG, d1); GONext(); ENDD(d1); ENDCACHE_S(); @@ -6495,12 +5977,7 @@ Yap_absmi(int inp) d0 = AbsPair(S_SREG); WRITEBACK_S(S_SREG); ENDCACHE_S(); - BIND_GLOBAL(pt0, d0, bind_ulist_var); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ulist_var: -#endif + Bind_Global(pt0, d0); GONextW(); END_PREFETCH_W(); @@ -6555,12 +6032,7 @@ Yap_absmi(int inp) d0 = AbsPair(S_SREG); WRITEBACK_S(S_SREG); ENDCACHE_S(); - BIND_GLOBAL(pt0, d0, bind_ullist_var); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ullist_var: -#endif + Bind_Global(pt0, d0); GONextW(); END_PREFETCH_W(); @@ -6620,12 +6092,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = AbsAppl(H); /* we know the variable must be in the heap */ - BIND_GLOBAL(pt0, d1, bind_ustruct); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ustruct: -#endif + Bind_Global(pt0, d1); /* now, set pt0 to point to the heap where we are going to * build our term */ pt0 = H; @@ -6696,12 +6163,7 @@ Yap_absmi(int inp) BEGD(d1); d1 = AbsAppl(H); /* we know the variable must be in the heap */ - BIND_GLOBAL(pt0, d1, bind_ulstruct); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ulstruct: -#endif + Bind_Global(pt0, d1); /* now, set pt0 to point to the heap where we are going to * build our term */ pt0 = H; @@ -13431,12 +12893,7 @@ Yap_absmi(int inp) BEGP(pt0); deref_body(d1, pt0, func_nvar_unk, func_nvar_nvar); /* A2 is a variable, go and bind it */ - BIND(pt0, d0, bind_func_nvar_var); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_func_nvar_var: -#endif + Bind(pt0, d0); /* I have to this here so that I don't have a jump to a closing bracket */ d0 = arity; ENDP(pt0); @@ -13457,13 +12914,8 @@ Yap_absmi(int inp) deref_body(d1, pt0, func_nvar3_unk, func_nvar3_nvar); /* A3 is a variable, go and bind it */ PREG = NEXTOP(NEXTOP(NEXTOP(PREG, e),Osbmp),l); - BIND(pt0, d0, bind_func_nvar3_var); + Bind(pt0, d0); /* Done */ -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_func_nvar3_var: -#endif GONext(); @@ -13551,12 +13003,7 @@ Yap_absmi(int inp) /* else if arity is 0 just pass d0 through */ /* Ding, ding, we made it */ PREG = NEXTOP(NEXTOP(NEXTOP(PREG, e),Osbpp),l); - BIND(pt0, d0, bind_func_var_3nvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_func_var_3nvar: -#endif + Bind(pt0, d0); GONext(); diff --git a/C/attvar.c b/C/attvar.c index 8a24bc8b5..77d87668b 100644 --- a/C/attvar.c +++ b/C/attvar.c @@ -73,8 +73,8 @@ BuildNewAttVar( USES_REGS1 ) attvar_record *newv; /* add a new attributed variable */ - if (!(newv = (attvar_record *)Yap_GetFromArena(&GlobalArena, sizeof(attvar_record)/sizeof(CELL),2))) - return NULL; + newv = (attvar_record *)H; + H = (CELL *)(newv+1); newv->AttFunc = FunctorAttVar; RESET_VARIABLE(&(newv->Value)); RESET_VARIABLE(&(newv->Done)); @@ -90,13 +90,14 @@ CopyAttVar(CELL *orig, struct cp_frame **to_visit_ptr, CELL *res USES_REGS) struct cp_frame *to_visit = *to_visit_ptr; CELL *vt; + if (!(newv = BuildNewAttVar( PASS_REGS1 ))) return FALSE; vt = &(attv->Atts); to_visit->start_cp = vt-1; to_visit->end_cp = vt; if (IsVarTerm(attv->Atts)) { - Bind(&newv->Atts, (CELL)H); + Bind_Global_NonAtt(&newv->Atts, (CELL)H); to_visit->to = H; H++; } else { @@ -123,7 +124,7 @@ TermToAttVar(Term attvar, Term to USES_REGS) attvar_record *attv = BuildNewAttVar( PASS_REGS1 ); if (!attv) return FALSE; - Bind(&attv->Atts, attvar); + Bind_Global_NonAtt(&attv->Atts, attvar); *VarOfTerm(to) = AbsAttVar(attv); return TRUE; } @@ -155,12 +156,12 @@ WakeAttVar(CELL* pt1, CELL reg2 USES_REGS) AddFailToQueue( PASS_REGS1 ); } } - Bind_Global(&(susp2->Value), (CELL)pt1); + Bind_Global_NonAtt(&(susp2->Value), (CELL)pt1); AddToQueue(susp2 PASS_REGS); return; } } else { - Bind(VarOfTerm(reg2), (CELL)pt1); + Bind_NonAtt(VarOfTerm(reg2), (CELL)pt1); return; } } @@ -179,7 +180,7 @@ WakeAttVar(CELL* pt1, CELL reg2 USES_REGS) reg2 = AbsAppl(H); } *bind_ptr = reg2; - Bind_Global(&(attv->Value), reg2); + Bind_Global_NonAtt(&(attv->Value), reg2); } void @@ -187,7 +188,10 @@ Yap_WakeUp(CELL *pt0) { CACHE_REGS CELL d0 = *pt0; RESET_VARIABLE(pt0); - TR--; + /* did we trail */ + if (pt0 < HB) { + TR--; + } WakeAttVar(pt0, d0 PASS_REGS); } @@ -258,14 +262,16 @@ AddNewModule(attvar_record *attv, Term t, int new, int do_it USES_REGS) } if (!do_it) return; - if (IsVarTerm(attv->Atts)) { - Bind(&(attv->Atts),t); + if (new) { + attv->Atts = t; + } else if (IsVarTerm(attv->Atts)) { + MaBind(&(attv->Atts),t); } else { Term *wherep = &attv->Atts; do { if (IsVarTerm(*wherep)) { - Bind_Global(wherep,t); + Bind_Global_NonAtt(wherep,t); return; } else { wherep = RepAppl(Deref(*wherep))+1; @@ -365,7 +371,7 @@ PutAtt(Int pos, Term atts, Term att USES_REGS) if (IsVarTerm(att) && (CELL *)att > H && (CELL *)att < LCL0) { /* globalise locals */ Term tnew = MkVarTerm(); - Bind((CELL *)att, tnew); + Bind_NonAtt((CELL *)att, tnew); att = tnew; } MaBind(RepAppl(atts)+pos, att); @@ -376,23 +382,23 @@ BindAttVar(attvar_record *attv USES_REGS) { if (IsVarTerm(attv->Done) && IsUnboundVar(&attv->Done)) { /* make sure we are not trying to bind a variable against itself */ if (!IsVarTerm(attv->Value)) { - Bind_Global(&(attv->Done), attv->Value); + Bind_Global_NonAtt(&(attv->Done), attv->Value); } else if (IsVarTerm(attv->Value)) { Term t = Deref(attv->Value); if (IsVarTerm(t)) { if (IsAttachedTerm(t)) { attvar_record *attv2 = RepAttVar(VarOfTerm(t)); if (attv2 < attv) { - Bind_Global(&(attv->Done), t); + Bind_Global_NonAtt(&(attv->Done), t); } else { - Bind_Global(&(attv2->Done), AbsAttVar(attv)); + Bind_Global_NonAtt(&(attv2->Done), AbsAttVar(attv)); } } else { Yap_Error(SYSTEM_ERROR,(CELL)&(attv->Done),"attvar was bound when unset"); return(FALSE); } } else { - Bind_Global(&(attv->Done), t); + Bind_Global_NonAtt(&(attv->Done), t); } } return(TRUE); @@ -448,7 +454,7 @@ p_put_att( USES_REGS1 ) { return FALSE; } } - Yap_unify(ARG1, AbsAttVar(attv)); + Bind_NonAtt(VarOfTerm(Deref(ARG1)), AbsAttVar(attv)); AddNewModule(attv, tatts, new, TRUE PASS_REGS); } PutAtt(IntegerOfTerm(Deref(ARG4)), tatts, Deref(ARG5) PASS_REGS); @@ -466,10 +472,10 @@ p_put_att_term( USES_REGS1 ) { /* if this is unbound, ok */ if (IsVarTerm(inp)) { attvar_record *attv; - int new = FALSE; if (IsAttachedTerm(inp)) { attv = RepAttVar(VarOfTerm(inp)); + MaBind(&(attv->Atts), Deref(ARG2)); } else { while (!(attv = BuildNewAttVar( PASS_REGS1 ))) { Yap_Error_Size = sizeof(attvar_record); @@ -479,13 +485,8 @@ p_put_att_term( USES_REGS1 ) { } inp = Deref(ARG1); } - new = TRUE; - } - if (new) { - Bind(VarOfTerm(inp), AbsAttVar(attv)); - Bind(&attv->Atts, Deref(ARG2)); - } else { - MaBind(&(attv->Atts), Deref(ARG2)); + Bind_NonAtt(VarOfTerm(inp), AbsAttVar(attv)); + attv->Atts = Deref(ARG2); } return TRUE; } else { @@ -1012,9 +1013,9 @@ p_fast_unify( USES_REGS1 ) a = VarOfTerm(t1); b = VarOfTerm(t2); if(a > b) { - Bind_Global(a,t2); + Bind_Global_NonAtt(a,t2); } else if((a) < (b)){ - Bind_Global(b,t1); + Bind_Global_NonAtt(b,t1); } return TRUE; } diff --git a/C/cdmgr.c b/C/cdmgr.c index 29b217624..8519d02e3 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -4024,12 +4024,7 @@ p_is_profiled( USES_REGS1 ) if (PROFILING) ta = MkAtomTerm(AtomOn); else ta = MkAtomTerm(AtomOff); - BIND((CELL *)t,ta,bind_is_profiled); -#ifdef COROUTINING - DO_TRAIL(VarOfTerm(t), ta); - if (IsAttVar(VarOfTerm(t))) Yap_WakeUp((CELL *)t); - bind_is_profiled: -#endif + Bind((CELL *)t,ta); return(TRUE); } else if (!IsAtomTerm(t)) return(FALSE); s = RepAtom(AtomOfTerm(t))->StrOfAE; @@ -4127,12 +4122,7 @@ p_is_call_counted( USES_REGS1 ) if (CALL_COUNTING) ta = MkAtomTerm(AtomOn); else ta = MkAtomTerm(AtomOff); - BIND((CELL *)t,ta,bind_is_call_counted); -#ifdef COROUTINING - DO_TRAIL(VarOfTerm(t), ta); - if (IsAttVar(VarOfTerm(t))) Yap_WakeUp((CELL *)t); - bind_is_call_counted: -#endif + Bind((CELL *)t,ta); return(TRUE); } else if (!IsAtomTerm(t)) return(FALSE); s = RepAtom(AtomOfTerm(t))->StrOfAE; diff --git a/C/exec.c b/C/exec.c index 725cc39c0..b15e2b4ea 100644 --- a/C/exec.c +++ b/C/exec.c @@ -126,12 +126,7 @@ p_save_cp( USES_REGS1 ) #endif if (!IsVarTerm(t)) return(FALSE); td = cp_as_integer(B PASS_REGS); - BIND((CELL *)t,td,bind_save_cp); -#ifdef COROUTINING - DO_TRAIL(VarOfTerm(t), td); - if (IsAttVar(VarOfTerm(t))) Yap_WakeUp((CELL *)t); - bind_save_cp: -#endif + Bind((CELL *)t,td); return(TRUE); } @@ -145,12 +140,7 @@ p_save_env_b( USES_REGS1 ) #endif if (!IsVarTerm(t)) return(FALSE); td = cp_as_integer((choiceptr)YENV[E_CB] PASS_REGS); - BIND((CELL *)t,td,bind_save_cp); -#ifdef COROUTINING - DO_TRAIL(VarOfTerm(t), td); - if (IsAttVar(VarOfTerm(t))) Yap_WakeUp((CELL *)t); - bind_save_cp: -#endif + Bind((CELL *)t,td); return(TRUE); } @@ -1468,8 +1458,13 @@ static int is_cleanup_cp(choiceptr cp_b) static Int JumpToEnv(Term t USES_REGS) { +#ifndef YAPOR + yamop *pos = NEXTOP(PredDollarCatch->cs.p_code.TrueCodeOfPred,l), + *catchpos = NEXTOP(PredHandleThrow->cs.p_code.TrueCodeOfPred,l); +#else yamop *pos = NEXTOP(PredDollarCatch->cs.p_code.TrueCodeOfPred,Otapl), *catchpos = NEXTOP(PredHandleThrow->cs.p_code.TrueCodeOfPred,Otapl); +#endif CELL *env, *env1; choiceptr handler, previous = NULL; @@ -1559,7 +1554,8 @@ JumpToEnv(Term t USES_REGS) { } handler->cp_cp = (yamop *)env[E_CP]; handler->cp_env = (CELL *)env[E_E]; - handler->cp_ap = NEXTOP(PredHandleThrow->CodeOfPred,Otapl); + handler->cp_ap = catchpos; + /* can recover Heap thanks to copy term :-( */ /* B->cp_h = H; */ /* I could backtrack here, but it is easier to leave the unwinding diff --git a/C/globals.c b/C/globals.c index 5ddc27f36..faac0510a 100644 --- a/C/globals.c +++ b/C/globals.c @@ -291,9 +291,6 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop CELL *HB0 = HB; tr_fr_ptr TR0 = TR; int ground = TRUE; -#ifdef COROUTINING - CELL *dvarsmin = NULL, *dvarsmax=NULL; -#endif HB = HLow; to_visit0 = to_visit; @@ -470,34 +467,25 @@ copy_complex_term(register CELL *pt0, register CELL *pt0_end, int share, int cop *ptf++ = (CELL) ptd0; } else { #if COROUTINING - if (copy_att_vars && IsAttachedTerm((CELL)ptd0)) { + if (copy_att_vars && FastIsAttachedTerm((CELL)ptd0)) { /* if unbound, call the standard copy term routine */ struct cp_frame *bp; + CELL new; - if (IN_BETWEEN(dvarsmin, ptd0, dvarsmax)) { - *ptf++ = (CELL) ptd0; - } else { - CELL new; - - bp = to_visit; - if (!attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { - goto overflow; - } - to_visit = bp; - new = *ptf; - if (TR > (tr_fr_ptr)Yap_TrailTop - 256) { - /* Trail overflow */ - if (!Yap_growtrail((TR-TR0)*sizeof(tr_fr_ptr *), TRUE)) { - goto trail_overflow; - } - } - Bind_and_Trail(ptd0, new); - if (dvarsmin == NULL) { - dvarsmin = CellPtr(new); - } - dvarsmax = CellPtr(new)+1; - ptf++; + bp = to_visit; + if (!attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { + goto overflow; } + to_visit = bp; + new = *ptf; + if (TR > (tr_fr_ptr)Yap_TrailTop - 256) { + /* Trail overflow */ + if (!Yap_growtrail((TR-TR0)*sizeof(tr_fr_ptr *), TRUE)) { + goto trail_overflow; + } + } + Bind_and_Trail(ptd0, new); + ptf++; } else { #endif /* first time we met this term */ @@ -602,7 +590,7 @@ CopyTermToArena(Term t, Term arena, int share, int copy_att_vars, UInt arity, Te ASP = ArenaLimit(arena); H = HB = ArenaPt(arena); #if COROUTINING - if (IsAttachedTerm(t)) { + if (FastIsAttachedTerm(t)) { CELL *Hi; *H = t; @@ -1106,7 +1094,7 @@ p_b_setval( USES_REGS1 ) { /* but first make sure we are doing on a global object, or a constant! */ Term t = Deref(ARG2); - if (IsVarTerm(t) && VarOfTerm(t) > H && VarOfTerm(t) < ASP) { + if (IsVarTerm(t) && VarOfTerm(t) > H && VarOfTerm(t) < LCL0) { Term tn = MkVarTerm(); Bind_Local(VarOfTerm(t), tn); t = tn; diff --git a/C/heapgc.c b/C/heapgc.c index ec742644c..c0879f882 100755 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -24,7 +24,7 @@ static char SccsId[] = "%W% %G%"; #include "attvar.h" #if !defined(TABLING) -#define EASY_SHUNTING 1 +//#define EASY_SHUNTING 1 #endif /* !TABLING */ #define HYBRID_SCHEME 1 @@ -1172,7 +1172,7 @@ mark_variable(CELL_PTR current USES_REGS) next = GET_NEXT(ccur); if (IsVarTerm(ccur)) { - if (IN_BETWEEN(Yap_GlobalBase,current,H) && IsAttVar(current) && current==next) { + if (IN_BETWEEN(Yap_GlobalBase,current,H) && FastIsAttVar(current) && current==next) { if (next < H0) POP_CONTINUATION(); if (!UNMARKED_MARK(next-1,local_bp)) { total_marked++; @@ -1656,7 +1656,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. The ideal solution would be to unbind all variables. The current solution is to remark it as an attributed variable */ - if (IN_BETWEEN(Yap_GlobalBase,hp,H) && IsAttVar(hp) && !UNMARKED_MARK(hp-1,Yap_bp)) { + if (IN_BETWEEN(Yap_GlobalBase,hp,H) && FastIsAttVar(hp) && !UNMARKED_MARK(hp-1,Yap_bp)) { total_marked++; PUSH_POINTER(hp-1 PASS_REGS); if (hp-1 < HGEN) { @@ -1697,7 +1697,7 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B /* can safely ignore this */ CELL *cptr = RepPair(trail_cell); if (IN_BETWEEN(Yap_GlobalBase,cptr,H) && - IsAttVar(cptr)) { + FastIsAttVar(cptr)) { TrailTerm(trail_base) = (CELL)cptr; mark_external_reference(&TrailTerm(trail_base) PASS_REGS); TrailTerm(trail_base) = trail_cell; @@ -2486,7 +2486,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR USES_REGS) CELL *pt0 = RepPair(trail_cell); CELL flags; - if (IN_BETWEEN(Yap_GlobalBase, pt0, H) && IsAttVar(pt0)) { + if (IN_BETWEEN(Yap_GlobalBase, pt0, H) && FastIsAttVar(pt0)) { TrailTerm(dest) = trail_cell; /* be careful with partial gc */ if (HEAP_PTR(TrailTerm(dest))) { diff --git a/C/inlines.c b/C/inlines.c index 37c1c99c7..7bc8cc7bf 100755 --- a/C/inlines.c +++ b/C/inlines.c @@ -638,12 +638,7 @@ p_functor( USES_REGS1 ) /* functor(?,?,?) */ BEGP(pt0); deref_body(d1, pt0, func_nvar_unk, func_nvar_nvar); /* A2 is a variable, go and bind it */ - BIND(pt0, d0, bind_func_nvar_var); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_func_nvar_var: -#endif + Bind(pt0, d0); /* have to buffer ENDP and label */ d0 = arity; ENDP(pt0); @@ -664,13 +659,7 @@ p_functor( USES_REGS1 ) /* functor(?,?,?) */ BEGP(pt0); deref_body(d1, pt0, func_nvar3_unk, func_nvar3_nvar); /* A3 is a variable, go and bind it */ - BIND(pt0, d0, bind_func_nvar3_var); - /* Done */ -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_func_nvar3_var: -#endif + Bind(pt0, d0); return(TRUE); ENDP(pt0); @@ -748,12 +737,7 @@ p_functor( USES_REGS1 ) /* functor(?,?,?) */ } /* else if arity is 0 just pass d0 through */ /* Ding, ding, we made it */ - BIND(pt0, d0, bind_func_var_3nvar); -#ifdef COROUTINING - DO_TRAIL(pt0, d0); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_func_var_3nvar: -#endif + Bind(pt0, d0); return(TRUE); diff --git a/C/unify.c b/C/unify.c index e0c1b3b25..0ab3c8e9f 100644 --- a/C/unify.c +++ b/C/unify.c @@ -259,12 +259,7 @@ loop: derefa_body(d1, ptd1, unify_comp_nvar_unk, unify_comp_nvar_nvar); /* d1 and pt2 have the unbound value, whereas d0 is bound */ - BIND_GLOBAL(ptd1, d0, bind_ocunify1); -#ifdef COROUTINING - DO_TRAIL(ptd1, d0); - if (IsAttVar(ptd1)) Yap_WakeUp(ptd1); - bind_ocunify1: -#endif + Bind_Global(ptd1, d0); if (Yap_rational_tree_loop(ptd1-1, ptd1, (CELL **)to_visit, (CELL **)unif)) goto cufail; continue; @@ -282,12 +277,7 @@ loop: deref_head(d1, unify_comp_var_unk); unify_comp_var_nvar: /* pt2 is unbound and d1 is bound */ - BIND_GLOBAL(ptd0, d1, bind_ocunify2); -#ifdef COROUTINING - DO_TRAIL(ptd0, d1); - if (IsAttVar(ptd0)) Yap_WakeUp(ptd0); - bind_ocunify2: -#endif + Bind_Global(ptd0, d1); if (Yap_rational_tree_loop(ptd0-1, ptd0, (CELL **)to_visit, (CELL **)unif)) goto cufail; continue; @@ -403,12 +393,7 @@ oc_unify_nvar_nvar: deref_body(d1, pt1, oc_unify_nvar_unk, oc_unify_nvar_nvar); /* d0 is bound and d1 is unbound */ - BIND(pt1, d0, bind_ocunify4); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_ocunify4: -#endif + Bind(pt1, d0); /* local variables cannot be in a term */ if (pt1 > H && pt1 < LCL0) return TRUE; @@ -421,12 +406,7 @@ oc_unify_nvar_nvar: deref_head(d1, oc_unify_var_unk); oc_unify_var_nvar: /* pt0 is unbound and d1 is bound */ - BIND(pt0, d1, bind_ocunify5); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_ocunify5: -#endif + Bind(pt0, d1); /* local variables cannot be in a term */ if (pt0 > H && pt0 < LCL0) return TRUE; @@ -436,20 +416,8 @@ oc_unify_var_nvar: deref_body(d1, pt1, oc_unify_var_unk, oc_unify_var_nvar); /* d0 and pt1 are unbound */ - UnifyCells(pt0, pt1, uc1, uc2); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc1: -#endif + UnifyCells(pt0, pt1); return (TRUE); -#ifdef COROUTINING - uc2: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) { - Yap_WakeUp(pt1); - } -#endif return (TRUE); } @@ -551,12 +519,7 @@ unify_nvar_nvar: deref_body(d1, pt1, unify_nvar_unk, unify_nvar_nvar); /* d0 is bound and d1 is unbound */ - BIND(pt1, d0, bind_unify3); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - if (IsAttVar(pt1)) Yap_WakeUp(pt1); - bind_unify3: -#endif + Bind(pt1, d0); return (TRUE); deref_body(d0, pt0, unify_unk, unify_nvar); @@ -564,12 +527,7 @@ unify_nvar_nvar: deref_head(d1, unify_var_unk); unify_var_nvar: /* pt0 is unbound and d1 is bound */ - BIND(pt0, d1, bind_unify4); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - bind_unify4: -#endif + Bind(pt0, d1); return TRUE; #if TRAILING_REQUIRES_BRANCH @@ -580,21 +538,9 @@ unify_var_nvar_trail: deref_body(d1, pt1, unify_var_unk, unify_var_nvar); /* d0 and pt1 are unbound */ - UnifyCells(pt0, pt1, uc1, uc2); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - if (IsAttVar(pt0)) Yap_WakeUp(pt0); - uc1: -#endif + UnifyCells(pt0, pt1); return (TRUE); -#ifdef COROUTINING - uc2: - DO_TRAIL(pt1, (CELL)pt0); - if (IsAttVar(pt1)) { - Yap_WakeUp(pt1); - } - return (TRUE); -#endif + #if THREADS #undef Yap_REGS #define Yap_REGS (*Yap_regp) @@ -661,9 +607,9 @@ InitReverseLookupOpcode(void) #define UnifiableGlobalCells(a, b) \ if((a) > (b)) { \ - BIND_GLOBALCELL_NONATT((a),(CELL)(b)); \ + Bind_Global_NonAtt((a),(CELL)(b)); \ } else if((a) < (b)){ \ - BIND_GLOBALCELL_NONATT((b),(CELL) (a)); \ + Bind_Global_NonAtt((b),(CELL) (a)); \ } static int @@ -790,11 +736,7 @@ loop: derefa_body(d1, ptd1, unifiable_comp_nvar_unk, unifiable_comp_nvar_nvar); /* d1 and pt2 have the unbound value, whereas d0 is bound */ - BIND(ptd1, d0, bind_unifiable3); -#ifdef COROUTINING - DO_TRAIL(ptd1, d0); - bind_unifiable3: -#endif + Bind(ptd1, d0); continue; } @@ -810,11 +752,7 @@ loop: deref_head(d1, unifiable_comp_var_unk); unifiable_comp_var_nvar: /* pt2 is unbound and d1 is bound */ - BIND(ptd0, d1, bind_unifiable4); -#ifdef COROUTINING - DO_TRAIL(ptd0, d1); - bind_unifiable4: -#endif + Bind(ptd0, d1); continue; derefa_body(d1, ptd1, unifiable_comp_var_unk, unifiable_comp_var_nvar); @@ -941,11 +879,7 @@ unifiable_nvar_nvar: deref_body(d1, pt1, unifiable_nvar_unk, unifiable_nvar_nvar); /* d0 is bound and d1 is unbound */ - BIND(pt1, d0, bind_unifiable3); -#ifdef COROUTINING - DO_TRAIL(pt1, d0); - bind_unifiable3: -#endif + Bind(pt1, d0); return (TRUE); deref_body(d0, pt0, unifiable_unk, unifiable_nvar); @@ -953,11 +887,7 @@ unifiable_nvar_nvar: deref_head(d1, unifiable_var_unk); unifiable_var_nvar: /* pt0 is unbound and d1 is bound */ - BIND(pt0, d1, bind_unifiable4); -#ifdef COROUTINING - DO_TRAIL(pt0, d1); - bind_unifiable4: -#endif + Bind(pt0, d1); return TRUE; #if TRAILING_REQUIRES_BRANCH @@ -968,17 +898,8 @@ unifiable_var_nvar_trail: deref_body(d1, pt1, unifiable_var_unk, unifiable_var_nvar); /* d0 and pt1 are unbound */ - UnifyCells(pt0, pt1, uc1, uc2); -#ifdef COROUTINING - DO_TRAIL(pt0, (CELL)pt1); - uc1: -#endif + UnifyCells(pt0, pt1); return (TRUE); -#ifdef COROUTINING - uc2: - DO_TRAIL(pt1, (CELL)pt0); - return (TRUE); -#endif #if THREADS #undef Yap_REGS #define Yap_REGS (*Yap_regp) diff --git a/C/utilpreds.c b/C/utilpreds.c index 61cf65b8c..4bd55ad9e 100644 --- a/C/utilpreds.c +++ b/C/utilpreds.c @@ -79,9 +79,6 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf, CELL *HB0 = HB; tr_fr_ptr TR0 = TR; int ground = TRUE; -#ifdef COROUTINING - CELL *dvarsmin = NULL, *dvarsmax=NULL; -#endif HB = HLow; to_visit0 = to_visit; @@ -238,32 +235,22 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf, if (ptd0 >= HLow && ptd0 < H) { /* we have already found this cell */ *ptf++ = (CELL) ptd0; - } else { + } else #if COROUTINING if (newattvs && IsAttachedTerm((CELL)ptd0)) { /* if unbound, call the standard copy term routine */ struct cp_frame *bp; + + CELL new; - if (IN_BETWEEN(dvarsmin, ptd0, dvarsmax)) { - *ptf++ = (CELL) ptd0; - } else { - CELL new; - - bp = to_visit; - if (!attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { - goto overflow; - } - to_visit = bp; - new = *ptf; - Bind(ptd0, new); - if (dvarsmin == NULL) { - dvarsmin = CellPtr(new); - } else { - *dvarsmax = (CELL)(CellPtr(new)+1); - } - dvarsmax = CellPtr(new)+1; - ptf++; + bp = to_visit; + if (!attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { + goto overflow; } + to_visit = bp; + new = *ptf; + Bind_NonAtt(ptd0, new); + ptf++; } else { #endif /* first time we met this term */ @@ -274,12 +261,11 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf, goto trail_overflow; } } - Bind(ptd0, (CELL)ptf); + Bind_NonAtt(ptd0, (CELL)ptf); ptf++; #ifdef COROUTINING - } -#endif } +#endif } /* Do we still have compound terms to visit */ if (to_visit > to_visit0) { @@ -307,7 +293,6 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf, /* restore our nice, friendly, term to its original state */ clean_dirty_tr(TR0 PASS_REGS); - close_attvar_chain(dvarsmin, dvarsmax); HB = HB0; return ground; @@ -328,7 +313,6 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf, #endif reset_trail(TR0); /* follow chain of multi-assigned variables */ - reset_attvars(dvarsmin, dvarsmax); return -1; trail_overflow: @@ -349,7 +333,6 @@ trail_overflow: { tr_fr_ptr oTR = TR; reset_trail(TR0); - reset_attvars(dvarsmin, dvarsmax); if (!Yap_growtrail((oTR-TR0)*sizeof(tr_fr_ptr *), TRUE)) { return -4; } @@ -372,7 +355,6 @@ trail_overflow: } #endif reset_trail(TR0); - reset_attvars(dvarsmin, dvarsmax); Yap_Error_Size = (ADDR)AuxSp-(ADDR)to_visit0; return -3; } @@ -1265,9 +1247,6 @@ export_complex_term(Term tf, CELL *pt0, CELL *pt0_end, char * buf, size_t len0, CELL *HB0 = HB; tr_fr_ptr TR0 = TR; int ground = TRUE; -#ifdef COROUTINING - CELL *dvarsmin = NULL, *dvarsmax=NULL; -#endif char *bptr = buf+ 3*sizeof(CELL); size_t len = len0; @@ -1418,26 +1397,16 @@ export_complex_term(Term tf, CELL *pt0, CELL *pt0_end, char * buf, size_t len0, /* if unbound, call the standard export term routine */ struct cp_frame *bp; - if (IN_BETWEEN(dvarsmin, ptd0, dvarsmax)) { - *ptf++ = (CELL) ptd0; - } else { - CELL new; + CELL new; - bp = to_visit; - if (!attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { - goto overflow; - } - to_visit = bp; - new = *ptf; - Bind(ptd0, new); - if (dvarsmin == NULL) { - dvarsmin = CellPtr(new); - } else { - *dvarsmax = (CELL)(CellPtr(new)+1); - } - dvarsmax = CellPtr(new)+1; - ptf++; + bp = to_visit; + if (!attas[ExtFromCell(ptd0)].copy_term_op(ptd0, &bp, ptf PASS_REGS)) { + goto overflow; } + to_visit = bp; + new = *ptf; + Bind_NonAtt(ptd0, new); + ptf++; } else { #endif /* first time we met this term */ @@ -1448,7 +1417,7 @@ export_complex_term(Term tf, CELL *pt0, CELL *pt0_end, char * buf, size_t len0, goto trail_overflow; } } - Bind(ptd0, (CELL)ptf); + Bind_NonAtt(ptd0, (CELL)ptf); ptf++; #ifdef COROUTINING } @@ -1470,7 +1439,6 @@ export_complex_term(Term tf, CELL *pt0, CELL *pt0_end, char * buf, size_t len0, /* restore our nice, friendly, term to its original state */ clean_dirty_tr(TR0 PASS_REGS); - close_attvar_chain(dvarsmin, dvarsmax); HB = HB0; return export_term_to_buffer(tf, buf, bptr, HLow, H, len0); @@ -1491,7 +1459,6 @@ export_complex_term(Term tf, CELL *pt0, CELL *pt0_end, char * buf, size_t len0, #endif reset_trail(TR0); /* follow chain of multi-assigned variables */ - reset_attvars(dvarsmin, dvarsmax); return -1; trail_overflow: @@ -1512,7 +1479,6 @@ trail_overflow: { tr_fr_ptr oTR = TR; reset_trail(TR0); - reset_attvars(dvarsmin, dvarsmax); if (!Yap_growtrail((oTR-TR0)*sizeof(tr_fr_ptr *), TRUE)) { return -4; } @@ -1535,7 +1501,6 @@ trail_overflow: } #endif reset_trail(TR0); - reset_attvars(dvarsmin, dvarsmax); Yap_Error_Size = (ADDR)AuxSp-(ADDR)to_visit0; return -3; } diff --git a/H/TermExt.h b/H/TermExt.h index 1b058db69..863e02958 100644 --- a/H/TermExt.h +++ b/H/TermExt.h @@ -67,6 +67,13 @@ IsAttVar (CELL *pt) return (pt)[-1] == (CELL)attvar_e && pt < H; } +inline EXTERN int +FastIsAttVar (CELL *pt) +{ + CACHE_REGS + return (pt)[-1] == (CELL)attvar_e; +} + typedef enum { BIG_INT = 0x01, @@ -507,6 +514,14 @@ IsAttachedTerm (Term t) return (Int) ((IsVarTerm (t) && IsAttVar(VarOfTerm(t)))); } +inline EXTERN Int IsAttachedTerm (Term); + +inline EXTERN Int +FastIsAttachedTerm (Term t) +{ + return (Int) ((IsVarTerm (t) && FastIsAttVar(VarOfTerm(t)))); +} + diff --git a/H/absmi.h b/H/absmi.h index 658604dc8..131f13180 100644 --- a/H/absmi.h +++ b/H/absmi.h @@ -972,57 +972,39 @@ Macros to check the limits of stacks * * **********************************************************************/ -#ifdef COROUTINING -#define UnifyCells(a, b, l1, l2) \ - if((a) > (b)) { \ - if ((a)<=H) { BIND_GLOBAL((a),(CELL)(b),l1); } \ - else if ((b)<= H) { Bind_Local((a),(CELL)(b)); goto l1;} \ - else { Bind_Local((b),(CELL) (a)); goto l1;} \ - } else if((a) < (b)){ \ - if((b) <= H) { BIND_GLOBAL2((b),(CELL) (a),l2,l1); } \ - else if ((a) <= H) { Bind_Local((b),(CELL) (a)); goto l1;} \ - else { Bind_Local((a),(CELL) (b)); goto l1;} \ - } else goto l1; - -/* I know (a) <= H */ -#define UnifyGlobalRegCells(a, b, l1, l2) \ - if((a) > (b)) { \ - BIND_GLOBAL((a),(CELL)(b),l1); \ - } else if((a) < (b)){ \ - if((b) <= H) { BIND_GLOBAL2((b),(CELL) (a),l2,l1); } \ - Bind_Local((b),(CELL) (a)); \ - goto l1; \ - } else goto l1; - -#else -#define UnifyCells(a, b, l1, l2) \ - if((a) > (b)) { \ - if ((a)<=H) { BIND_GLOBAL((a),(CELL)(b),l1); } \ - else if ((b)<= H) { Bind_Local((a),(CELL)(b)); } \ - else { Bind_Local((b),(CELL) (a)); } \ - } else if((a) < (b)){ \ - if((b) <= H) { BIND_GLOBAL2((b),(CELL) (a),l2,l1); } \ - else if ((a) <= H) { Bind_Local((b),(CELL) (a)); } \ - else { Bind_Local((a),(CELL) (b)); } \ - } - -/* I know (a) <= H */ -#define UnifyGlobalRegCells(a, b, l1, l2) \ - if((a) > (b)) { \ - BIND_GLOBAL((a),(CELL)(b),l1); \ - } else if((a) < (b)){ \ - if((b) <= H) { BIND_GLOBAL2((b),(CELL) (a),l2,l1); } \ - Bind_Local((b),(CELL) (a)); \ - } - -#endif - #define UnifyGlobalCells(a, b) \ - if((a) > (b)) { \ - BIND_GLOBALCELL((a),(CELL)(b)); \ - } else if((a) < (b)){ \ - BIND_GLOBALCELL((b),(CELL) (a)); \ - } + if ((b) > (a)) { \ + if (FastIsAttVar(b) && !FastIsAttVar(a)) { \ + Bind_Global((a),(CELL)(b)); \ + } else { \ + Bind_Global((b),(CELL)(a)); \ + } \ + } else if ((b) < (a)) { \ + if (FastIsAttVar(a) && !FastIsAttVar(b)) { \ + Bind_Global((b),(CELL)(a)); \ + } else { \ + Bind_Global((a),(CELL)(b)); \ + } \ + } + +#define UnifyGlobalCellToCell(b, a) \ +if ((a) < H) { /* two globals */ \ + UnifyGlobalCells(a,b); \ +} else { \ + Bind_Local((a),(CELL)(b)); \ +} + +#define UnifyCells(a, b) \ +if ((a) < H) { /* at least one global */ \ + if ((b) > H) { Bind_Local((b),(CELL)(a)); } \ + else { UnifyGlobalCells(a,b); } \ +} else { \ + if ((b) > (a)) { Bind_Local((a),(CELL)(b)); } \ + else if ((a) > (b)) { \ + if ((b) < H) { Bind_Local((a),(CELL)(b)); } \ + else { Bind_Local((b),(CELL)(a)); } \ + } \ +} /* unify two complex terms. * @@ -1236,7 +1218,8 @@ loop: derefa_body(d1, ptd1, unify_comp_nvar_unk, unify_comp_nvar_nvar); /* d1 and pt2 have the unbound value, whereas d0 is bound */ - BIND_GLOBALCELL(ptd1, d0); + Bind_Global(ptd1, d0); + continue; } derefa_body(d0, ptd0, unify_comp_unk, unify_comp_nvar); @@ -1251,7 +1234,8 @@ loop: deref_head(d1, unify_comp_var_unk); unify_comp_var_nvar: /* pt2 is unbound and d1 is bound */ - BIND_GLOBALCELL(ptd0, d1); + Bind_Global(ptd0, d1); + continue; derefa_body(d1, ptd1, unify_comp_var_unk, unify_comp_var_nvar); /* ptd0 and ptd1 are unbound */ @@ -1585,10 +1569,14 @@ prune(choiceptr cp) } } +#define SET_ASP(Y,S) SET_ASP__(Y,S PASS_REGS) + static inline -void SET_ASP(CELL *yreg, Int sz) { - CACHE_REGS +void SET_ASP__(CELL *yreg, Int sz USES_REGS) { ASP = (CELL *) (((char *) yreg) + sz); if (ASP > (CELL *)PROTECT_FROZEN_B(B)) ASP = (CELL *)PROTECT_FROZEN_B(B); } + + + diff --git a/H/amiops.h b/H/amiops.h index 989012e51..2e77f1cec 100644 --- a/H/amiops.h +++ b/H/amiops.h @@ -151,50 +151,12 @@ AlignGlobalForDouble( USES_REGS1 ) if ((TERM) > (CELL *)B || (TERM) > (CELL *)B_FZ) \ DO_TRAIL(TERM, VAL) -#ifdef TERM_EXTENSIONS - -#define Trail(TERM, VAL, LAB) \ - if (IN_BETWEEN(HBREG,TERM,B) && \ - ((TERM) < (CELL *)B_FZ)) \ - goto LAB - -#define TrailAndJump(TERM, VAL) \ - if (IN_BETWEEN(HBREG,TERM,B) && \ - ((TERM) < (CELL *)B_FZ)) \ - GONext(); - -#else -#define Trail(TERM, VAL, LAB) \ - TRAIL(TERM, VAL) - -#define Trail(TERM, VAL, LAB) \ - TRAIL_AND_JUMP(TERM, VAL) -#endif - #else /* BBREG_TRAIL_SCHEME */ #define TRAIL(TERM, VAL) \ if (OUTSIDE(HBREG,TERM,BBREG)) \ DO_TRAIL(TERM, VAL) -#ifdef TERM_EXTENSIONS -#define Trail(TERM, VAL, LAB) \ - if (IN_BETWEEN(HBREG,TERM,BBREG)) \ - goto LAB - -#define TrailAndJump(TERM, VAL) \ - if (IN_BETWEEN(HBREG,TERM,BBREG)) \ - GONext(); - -#else -#define Trail(TERM, VAL, LAB) \ - TRAIL(TERM, VAL) - -#define TrailAndJump(TERM, VAL) \ - TRAIL_AND_JUMP(TERM, VAL) - -#endif - #define TRAIL_LOCAL(TERM, VAL) \ if ((TERM) > (CELL *)BBREG) DO_TRAIL(TERM, VAL) @@ -205,14 +167,6 @@ AlignGlobalForDouble( USES_REGS1 ) #define TRAIL_GLOBAL(TERM, VAL) \ if ((TERM) < HBREG) DO_TRAIL(TERM, VAL) -#ifdef TERM_EXTENSIONS -#define Trail_Global(TERM, VAL, LAB) \ - if ((TERM) >= HBREG) goto LAB -#else -#define Trail_Global(TERM, VAL, LAB) \ - TRAIL_GLOBAL(TERM, VAL) -#endif - #define DO_MATRAIL(TERM, OLDVAL, NEWVAL) \ { \ register tr_fr_ptr r = TR; \ @@ -241,15 +195,8 @@ AlignGlobalForDouble( USES_REGS1 ) #define TRAIL(A,D) if (OUTSIDE(HBREG,A,B)) \ DO_TRAIL(A,D); -#define TRAIL_AND_JUMP(A,D) if (!OUTSIDE(HBREG,A,B)) GONext(); \ - DO_TRAIL(A,D); - -#define Trail(A, D, LAB) TRAIL(A,D) - #define TRAIL_GLOBAL(A,D) if ((A) < HBREG) DO_TRAIL(A,D); -#define Trail_Global(A,D,LAB) if ((A) < HBREG) DO_TRAIL(A,D); - #define TRAIL_LOCAL(A,D) if ((A) > (CELL *)B) DO_TRAIL(A,D); @@ -265,12 +212,8 @@ AlignGlobalForDouble( USES_REGS1 ) if (!OUTSIDE(HBREG,A,B)) \ GONext(); -#define Trail(A,D,LAB) TRAIL(A,D) - #define TRAIL_GLOBAL(A,D) TR[0] = (CELL)(A); if ((A) < HBREG) TR++ -#define Trail_Global(A,D,LAB) TRAIL_GLOBAL(A,D) - #define TRAIL_LOCAL(A,D) TR[0] = (CELL)(A); if ((A) > ((CELL *)(B))) TR++ #elif !defined(TERM_EXTENSIONS) @@ -283,14 +226,8 @@ AlignGlobalForDouble( USES_REGS1 ) #define TRAIL_AND_JUMP(A,D) if (IN_BETWEEN(HBREG,A,B)) GONext(); \ DO_TRAIL(A,D) -#define Trail(A,D,LAB) TRAIL(A,D) - #define TRAIL_GLOBAL(A,D) if ((A) < HBREG) DO_TRAIL(A,D) -#define Trail_Global(A,D,LAB) TRAIL_GLOBAL(A,D) - -#define Trail_Global2(A,D,LAB) TRAIL_GLOBAL(A,D) - #define TRAIL_LOCAL(A,D) if ((A) > ((CELL *)B)) DO_TRAIL(A,D) #else @@ -300,18 +237,11 @@ AlignGlobalForDouble( USES_REGS1 ) #define TRAIL(A,D) if (OUTSIDE(HBREG,A,B)) \ DO_TRAIL(A,D) -#define Trail(A,D,LAB) if (IN_BETWEEN(HBREG,A,B)) \ - goto LAB - #define TrailAndJump(A,D) if (IN_BETWEEN(HBREG,A,B)) \ GONext(); #define TRAIL_GLOBAL(A,D) if ((A) < HBREG) DO_TRAIL(A,D) -#define Trail_Global(A,D,LAB) if ((A) >= HBREG) goto LAB - -#define Trail_Global2(A,D,LAB) if ((A) < HBREG) goto LAB - #define TRAIL_LOCAL(A,D) if ((A) > ((CELL *)B)) DO_TRAIL(A,D) #endif @@ -342,61 +272,19 @@ Binding Macros for Multiple Assignment Variables. #define TRAIL_LINK(REF) TrailTerm(TR++) = AbsPair((CELL *)(REF)) #define TRAIL_FRAME(FR) DO_TRAIL(AbsPair((CELL *)(Yap_TrailBase)), FR) -#define Bind(A,D) TRAIL(A,D); *(A) = (D) -#define Bind_Global(A,D) TRAIL_GLOBAL(A,D); *(A) = (D) -#define Bind_and_Trail(A,D) DO_TRAIL(A,D); *(A) = (D) -#define BIND(A,D,L) *(A) = (D); Trail(A,D,L) -#define BIND_AND_JUMP(A,D) *(A) = (D); TrailAndJump(A,D) -#define BIND_GLOBAL(A,D,L) *(A) = (D); Trail_Global(A,D,L) +extern void Yap_WakeUp(CELL *v); -#ifdef COROUTINING -#define BIND_GLOBAL2(A,D,LAB,LAB1) *(A) = (D); if ((A) < HBREG) goto LAB; goto LAB1 - -#define BIND_GLOBALCELL(A,D) *(A) = (D); \ - if ((A) >= HBREG) continue; \ - TRAIL_GLOBAL(A,D); if (!IsAttVar(A)) continue; \ - Yap_WakeUp((A)); continue - -#define BIND_GLOBALCELL_NONATT(A,D) *(A) = (D); \ - if ((A) >= HBREG) continue; \ - TRAIL_GLOBAL(A,D); -#else -#define BIND_GLOBAL2(A,D,LAB,LAB1) BIND_GLOBAL(A,D,LAB) - -#define BIND_GLOBALCELL(A,D) BIND_GLOBAL(A,D,L); continue - -#define BIND_GLOBALCELL_NONATT(A,D) BIND_GLOBALCELL; continue -#endif +#define Bind(A,D) { *(A) = (D); TRAIL(A,D); if (FastIsAttVar(A)) Yap_WakeUp(A); } +#define Bind_NonAtt(A,D) { *(A) = (D); TRAIL(A,D); } +#define Bind_Global(A,D) { *(A) = (D); TRAIL_GLOBAL(A,D); if (FastIsAttVar(A)) Yap_WakeUp(A); } +#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_Local(A,D) { TRAIL_LOCAL(A,D); *(A) = (D); } #define MaBind(VP,D) { MATRAIL((VP),*(VP),(D)); *(VP) = (D); } -#if defined(__GNUC__) && defined(i386) && !defined(TERM_EXTENSIONS) && !defined(TABLING) -/* destroy d0 and pt0 */ -#define DBIND(A,D,L) \ -{ register CELL *t1=HBREG; \ -__asm__("movl %4,(%0)\n\t" \ - "movl %2,%4\n\t" \ - "subl %1,%2\n\t" \ - "subl %0,%4\n\t" \ - "cmpl %2,%4\n\t" \ - "jae 1f\n\t" \ - "movl %3,%4\n\t" \ - "movl %0,(%4)\n\t" \ - "addl $4,%4\n\t" \ - "movl %4,%3\n\t" \ - "1:" \ - : /* no outputs */ \ - : "r" (A), "m" (B), "r" (t1), "m" (TR), "r" (D) ); \ -} - -#else -#define DBIND(A,D,L) BIND(A,D,L) -#endif - - /************************************************************ Unification Routines @@ -535,12 +423,7 @@ Yap_unify_constant(register Term a, register Term cons) } deref_body(a,pt,unify_cons_unk,unify_cons_nonvar); - BIND(pt,cons,wake_for_cons); -#ifdef COROUTINING - DO_TRAIL(pt, cons); - if (IsAttVar(pt)) Yap_WakeUp(pt); - wake_for_cons: -#endif + Bind(pt,cons); return(TRUE); }