define Optype for xxc, for instructions whose constant argument is a term, like functor(a,X,T).

This commit is contained in:
Vitor Santos Costa 2009-12-06 00:37:48 +00:00
parent 7663a748a9
commit df2b11a6ec
6 changed files with 44 additions and 29 deletions

View File

@ -12429,23 +12429,23 @@ Yap_absmi(int inp)
ENDD(d0);
ENDOp();
Op(p_func2s_cv, xxn);
Op(p_func2s_cv, xxc);
/* A1 is a variable */
restart_func2s_cv:
#ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) {
RESET_VARIABLE(H);
H[1] = PREG->u.xxn.c;
H[2] = XREG(PREG->u.xxn.xi);
H[1] = PREG->u.xxc.c;
H[2] = XREG(PREG->u.xxc.xi);
low_level_trace(enter_pred,RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor,0)),H);
}
#endif /* LOW_LEVEL_TRACE */
BEGD(d0);
/* We have to build the structure */
d0 = PREG->u.xxn.c;
d0 = PREG->u.xxc.c;
/* we do, let's get the third argument */
BEGD(d1);
d1 = XREG(PREG->u.xxn.xi);
d1 = XREG(PREG->u.xxc.xi);
deref_head(d1, func2s_unk2_cv);
func2s_nvar2_cv:
/* Uuuff, the second and third argument are bound */
@ -12470,8 +12470,8 @@ Yap_absmi(int inp)
H += 2;
/* else if arity is 0 just pass d0 through */
/* Ding, ding, we made it */
XREG(PREG->u.xxn.x) = d0;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxn),Osbpp),l);
XREG(PREG->u.xxc.x) = d0;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxc),Osbpp),l);
GONext();
} else if ((Int)d1 > 0) {
/* now let's build a compound term */
@ -12493,7 +12493,7 @@ Yap_absmi(int inp)
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) {
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxn),Osbpp))) {
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxc),Osbpp))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,Yap_ErrorMessage);
setregs();
JMPNext();
@ -12511,12 +12511,12 @@ Yap_absmi(int inp)
ENDP(pt1);
/* else if arity is 0 just pass d0 through */
/* Ding, ding, we made it */
XREG(PREG->u.xxn.x) = d0;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxn),Osbpp),l);
XREG(PREG->u.xxc.x) = d0;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxc),Osbpp),l);
GONext();
} else if (d1 == 0) {
XREG(PREG->u.xxn.x) = d0;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxn),Osbpp),l);
XREG(PREG->u.xxc.x) = d0;
PREG = NEXTOP(NEXTOP(NEXTOP(PREG, xxc),Osbpp),l);
GONext();
} else {
saveregs();
@ -12545,7 +12545,7 @@ Yap_absmi(int inp)
Term ti;
CELL *hi = H;
ti = MkIntegerTerm((Int)(PREG->u.xxn.c));
ti = MkIntegerTerm(PREG->u.xxn.c);
RESET_VARIABLE(H);
H[1] = XREG(PREG->u.xxn.xi);
H[2] = ti;

View File

@ -306,7 +306,7 @@
OPCODE(p_arg_y_vv ,yxx),
OPCODE(p_arg_y_cv ,yxn),
OPCODE(p_func2s_vv ,xxx),
OPCODE(p_func2s_cv ,xxn),
OPCODE(p_func2s_cv ,xxc),
OPCODE(p_func2s_vc ,xxn),
OPCODE(p_func2s_y_vv ,yxx),
OPCODE(p_func2s_y_cv ,yxn),

View File

@ -698,6 +698,18 @@ typedef struct yami {
wamreg xr;
CELL next;
} xx;
struct {
wamreg x;
wamreg xi;
Term c;
CELL next;
} xxc;
struct {
wamreg x;
wamreg xi;
Int c;
CELL next;
} xxn;
struct {
wamreg x;
wamreg x1;
@ -711,12 +723,6 @@ typedef struct yami {
wamreg xr2;
CELL next;
} xxxx;
struct {
wamreg x;
wamreg xi;
Int c;
CELL next;
} xxn;
struct {
wamreg x;
wamreg x1;

View File

@ -798,6 +798,13 @@
}
cl = NEXTOP(cl,xx);
break;
case _p_func2s_cv:
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.xxc.x))) {
clause->Tag = (CELL)NULL;
return;
}
cl = NEXTOP(cl,xxc);
break;
case _p_and_vc:
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.xxn.x))) {
clause->Tag = (CELL)NULL;
@ -826,13 +833,6 @@
}
cl = NEXTOP(cl,xxn);
break;
case _p_func2s_cv:
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.xxn.x))) {
clause->Tag = (CELL)NULL;
return;
}
cl = NEXTOP(cl,xxn);
break;
case _p_func2s_vc:
if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.xxn.x))) {
clause->Tag = (CELL)NULL;

View File

@ -595,12 +595,18 @@ restore_opcodes(yamop *pc, yamop *max)
pc->u.xx.xr = XAdjust(pc->u.xx.xr);
pc = NEXTOP(pc,xx);
break;
/* instructions type xxc */
case _p_func2s_cv:
pc->u.xxc.x = XAdjust(pc->u.xxc.x);
pc->u.xxc.xi = XAdjust(pc->u.xxc.xi);
pc->u.xxc.c = ConstantTermAdjust(pc->u.xxc.c);
pc = NEXTOP(pc,xxc);
break;
/* instructions type xxn */
case _p_and_vc:
case _p_arg_cv:
case _p_div_cv:
case _p_div_vc:
case _p_func2s_cv:
case _p_func2s_vc:
case _p_minus_cv:
case _p_or_vc:

View File

@ -454,12 +454,15 @@
case _put_x_var:
pc = NEXTOP(pc,xx);
break;
/* instructions type xxc */
case _p_func2s_cv:
pc = NEXTOP(pc,xxc);
break;
/* instructions type xxn */
case _p_and_vc:
case _p_arg_cv:
case _p_div_cv:
case _p_div_vc:
case _p_func2s_cv:
case _p_func2s_vc:
case _p_minus_cv:
case _p_or_vc: