redo lost updates
This commit is contained in:
parent
258796098e
commit
f499115573
357
C/amasm.c
357
C/amasm.c
@ -230,10 +230,10 @@ STATIC_PROTO(OPCODE emit_op, (op_numbers));
|
||||
STATIC_PROTO(yamop *a_cle, (op_numbers, yamop *, int, struct intermediates *));
|
||||
STATIC_PROTO(yamop *a_e, (op_numbers, yamop *, int));
|
||||
STATIC_PROTO(yamop *a_ue, (op_numbers, op_numbers, yamop *, int));
|
||||
STATIC_PROTO(yamop *a_v, (op_numbers, yamop *, int, struct PSEUDO *));
|
||||
STATIC_PROTO(yamop *a_uv, (Ventry *,op_numbers, op_numbers, yamop *, int));
|
||||
STATIC_PROTO(yamop *a_vr, (op_numbers, yamop *, int, struct intermediates *));
|
||||
STATIC_PROTO(yamop *a_rv, (op_numbers, OPREG, yamop *, int, struct PSEUDO *));
|
||||
STATIC_PROTO(yamop *a_v, (op_numbers, op_numbers, yamop *, int, struct PSEUDO *));
|
||||
STATIC_PROTO(yamop *a_uv, (Ventry *,op_numbers, op_numbers, op_numbers, op_numbers, yamop *, int));
|
||||
STATIC_PROTO(yamop *a_vr, (op_numbers, op_numbers, yamop *, int, struct intermediates *));
|
||||
STATIC_PROTO(yamop *a_rv, (op_numbers, op_numbers, OPREG, yamop *, int, struct PSEUDO *));
|
||||
STATIC_PROTO(yamop *a_vv, (op_numbers, op_numbers, yamop *, int, struct intermediates *));
|
||||
STATIC_PROTO(yamop *a_glist, (int *, yamop *, int, struct intermediates *));
|
||||
STATIC_PROTO(void a_pair, (CELL *, int, struct intermediates *));
|
||||
@ -260,7 +260,8 @@ STATIC_PROTO(yamop *a_either, (op_numbers, CELL, CELL, yamop *, int, struct int
|
||||
#endif /* YAPOR */
|
||||
STATIC_PROTO(yamop *a_gl, (op_numbers, yamop *, int, struct PSEUDO *, struct intermediates *));
|
||||
STATIC_PROTO(yamop *a_bfunc, (CELL, clause_info *, yamop *, int, struct intermediates *));
|
||||
STATIC_PROTO(wamreg compile_cmp_flags, (char *));
|
||||
STATIC_PROTO(
|
||||
COUNT compile_cmp_flags, (char *));
|
||||
STATIC_PROTO(yamop *a_igl, (CELL, op_numbers, yamop *, int, struct intermediates *));
|
||||
STATIC_PROTO(yamop *a_xigl, (op_numbers, yamop *, int, struct PSEUDO *));
|
||||
STATIC_PROTO(yamop *a_ucons, (int *, compiler_vm_op, yamop *, int, struct intermediates *));
|
||||
@ -482,15 +483,12 @@ a_lucl(op_numbers opcode, yamop *code_p, int pass_no, struct intermediates *cip,
|
||||
if (pass_no) {
|
||||
LogUpdIndex *lcl = (LogUpdIndex *)cip->code_addr;
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.Ill.I = lcl;
|
||||
cip->current_try_lab = &code_p->u.Ill.l1;
|
||||
cip->current_trust_lab = &code_p->u.Ill.l2;
|
||||
code_p->u.Ill.s = cip->cpc->rnd3;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
code_p->u.Ill.p = cip->CurrentPred;
|
||||
#endif
|
||||
code_p->u.Ills.I = lcl;
|
||||
cip->current_try_lab = &code_p->u.Ills.l1;
|
||||
cip->current_trust_lab = &code_p->u.Ills.l2;
|
||||
code_p->u.Ills.s = cip->cpc->rnd3;
|
||||
}
|
||||
GONEXT(Ill);
|
||||
GONEXT(Ills);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@ -501,17 +499,11 @@ a_cle(op_numbers opcode, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
LogUpdClause *cl = (LogUpdClause *)cip->code_addr;
|
||||
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.EC.ClTrail = 0;
|
||||
code_p->u.EC.ClENV = 0;
|
||||
code_p->u.EC.ClRefs = 0;
|
||||
code_p->u.EC.ClBase = cl;
|
||||
#if defined(THREADS) || defined(YAPOR)
|
||||
code_p->u.EC.p = cip->CurrentPred;
|
||||
#endif
|
||||
code_p->u.L.ClBase = cl;
|
||||
cl->ClExt = code_p;
|
||||
cl->ClFlags |= LogUpdRuleMask;
|
||||
}
|
||||
GONEXT(EC);
|
||||
GONEXT(L);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@ -537,23 +529,23 @@ a_ue(op_numbers opcode, op_numbers opcodew, yamop *code_p, int pass_no)
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_v(op_numbers opcode, yamop *code_p, int pass_no, struct PSEUDO *cpc)
|
||||
a_v(op_numbers opcodex, op_numbers opcodey, yamop *code_p, int pass_no, struct PSEUDO *cpc)
|
||||
{
|
||||
Ventry *ve = (Ventry *) cpc->rnd1;
|
||||
OPREG var_offset;
|
||||
int is_y_var = (ve->KindOfVE == PermVar);
|
||||
|
||||
var_offset = Var_Ref(ve, is_y_var);
|
||||
if (ve->KindOfVE == PermVar) {
|
||||
if (is_y_var) {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op((op_numbers)((int)opcode + is_y_var));
|
||||
code_p->opc = emit_op(opcodey);
|
||||
code_p->u.y.y = emit_yreg(var_offset);
|
||||
}
|
||||
GONEXT(y);
|
||||
}
|
||||
else {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op((op_numbers)((int)opcode + is_y_var));
|
||||
code_p->opc = emit_op(opcodex);
|
||||
code_p->u.x.x = emit_xreg(var_offset);
|
||||
}
|
||||
GONEXT(x);
|
||||
@ -562,7 +554,7 @@ a_v(op_numbers opcode, yamop *code_p, int pass_no, struct PSEUDO *cpc)
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_uv(Ventry *ve, op_numbers opcode, op_numbers opcodew, yamop *code_p, int pass_no)
|
||||
a_uv(Ventry *ve, op_numbers opcodex, op_numbers opcodexw, op_numbers opcodey, op_numbers opcodeyw, yamop *code_p, int pass_no)
|
||||
{
|
||||
OPREG var_offset;
|
||||
int is_y_var = (ve->KindOfVE == PermVar);
|
||||
@ -570,16 +562,16 @@ a_uv(Ventry *ve, op_numbers opcode, op_numbers opcodew, yamop *code_p, int pass_
|
||||
var_offset = Var_Ref(ve, is_y_var);
|
||||
if (is_y_var) {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op((op_numbers)((int)opcode + is_y_var));
|
||||
code_p->u.oy.opcw = emit_op((op_numbers)((int)opcodew + is_y_var));
|
||||
code_p->opc = emit_op(opcodey);
|
||||
code_p->u.oy.opcw = emit_op(opcodeyw);
|
||||
code_p->u.oy.y = emit_yreg(var_offset);
|
||||
}
|
||||
GONEXT(oy);
|
||||
}
|
||||
else {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op((op_numbers)((int)opcode + is_y_var));
|
||||
code_p->u.ox.opcw = emit_op((op_numbers)((int)opcodew + is_y_var));
|
||||
code_p->opc = emit_op(opcodex);
|
||||
code_p->u.ox.opcw = emit_op(opcodexw);
|
||||
code_p->u.ox.x = emit_xreg(var_offset);
|
||||
}
|
||||
GONEXT(ox);
|
||||
@ -614,7 +606,7 @@ a_vv(op_numbers opcode, op_numbers opcodew, yamop *code_p, int pass_no, struct i
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_vr(op_numbers opcode, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
a_vr(op_numbers opcodex, op_numbers opcodey, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
struct PSEUDO *cpc = cip->cpc;
|
||||
Ventry *ve = (Ventry *) cpc->rnd1;
|
||||
@ -625,13 +617,13 @@ a_vr(op_numbers opcode, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
OPREG var_offset;
|
||||
|
||||
var_offset = Var_Ref(ve, is_y_var);
|
||||
code_p->opc = emit_op((op_numbers)((int)opcode + is_y_var));
|
||||
code_p->opc = emit_op(opcodey);
|
||||
code_p->u.yx.y = emit_yreg(var_offset);
|
||||
code_p->u.yx.x = emit_x(cpc->rnd2);
|
||||
}
|
||||
GONEXT(yx);
|
||||
}
|
||||
else if (opcode == _put_x_val &&
|
||||
else if (opcodex == _put_x_val &&
|
||||
cpc->nextInst &&
|
||||
cpc->nextInst->op == put_val_op &&
|
||||
!(((Ventry *) cpc->nextInst->rnd1)->KindOfVE == PermVar)) {
|
||||
@ -656,7 +648,7 @@ a_vr(op_numbers opcode, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
OPREG var_offset;
|
||||
|
||||
var_offset = Var_Ref(ve, is_y_var);
|
||||
code_p->opc = emit_op((op_numbers)((int)opcode + is_y_var));
|
||||
code_p->opc = emit_op(opcodex);
|
||||
code_p->u.xx.xl = emit_xreg(var_offset);
|
||||
code_p->u.xx.xr = emit_x(cpc->rnd2);
|
||||
}
|
||||
@ -666,14 +658,14 @@ a_vr(op_numbers opcode, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_rv(op_numbers opcode, OPREG var_offset, yamop *code_p, int pass_no, struct PSEUDO *cpc)
|
||||
a_rv(op_numbers opcodex, op_numbers opcodey, OPREG var_offset, yamop *code_p, int pass_no, struct PSEUDO *cpc)
|
||||
{
|
||||
Ventry *ve = (Ventry *) cpc->rnd1;
|
||||
int is_y_var = (ve->KindOfVE == PermVar);
|
||||
|
||||
if (is_y_var) {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op((op_numbers)((int)opcode + is_y_var));
|
||||
code_p->opc = emit_op(opcodey);
|
||||
code_p->u.xy.x = emit_x(cpc->rnd2);
|
||||
code_p->u.xy.y = emit_yreg(var_offset);
|
||||
}
|
||||
@ -681,7 +673,7 @@ a_rv(op_numbers opcode, OPREG var_offset, yamop *code_p, int pass_no, struct PSE
|
||||
}
|
||||
else {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op((op_numbers)((int)opcode + is_y_var));
|
||||
code_p->opc = emit_op(opcodex);
|
||||
code_p->u.xx.xl = emit_x(cpc->rnd2);
|
||||
code_p->u.xx.xr = emit_xreg(var_offset);
|
||||
}
|
||||
@ -792,10 +784,10 @@ a_f(CELL rnd1, op_numbers opcode, yamop *code_p, int pass_no)
|
||||
Functor f = emit_f(rnd1);
|
||||
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.f.f = f;
|
||||
code_p->u.f.a = ArityOfFunctor(f);
|
||||
code_p->u.fa.f = f;
|
||||
code_p->u.fa.a = ArityOfFunctor(f);
|
||||
}
|
||||
GONEXT(f);
|
||||
GONEXT(fa);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@ -806,11 +798,11 @@ a_uf(CELL rnd1, op_numbers opcode, op_numbers opcodew, yamop *code_p, int pass_n
|
||||
Functor f = emit_f(rnd1);
|
||||
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.of.opcw = emit_op(opcodew);
|
||||
code_p->u.of.f = f;
|
||||
code_p->u.of.a = ArityOfFunctor(f);
|
||||
code_p->u.ofa.opcw = emit_op(opcodew);
|
||||
code_p->u.ofa.f = f;
|
||||
code_p->u.ofa.a = ArityOfFunctor(f);
|
||||
}
|
||||
GONEXT(of);
|
||||
GONEXT(ofa);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@ -978,11 +970,11 @@ a_rf(op_numbers opcode, yamop *code_p, int pass_no, struct PSEUDO *cpc)
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.xf.x = emit_x(cpc->rnd2);
|
||||
code_p->u.xf.f = emit_f(cpc->rnd1);
|
||||
code_p->u.xf.a = ArityOfFunctor(emit_f(cpc->rnd1));
|
||||
code_p->u.xfa.x = emit_x(cpc->rnd2);
|
||||
code_p->u.xfa.f = emit_f(cpc->rnd1);
|
||||
code_p->u.xfa.a = ArityOfFunctor(emit_f(cpc->rnd1));
|
||||
}
|
||||
GONEXT(xf);
|
||||
GONEXT(xfa);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@ -1243,14 +1235,14 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, struct i
|
||||
longjmp(cip->CompilerBotch, 1);
|
||||
} else
|
||||
code_p->opc = emit_op(_call_c_wfail);
|
||||
code_p->u.sdl.s =
|
||||
code_p->u.sdlp.s =
|
||||
emit_count(-Signed(RealEnvSize) - CELLSIZE * cip->cpc->rnd2);
|
||||
code_p->u.sdl.l =
|
||||
code_p->u.sdlp.l =
|
||||
emit_a(Unsigned(cip->code_addr) + cip->label_offset[clinfo->commit_lab]);
|
||||
code_p->u.sdl.p =
|
||||
code_p->u.sdlp.p =
|
||||
emit_pe(RepPredProp(fe));
|
||||
}
|
||||
GONEXT(sdl);
|
||||
GONEXT(sdlp);
|
||||
clinfo->commit_lab = 0;
|
||||
} else {
|
||||
if (pass_no) {
|
||||
@ -1265,22 +1257,22 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, struct i
|
||||
code_p->opc = emit_op(_call_cpred);
|
||||
}
|
||||
}
|
||||
code_p->u.sla.s = emit_count(-Signed(RealEnvSize) - CELLSIZE
|
||||
code_p->u.sbpp.s = emit_count(-Signed(RealEnvSize) - CELLSIZE
|
||||
* (cip->cpc->rnd2));
|
||||
if (RepPredProp(fe)->FunctorOfPred != FunctorExecuteInMod) {
|
||||
code_p->u.sla.sla_u.p = RepPredProp(fe);
|
||||
code_p->u.sbpp.p = RepPredProp(fe);
|
||||
} else {
|
||||
code_p->u.sla.sla_u.mod = cip->cpc->rnd4;
|
||||
code_p->u.sbmp.mod = cip->cpc->rnd4;
|
||||
}
|
||||
code_p->u.sla.p0 = clinfo->CurrentPred;
|
||||
code_p->u.sbpp.p0 = clinfo->CurrentPred;
|
||||
if (cip->cpc->rnd2) {
|
||||
code_p->u.sla.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
|
||||
code_p->u.sbpp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
|
||||
} else {
|
||||
/* there is no bitmap as there are no variables in the environment */
|
||||
code_p->u.sla.bmap = NULL;
|
||||
code_p->u.sbpp.bmap = NULL;
|
||||
}
|
||||
}
|
||||
GONEXT(sla);
|
||||
GONEXT(sbpp);
|
||||
}
|
||||
return code_p;
|
||||
}
|
||||
@ -1300,17 +1292,17 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, struct i
|
||||
}
|
||||
if (opcode == _call) {
|
||||
if (pass_no) {
|
||||
code_p->u.sla.s = emit_count(-Signed(RealEnvSize) - CELLSIZE *
|
||||
code_p->u.sbpp.s = emit_count(-Signed(RealEnvSize) - CELLSIZE *
|
||||
cip->cpc->rnd2);
|
||||
code_p->u.sla.sla_u.p = RepPredProp(fe);
|
||||
code_p->u.sla.p0 = clinfo->CurrentPred;
|
||||
code_p->u.sbpp.p = RepPredProp(fe);
|
||||
code_p->u.sbpp.p0 = clinfo->CurrentPred;
|
||||
if (cip->cpc->rnd2)
|
||||
code_p->u.sla.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
|
||||
code_p->u.sbpp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
|
||||
else
|
||||
/* there is no bitmap as there are no variables in the environment */
|
||||
code_p->u.sla.bmap = NULL;
|
||||
code_p->u.sbpp.bmap = NULL;
|
||||
}
|
||||
GONEXT(sla);
|
||||
GONEXT(sbpp);
|
||||
}
|
||||
else if (opcode == _execute ||
|
||||
opcode == _dexecute) {
|
||||
@ -1347,17 +1339,17 @@ a_empty_call(clause_info *clinfo, yamop *code_p, int pass_no, struct intermedia
|
||||
}
|
||||
if (pass_no) {
|
||||
PredEntry *pe = RepPredProp(Yap_GetPredPropByAtom(AtomTrue,0));
|
||||
code_p->u.sla.s = emit_count(-Signed(RealEnvSize) - CELLSIZE *
|
||||
code_p->u.sbpp.s = emit_count(-Signed(RealEnvSize) - CELLSIZE *
|
||||
cip->cpc->rnd2);
|
||||
code_p->u.sla.sla_u.p = pe;
|
||||
code_p->u.sla.p0 = clinfo->CurrentPred;
|
||||
code_p->u.sbpp.p = pe;
|
||||
code_p->u.sbpp.p0 = clinfo->CurrentPred;
|
||||
if (cip->cpc->rnd2)
|
||||
code_p->u.sla.bmap = emit_bmlabel(cip->cpc->rnd1, cip);
|
||||
code_p->u.sbpp.bmap = emit_bmlabel(cip->cpc->rnd1, cip);
|
||||
else
|
||||
/* there is no bitmap as there are no variables in the environment */
|
||||
code_p->u.sla.bmap = NULL;
|
||||
code_p->u.sbpp.bmap = NULL;
|
||||
}
|
||||
GONEXT(sla);
|
||||
GONEXT(sbpp);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@ -1372,7 +1364,7 @@ a_pl(op_numbers opcode, PredEntry *pred, yamop *code_p, int pass_no)
|
||||
return code_p;
|
||||
}
|
||||
|
||||
static wamreg
|
||||
static COUNT
|
||||
compile_cmp_flags(char *s)
|
||||
{
|
||||
if (strcmp(s,"=<") == 0)
|
||||
@ -1401,7 +1393,7 @@ compile_cmp_flags(char *s)
|
||||
return(0);
|
||||
}
|
||||
|
||||
wamreg
|
||||
COUNT
|
||||
Yap_compile_cmp_flags(PredEntry *pred)
|
||||
{
|
||||
return
|
||||
@ -1425,35 +1417,35 @@ a_bfunc(CELL pred, clause_info *clinfo, yamop *code_p, int pass_no, struct inter
|
||||
if (is_y_var) {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(_call_bfunc_yy);
|
||||
code_p->u.llyy.p = RepPredProp(((Prop)pred));
|
||||
code_p->u.plyys.p = RepPredProp(((Prop)pred));
|
||||
if (clinfo->commit_lab) {
|
||||
code_p->u.llyy.f =
|
||||
code_p->u.plyys.f =
|
||||
emit_a(Unsigned(cip->code_addr) + cip->label_offset[clinfo->commit_lab]);
|
||||
clinfo->commit_lab = 0;
|
||||
} else {
|
||||
code_p->u.llyy.f = FAILCODE;
|
||||
code_p->u.plyys.f = FAILCODE;
|
||||
}
|
||||
code_p->u.llyy.y1 = v1;
|
||||
code_p->u.llyy.y2 = emit_yreg(var_offset);
|
||||
code_p->u.llyy.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
|
||||
code_p->u.plyys.y1 = v1;
|
||||
code_p->u.plyys.y2 = emit_yreg(var_offset);
|
||||
code_p->u.plyys.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
|
||||
}
|
||||
GONEXT(llyy);
|
||||
GONEXT(plyys);
|
||||
} else {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(_call_bfunc_yx);
|
||||
code_p->u.llxy.p = RepPredProp(((Prop)pred));
|
||||
code_p->u.plxys.p = RepPredProp(((Prop)pred));
|
||||
if (clinfo->commit_lab) {
|
||||
code_p->u.llxy.f =
|
||||
code_p->u.plxys.f =
|
||||
emit_a(Unsigned(cip->code_addr) + cip->label_offset[clinfo->commit_lab]);
|
||||
clinfo->commit_lab = 0;
|
||||
} else {
|
||||
code_p->u.llxy.f = FAILCODE;
|
||||
code_p->u.plxys.f = FAILCODE;
|
||||
}
|
||||
code_p->u.llxy.x = emit_xreg(var_offset);
|
||||
code_p->u.llxy.y = v1;
|
||||
code_p->u.llxy.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
|
||||
code_p->u.plxys.x = emit_xreg(var_offset);
|
||||
code_p->u.plxys.y = v1;
|
||||
code_p->u.plxys.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
|
||||
}
|
||||
GONEXT(llxy);
|
||||
GONEXT(plxys);
|
||||
}
|
||||
} else {
|
||||
wamreg x1 = emit_xreg(var_offset);
|
||||
@ -1466,35 +1458,35 @@ a_bfunc(CELL pred, clause_info *clinfo, yamop *code_p, int pass_no, struct inter
|
||||
if (is_y_var) {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(_call_bfunc_xy);
|
||||
code_p->u.llxy.p = RepPredProp(((Prop)pred));
|
||||
code_p->u.plxys.p = RepPredProp(((Prop)pred));
|
||||
if (clinfo->commit_lab) {
|
||||
code_p->u.llxy.f =
|
||||
code_p->u.plxys.f =
|
||||
emit_a(Unsigned(cip->code_addr) + cip->label_offset[clinfo->commit_lab]);
|
||||
clinfo->commit_lab = 0;
|
||||
} else {
|
||||
code_p->u.llxy.f = FAILCODE;
|
||||
code_p->u.plxys.f = FAILCODE;
|
||||
}
|
||||
code_p->u.llxy.x = x1;
|
||||
code_p->u.llxy.y = emit_yreg(var_offset);
|
||||
code_p->u.llxy.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
|
||||
code_p->u.plxys.x = x1;
|
||||
code_p->u.plxys.y = emit_yreg(var_offset);
|
||||
code_p->u.plxys.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
|
||||
}
|
||||
GONEXT(llxy);
|
||||
GONEXT(plxys);
|
||||
} else {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(_call_bfunc_xx);
|
||||
code_p->u.llxx.p = RepPredProp(((Prop)pred));
|
||||
code_p->u.plxxs.p = RepPredProp(((Prop)pred));
|
||||
if (clinfo->commit_lab) {
|
||||
code_p->u.llxx.f =
|
||||
code_p->u.plxxs.f =
|
||||
emit_a(Unsigned(cip->code_addr) + cip->label_offset[clinfo->commit_lab]);
|
||||
clinfo->commit_lab = 0;
|
||||
} else {
|
||||
code_p->u.llxx.f = FAILCODE;
|
||||
code_p->u.plxxs.f = FAILCODE;
|
||||
}
|
||||
code_p->u.llxx.x1 = x1;
|
||||
code_p->u.llxx.x2 = emit_xreg(var_offset);
|
||||
code_p->u.llxx.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
|
||||
code_p->u.plxxs.x1 = x1;
|
||||
code_p->u.plxxs.x2 = emit_xreg(var_offset);
|
||||
code_p->u.plxxs.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
|
||||
}
|
||||
GONEXT(llxx);
|
||||
GONEXT(plxxs);
|
||||
}
|
||||
}
|
||||
return code_p;
|
||||
@ -1793,7 +1785,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
|
||||
yamop *newcp;
|
||||
/* emit a special instruction and then a label for backpatching */
|
||||
if (pass_no) {
|
||||
UInt size = (UInt)NEXTOP((yamop *)NULL,lld);
|
||||
UInt size = (UInt)NEXTOP((yamop *)NULL,aLl);
|
||||
if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) {
|
||||
/* OOOPS, got in trouble, must do a longjmp and recover space */
|
||||
save_machine_regs();
|
||||
@ -1810,15 +1802,15 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
|
||||
try-retry-trust
|
||||
instructions allocated in this run
|
||||
*/
|
||||
newcp->u.lld.n = cip->try_instructions;
|
||||
newcp->u.aLl.n = cip->try_instructions;
|
||||
cip->try_instructions = newcp;
|
||||
} else {
|
||||
newcp->u.lld.n = *cip->current_try_lab;
|
||||
newcp->u.aLl.n = *cip->current_try_lab;
|
||||
*cip->current_try_lab = newcp;
|
||||
}
|
||||
if (opcode == _try_clause) {
|
||||
newcp->opc = emit_op(_try_logical);
|
||||
newcp->u.lld.t.s = emit_count(opr);
|
||||
newcp->u.aLl.s = emit_count(opr);
|
||||
} else if (opcode == _retry) {
|
||||
if (ap->PredFlags & CountPredFlag)
|
||||
newcp->opc = emit_op(_count_retry_logical);
|
||||
@ -1826,7 +1818,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
|
||||
newcp->opc = emit_op(_profiled_retry_logical);
|
||||
else
|
||||
newcp->opc = emit_op(_retry_logical);
|
||||
newcp->u.lld.t.s = emit_count(opr);
|
||||
newcp->u.aLl.s = emit_count(opr);
|
||||
} else {
|
||||
if (ap->PredFlags & CountPredFlag)
|
||||
newcp->opc = emit_op(_count_trust_logical);
|
||||
@ -1834,11 +1826,11 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
|
||||
newcp->opc = emit_op(_profiled_trust_logical);
|
||||
else
|
||||
newcp->opc = emit_op(_trust_logical);
|
||||
newcp->u.lld.t.block = (LogUpdIndex *)(cip->code_addr);
|
||||
newcp->u.ILl.block = (LogUpdIndex *)(cip->code_addr);
|
||||
*cip->current_trust_lab = newcp;
|
||||
}
|
||||
newcp->u.lld.d = ClauseCodeToLogUpdClause(emit_a(lab));
|
||||
cip->current_try_lab = &(newcp->u.lld.n);
|
||||
newcp->u.aLl.d = ClauseCodeToLogUpdClause(emit_a(lab));
|
||||
cip->current_try_lab = &(newcp->u.aLl.n);
|
||||
}
|
||||
return code_p;
|
||||
}
|
||||
@ -1894,11 +1886,11 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
|
||||
}
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.ld.d = emit_a(lab);
|
||||
code_p->u.ld.s = emit_count(opr);
|
||||
code_p->u.ld.p = ap;
|
||||
code_p->u.apl.d = emit_a(lab);
|
||||
code_p->u.apl.s = emit_count(opr);
|
||||
code_p->u.apl.p = ap;
|
||||
#ifdef TABLING
|
||||
code_p->u.ld.te = ap->TableOfPred;
|
||||
code_p->u.apl.te = ap->TableOfPred;
|
||||
#endif
|
||||
#ifdef YAPOR
|
||||
INIT_YAMOP_LTT(code_p, nofalts);
|
||||
@ -1908,7 +1900,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
|
||||
PUT_YAMOP_SEQ(code_p);
|
||||
#endif /* YAPOR */
|
||||
}
|
||||
GONEXT(ld);
|
||||
GONEXT(apl);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@ -1921,9 +1913,9 @@ a_either(op_numbers opcode, CELL opr, CELL lab, yamop *code_p, int pass_no, stru
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.sla.s = emit_count(opr);
|
||||
code_p->u.sla.sla_u.l = emit_a(lab);
|
||||
code_p->u.sla.p0 = cip->CurrentPred;
|
||||
code_p->u.sblp.s = emit_count(opr);
|
||||
code_p->u.sblp.l = emit_a(lab);
|
||||
code_p->u.sblp.p0 = cip->CurrentPred;
|
||||
#ifdef YAPOR
|
||||
INIT_YAMOP_LTT(code_p, nofalts);
|
||||
if (hascut)
|
||||
@ -1931,13 +1923,13 @@ a_either(op_numbers opcode, CELL opr, CELL lab, yamop *code_p, int pass_no, stru
|
||||
if (cip->CurrentPred->PredFlags & SequentialPredFlag)
|
||||
PUT_YAMOP_SEQ(code_p);
|
||||
if(opcode != _or_last) {
|
||||
code_p->u.sla.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
|
||||
code_p->u.sblp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
|
||||
}
|
||||
#else
|
||||
code_p->u.sla.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
|
||||
code_p->u.sblp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
|
||||
#endif /* YAPOR */
|
||||
}
|
||||
GONEXT(sla);
|
||||
GONEXT(sblp);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
@ -2017,7 +2009,7 @@ a_uvar(yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
}
|
||||
}
|
||||
#endif /* AGGREGATE_OPS */
|
||||
return a_uv((Ventry *) cip->cpc->rnd1, _unify_x_var, _unify_x_var_write, code_p, pass_no);
|
||||
return a_uv((Ventry *) cip->cpc->rnd1, _unify_x_var, _unify_x_var_write, _unify_y_var, _unify_y_var_write, code_p, pass_no);
|
||||
}
|
||||
else {
|
||||
#if AGGREGATE_OPS
|
||||
@ -2054,7 +2046,7 @@ static yamop *
|
||||
a_wvar(yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
if (!no_ref_var())
|
||||
return a_v(_write_x_var, code_p, pass_no, cip->cpc);
|
||||
return a_v(_write_x_var, _write_y_var, code_p, pass_no, cip->cpc);
|
||||
else {
|
||||
#if AGGREGATE_OPS
|
||||
int i = 0;
|
||||
@ -2091,7 +2083,7 @@ a_glist(int *do_not_optimise_uatomp, yamop *code_p, int pass_no, struct intermed
|
||||
cip->cpc = pnext;
|
||||
is_y_var = (ve->KindOfVE == PermVar);
|
||||
var_offset = Var_Ref(ve, is_y_var);
|
||||
return a_rv(_glist_valx, var_offset, code_p, pass_no, cip->cpc);
|
||||
return a_rv(_glist_valx, _glist_valy, var_offset, code_p, pass_no, cip->cpc);
|
||||
} else if (cip->cpc->rnd2 == 1 && pnext->op == unify_atom_op) {
|
||||
*do_not_optimise_uatomp = TRUE;
|
||||
return a_r(cip->cpc->rnd2, _get_list, code_p, pass_no);
|
||||
@ -2108,7 +2100,10 @@ a_glist(int *do_not_optimise_uatomp, yamop *code_p, int pass_no, struct intermed
|
||||
ppnext->rnd2 = cip->cpc->rnd2;
|
||||
cip->cpc = ppnext;
|
||||
var_offset = Var_Ref(ve, is_y_var);
|
||||
return a_rv((op_numbers)((int)_gl_void_varx + (cip->cpc->op == unify_last_var_op ? 0 : 2)), var_offset, code_p, pass_no, cip->cpc);
|
||||
if (cip->cpc->op == unify_last_var_op)
|
||||
return a_rv(_gl_void_varx, _gl_void_vary, var_offset, code_p, pass_no, cip->cpc);
|
||||
else
|
||||
return a_rv(_gl_void_valx, _gl_void_valy, var_offset, code_p, pass_no, cip->cpc);
|
||||
} else {
|
||||
return a_r(cip->cpc->rnd2, _get_list, code_p, pass_no);
|
||||
}
|
||||
@ -2269,7 +2264,7 @@ a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermed
|
||||
if (opc <= _primitive) {
|
||||
if (is_y_var) {
|
||||
if (pass_no) {
|
||||
code_p->u.yF.y = emit_y(ve);
|
||||
code_p->u.yl.y = emit_y(ve);
|
||||
switch (opc) {
|
||||
case _atom:
|
||||
code_p->opc = opcode(_p_atom_y);
|
||||
@ -2306,18 +2301,18 @@ a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermed
|
||||
break;
|
||||
}
|
||||
if (cmp_info->cl_info->commit_lab) {
|
||||
code_p->u.yF.F =
|
||||
code_p->u.yl.F =
|
||||
emit_a(Unsigned(cip->code_addr) + cip->label_offset[cmp_info->cl_info->commit_lab]);
|
||||
cmp_info->cl_info->commit_lab = 0;
|
||||
} else {
|
||||
code_p->u.yF.F = FAILCODE;
|
||||
code_p->u.yl.F = FAILCODE;
|
||||
}
|
||||
}
|
||||
GONEXT(yF);
|
||||
GONEXT(yl);
|
||||
return code_p;
|
||||
} else {
|
||||
if (pass_no) {
|
||||
code_p->u.xF.x = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
code_p->u.xl.x = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
switch (opc) {
|
||||
case _atom:
|
||||
code_p->opc = opcode(_p_atom_x);
|
||||
@ -2354,14 +2349,14 @@ a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermed
|
||||
break;
|
||||
}
|
||||
if (cmp_info->cl_info->commit_lab) {
|
||||
code_p->u.xF.F =
|
||||
code_p->u.xl.F =
|
||||
emit_a(Unsigned(cip->code_addr) + cip->label_offset[cmp_info->cl_info->commit_lab]);
|
||||
cmp_info->cl_info->commit_lab = 0;
|
||||
} else {
|
||||
code_p->u.xF.F = FAILCODE;
|
||||
code_p->u.xl.F = FAILCODE;
|
||||
}
|
||||
}
|
||||
GONEXT(xF);
|
||||
GONEXT(xl);
|
||||
return code_p;
|
||||
}
|
||||
}
|
||||
@ -2394,11 +2389,11 @@ a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermed
|
||||
if (nve->KindOfVE == PermVar) {
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(_p_func2f_xy);
|
||||
code_p->u.xyx.x1 = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
code_p->u.xyx.y2 = emit_y(nve);
|
||||
code_p->u.xyx.x = cmp_info->x1_arg;
|
||||
code_p->u.xxy.x1 = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
code_p->u.xxy.y2 = emit_y(nve);
|
||||
code_p->u.xxy.x = cmp_info->x1_arg;
|
||||
}
|
||||
GONEXT(xyx);
|
||||
GONEXT(xxy);
|
||||
return code_p;
|
||||
} else {
|
||||
if (pass_no) {
|
||||
@ -2496,11 +2491,11 @@ a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermed
|
||||
code_p->opc = emit_op(_p_func2s_y_cv);
|
||||
break;
|
||||
}
|
||||
code_p->u.ycx.y = emit_y(ve);
|
||||
code_p->u.ycx.c = cmp_info->c_arg;
|
||||
code_p->u.ycx.xi = cmp_info->x1_arg;
|
||||
code_p->u.yxc.y = emit_y(ve);
|
||||
code_p->u.yxc.c = cmp_info->c_arg;
|
||||
code_p->u.yxc.xi = cmp_info->x1_arg;
|
||||
}
|
||||
GONEXT(ycx);
|
||||
GONEXT(yxc);
|
||||
break;
|
||||
case TYPE_XC:
|
||||
if (pass_no) {
|
||||
@ -2695,11 +2690,11 @@ a_f2(int var, cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermed
|
||||
code_p->opc = emit_op(_p_func2s_vc);
|
||||
break;
|
||||
}
|
||||
code_p->u.xcx.x = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
code_p->u.xcx.c = cmp_info->c_arg;
|
||||
code_p->u.xcx.xi = cmp_info->x1_arg;
|
||||
code_p->u.xxc.x = emit_x(ve->NoOfVE & MaskVarAdrs);
|
||||
code_p->u.xxc.c = cmp_info->c_arg;
|
||||
code_p->u.xxc.xi = cmp_info->x1_arg;
|
||||
}
|
||||
GONEXT(xcx);
|
||||
GONEXT(xxc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2926,16 +2921,16 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
break;
|
||||
#endif
|
||||
case get_var_op:
|
||||
code_p = a_vr(_get_x_var, code_p, pass_no, cip);
|
||||
code_p = a_vr(_get_x_var, _get_y_var, code_p, pass_no, cip);
|
||||
break;
|
||||
case put_var_op:
|
||||
code_p = a_vr(_put_x_var, code_p, pass_no, cip);
|
||||
code_p = a_vr(_put_x_var, _put_y_var, code_p, pass_no, cip);
|
||||
break;
|
||||
case get_val_op:
|
||||
code_p = a_vr(_get_x_val, code_p, pass_no, cip);
|
||||
code_p = a_vr(_get_x_val, _get_y_val, code_p, pass_no, cip);
|
||||
break;
|
||||
case put_val_op:
|
||||
code_p = a_vr(_put_x_val, code_p, pass_no, cip);
|
||||
code_p = a_vr(_put_x_val, _put_y_val, code_p, pass_no, cip);
|
||||
break;
|
||||
case get_num_op:
|
||||
case get_atom_op:
|
||||
@ -2986,34 +2981,34 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
code_p = a_rf(_put_struct, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case put_unsafe_op:
|
||||
code_p = a_vr((op_numbers)((int)_put_unsafe - 1), code_p, pass_no, cip);
|
||||
code_p = a_vr(_put_unsafe, _put_unsafe, code_p, pass_no, cip);
|
||||
break;
|
||||
case unify_var_op:
|
||||
code_p = a_uvar(code_p, pass_no, cip);
|
||||
break;
|
||||
case unify_last_var_op:
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_l_x_var, _unify_l_x_var_write, code_p, pass_no);
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_l_x_var, _unify_l_x_var_write, _unify_l_y_var, _unify_l_y_var_write, code_p, pass_no);
|
||||
break;
|
||||
case write_var_op:
|
||||
code_p = a_wvar(code_p, pass_no, cip);
|
||||
break;
|
||||
case unify_local_op:
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_x_loc, _unify_x_loc_write, code_p, pass_no);
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_x_loc, _unify_x_loc_write, _unify_y_loc, _unify_y_loc_write, code_p, pass_no);
|
||||
break;
|
||||
case unify_val_op:
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_x_val, _unify_x_val_write, code_p, pass_no);
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_x_val, _unify_x_val_write, _unify_y_val, _unify_y_val_write, code_p, pass_no);
|
||||
break;
|
||||
case unify_last_local_op:
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_l_x_loc, _unify_l_x_loc_write, code_p, pass_no);
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_l_x_loc, _unify_l_x_loc_write, _unify_l_y_loc, _unify_l_y_loc_write, code_p, pass_no);
|
||||
break;
|
||||
case unify_last_val_op:
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_l_x_val, _unify_l_x_val_write, code_p, pass_no);
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _unify_l_x_val, _unify_l_x_val_write, _unify_l_y_val, _unify_l_y_val_write, code_p, pass_no);
|
||||
break;
|
||||
case write_local_op:
|
||||
code_p = a_v(_write_x_loc, code_p, pass_no, cip->cpc);
|
||||
code_p = a_v(_write_x_loc, _write_y_loc, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case write_val_op:
|
||||
code_p = a_v(_write_x_val, code_p, pass_no, cip->cpc);
|
||||
code_p = a_v(_write_x_val, _write_y_val, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case unify_num_op:
|
||||
case unify_atom_op:
|
||||
@ -3095,16 +3090,16 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
break;
|
||||
case save_b_op:
|
||||
case patch_b_op:
|
||||
code_p = a_v(_save_b_x, code_p, pass_no, cip->cpc);
|
||||
code_p = a_v(_save_b_x, _save_b_y, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case commit_b_op:
|
||||
code_p = a_v(_commit_b_x, code_p, pass_no, cip->cpc);
|
||||
code_p = a_v(_commit_b_x, _commit_b_y, code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case save_pair_op:
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _save_pair_x, _save_pair_x_write, code_p, pass_no);
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _save_pair_x, _save_pair_x_write, _save_pair_y, _save_pair_y_write, code_p, pass_no);
|
||||
break;
|
||||
case save_appl_op:
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _save_appl_x, _save_appl_x_write, code_p, pass_no);
|
||||
code_p = a_uv((Ventry *) cip->cpc->rnd1, _save_appl_x, _save_appl_x_write, _save_appl_y, _save_appl_y_write, code_p, pass_no);
|
||||
break;
|
||||
case fail_op:
|
||||
code_p = a_e(_op_fail, code_p, pass_no);
|
||||
@ -3558,7 +3553,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
|
||||
}
|
||||
if (ap->PredFlags & DynamicPredFlag) {
|
||||
size =
|
||||
(CELL)NEXTOP(NEXTOP(NEXTOP((yamop *)(((DynamicClause *)NULL)->ClCode),ld),sla),e);
|
||||
(CELL)NEXTOP(NEXTOP(NEXTOP((yamop *)(((DynamicClause *)NULL)->ClCode),apl),sbpp),e);
|
||||
}
|
||||
if ((CELL)code_p > size)
|
||||
size = (CELL)code_p;
|
||||
@ -3631,28 +3626,28 @@ Yap_InitComma(void)
|
||||
{
|
||||
yamop *code_p = COMMA_CODE;
|
||||
code_p->opc = opcode(_call);
|
||||
code_p->u.sla.s = emit_count(-Signed(RealEnvSize) - sizeof(CELL) * 3);
|
||||
code_p->u.sla.sla_u.p =
|
||||
code_p->u.sla.p0 =
|
||||
code_p->u.sbpp.s = emit_count(-Signed(RealEnvSize) - sizeof(CELL) * 3);
|
||||
code_p->u.sbpp.p =
|
||||
code_p->u.sbpp.p0 =
|
||||
RepPredProp(PredPropByFunc(FunctorComma,0));
|
||||
code_p->u.sla.bmap = NULL;
|
||||
GONEXT(sla);
|
||||
code_p->u.sbpp.bmap = NULL;
|
||||
GONEXT(sbpp);
|
||||
if (PRED_GOAL_EXPANSION_ON) {
|
||||
Functor fp = Yap_MkFunctor(Yap_FullLookupAtom("$generate_pred_info"),4);
|
||||
code_p->opc = emit_op(_call_cpred);
|
||||
code_p->u.sla.s = emit_count(-Signed(RealEnvSize));
|
||||
code_p->u.sla.sla_u.p =
|
||||
code_p->u.sla.p0 =
|
||||
code_p->u.sbpp.s = emit_count(-Signed(RealEnvSize));
|
||||
code_p->u.sbpp.p =
|
||||
code_p->u.sbpp.p0 =
|
||||
RepPredProp(Yap_GetPredPropByFunc(fp,0));
|
||||
code_p->u.sla.bmap = NULL;
|
||||
GONEXT(sla);
|
||||
code_p->u.sbpp.bmap = NULL;
|
||||
GONEXT(sbpp);
|
||||
code_p->opc = emit_op(_call);
|
||||
code_p->u.sla.s = emit_count(-Signed(RealEnvSize));
|
||||
code_p->u.sla.sla_u.p =
|
||||
code_p->u.sla.p0 =
|
||||
code_p->u.sbpp.s = emit_count(-Signed(RealEnvSize));
|
||||
code_p->u.sbpp.p =
|
||||
code_p->u.sbpp.p0 =
|
||||
PredMetaCall;
|
||||
code_p->u.sla.bmap = NULL;
|
||||
GONEXT(sla);
|
||||
code_p->u.sbpp.bmap = NULL;
|
||||
GONEXT(sbpp);
|
||||
code_p->opc = emit_op(_deallocate);
|
||||
GONEXT(e);
|
||||
code_p->opc = emit_op(_procceed);
|
||||
@ -3668,11 +3663,11 @@ Yap_InitComma(void)
|
||||
GONEXT(e);
|
||||
}
|
||||
code_p->opc = opcode(_p_execute_tail);
|
||||
code_p->u.sla.s = emit_count(-Signed(RealEnvSize)-3*sizeof(CELL));
|
||||
code_p->u.sla.bmap = NULL;
|
||||
code_p->u.sla.sla_u.p =
|
||||
code_p->u.sla.p0 =
|
||||
code_p->u.sbpp.s = emit_count(-Signed(RealEnvSize)-3*sizeof(CELL));
|
||||
code_p->u.sbpp.bmap = NULL;
|
||||
code_p->u.sbpp.p =
|
||||
code_p->u.sbpp.p0 =
|
||||
RepPredProp(PredPropByFunc(FunctorComma,0));
|
||||
GONEXT(sla);
|
||||
GONEXT(sbpp);
|
||||
}
|
||||
}
|
||||
|
@ -515,8 +515,8 @@ dogc(void)
|
||||
{
|
||||
UInt arity;
|
||||
|
||||
if (P && PREVOP(P,sla)->opc == Yap_opcode(_call_usercpred)) {
|
||||
arity = PREVOP(P,sla)->u.sla.sla_u.p->ArityOfPE;
|
||||
if (P && PREVOP(P,sbpp)->opc == Yap_opcode(_call_usercpred)) {
|
||||
arity = PREVOP(P,sbpp)->u.sbpp.p->ArityOfPE;
|
||||
} else {
|
||||
arity = 0;
|
||||
}
|
||||
@ -531,8 +531,8 @@ doexpand(UInt sz)
|
||||
{
|
||||
UInt arity;
|
||||
|
||||
if (P && PREVOP(P,sla)->opc == Yap_opcode(_call_usercpred)) {
|
||||
arity = PREVOP(P,sla)->u.sla.sla_u.p->ArityOfPE;
|
||||
if (P && PREVOP(P,sbpp)->opc == Yap_opcode(_call_usercpred)) {
|
||||
arity = PREVOP(P,sbpp)->u.sbpp.p->ArityOfPE;
|
||||
} else {
|
||||
arity = 0;
|
||||
}
|
||||
@ -950,7 +950,7 @@ YAP_ExtraSpaceCut(void)
|
||||
void *ptr;
|
||||
BACKUP_B();
|
||||
|
||||
ptr = (void *)(((CELL *)(Yap_REGS.CUT_C_TOP))-(((yamop *)Yap_REGS.CUT_C_TOP->try_userc_cut_yamop)->u.lds.extra));
|
||||
ptr = (void *)(((CELL *)(Yap_REGS.CUT_C_TOP))-(((yamop *)Yap_REGS.CUT_C_TOP->try_userc_cut_yamop)->u.apFs.extra));
|
||||
|
||||
RECOVER_B();
|
||||
return(ptr);
|
||||
@ -965,7 +965,7 @@ YAP_ExtraSpace(void)
|
||||
BACKUP_H();
|
||||
|
||||
/* find a pointer to extra space allocable */
|
||||
ptr = (void *)((CELL *)(B+1)+P->u.lds.s);
|
||||
ptr = (void *)((CELL *)(B+1)+P->u.apFs.s);
|
||||
B->cp_h = H;
|
||||
|
||||
RECOVER_H();
|
||||
|
235
C/cdmgr.c
235
C/cdmgr.c
@ -546,7 +546,7 @@ PredForChoicePt(yamop *p_code) {
|
||||
break;
|
||||
case _retry_me:
|
||||
case _trust_me:
|
||||
return p_code->u.ld.p;
|
||||
return p_code->u.apl.p;
|
||||
case _try_logical:
|
||||
case _retry_logical:
|
||||
case _trust_logical:
|
||||
@ -554,7 +554,7 @@ PredForChoicePt(yamop *p_code) {
|
||||
case _count_trust_logical:
|
||||
case _profiled_retry_logical:
|
||||
case _profiled_trust_logical:
|
||||
return p_code->u.lld.d->ClPred;
|
||||
return p_code->u.aLl.d->ClPred;
|
||||
#ifdef TABLING
|
||||
case _trie_retry_null:
|
||||
case _trie_trust_null:
|
||||
@ -583,17 +583,17 @@ PredForChoicePt(yamop *p_code) {
|
||||
/* compile error --> return ENV_ToP(gc_B->cp_cp); */
|
||||
#endif /* TABLING */
|
||||
case _or_else:
|
||||
if (p_code == p_code->u.sla.sla_u.l) {
|
||||
if (p_code == p_code->u.sblp.l) {
|
||||
/* repeat */
|
||||
Atom at = Yap_LookupAtom("repeat ");
|
||||
return RepPredProp(PredPropByAtom(at, PROLOG_MODULE));
|
||||
} else {
|
||||
return p_code->u.sla.p0;
|
||||
return p_code->u.sblp.p0;
|
||||
}
|
||||
break;
|
||||
case _or_last:
|
||||
#ifdef YAPOR
|
||||
return p_code->u.sla.p0;
|
||||
return p_code->u.sblp.p0;
|
||||
#else
|
||||
return p_code->u.p.p;
|
||||
#endif /* YAPOR */
|
||||
@ -606,7 +606,7 @@ PredForChoicePt(yamop *p_code) {
|
||||
p_code = NEXTOP(p_code,l);
|
||||
break;
|
||||
default:
|
||||
return p_code->u.ld.p;
|
||||
return p_code->u.apl.p;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@ -1014,29 +1014,29 @@ static yamop *
|
||||
release_wcls(yamop *cop, OPCODE ecs)
|
||||
{
|
||||
if (cop->opc == ecs) {
|
||||
cop->u.sp.s3--;
|
||||
if (!cop->u.sp.s3) {
|
||||
UInt sz = (UInt)NEXTOP((yamop *)NULL,sp)+cop->u.sp.s1*sizeof(yamop *);
|
||||
cop->u.sssllp.s3--;
|
||||
if (!cop->u.sssllp.s3) {
|
||||
UInt sz = (UInt)NEXTOP((yamop *)NULL,sssllp)+cop->u.sssllp.s1*sizeof(yamop *);
|
||||
LOCK(ExpandClausesListLock);
|
||||
#ifdef DEBUG
|
||||
Yap_expand_clauses_sz -= sz;
|
||||
Yap_ExpandClauses--;
|
||||
#endif
|
||||
if (cop->u.sp.p->PredFlags & LogUpdatePredFlag) {
|
||||
if (cop->u.sssllp.p->PredFlags & LogUpdatePredFlag) {
|
||||
Yap_LUIndexSpace_EXT -= sz;
|
||||
} else {
|
||||
Yap_IndexSpace_EXT -= sz;
|
||||
}
|
||||
if (ExpandClausesFirst == cop)
|
||||
ExpandClausesFirst = cop->u.sp.snext;
|
||||
ExpandClausesFirst = cop->u.sssllp.snext;
|
||||
if (ExpandClausesLast == cop) {
|
||||
ExpandClausesLast = cop->u.sp.sprev;
|
||||
ExpandClausesLast = cop->u.sssllp.sprev;
|
||||
}
|
||||
if (cop->u.sp.sprev) {
|
||||
cop->u.sp.sprev->u.sp.snext = cop->u.sp.snext;
|
||||
if (cop->u.sssllp.sprev) {
|
||||
cop->u.sssllp.sprev->u.sssllp.snext = cop->u.sssllp.snext;
|
||||
}
|
||||
if (cop->u.sp.snext) {
|
||||
cop->u.sp.snext->u.sp.sprev = cop->u.sp.sprev;
|
||||
if (cop->u.sssllp.snext) {
|
||||
cop->u.sssllp.snext->u.sssllp.sprev = cop->u.sssllp.sprev;
|
||||
}
|
||||
UNLOCK(ExpandClausesListLock);
|
||||
Yap_InformOfRemoval((CODEADDR)cop);
|
||||
@ -1084,8 +1084,8 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
|
||||
break;
|
||||
case _retry:
|
||||
case _trust:
|
||||
decrease_ref_counter(ipc->u.ld.d, beg, end, suspend_code);
|
||||
ipc = NEXTOP(ipc,ld);
|
||||
decrease_ref_counter(ipc->u.apl.d, beg, end, suspend_code);
|
||||
ipc = NEXTOP(ipc,apl);
|
||||
break;
|
||||
case _try_clause:
|
||||
case _try_me:
|
||||
@ -1093,7 +1093,7 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
|
||||
case _profiled_trust_me:
|
||||
case _trust_me:
|
||||
case _count_trust_me:
|
||||
ipc = NEXTOP(ipc,ld);
|
||||
ipc = NEXTOP(ipc,apl);
|
||||
break;
|
||||
case _try_logical:
|
||||
case _retry_logical:
|
||||
@ -1101,9 +1101,9 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
|
||||
case _profiled_retry_logical:
|
||||
{
|
||||
yamop *oipc = ipc;
|
||||
decrease_ref_counter(ipc->u.lld.d->ClCode, beg, end, suspend_code);
|
||||
ipc = ipc->u.lld.n;
|
||||
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop *)NULL,lld);
|
||||
decrease_ref_counter(ipc->u.aLl.d->ClCode, beg, end, suspend_code);
|
||||
ipc = ipc->u.aLl.n;
|
||||
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop *)NULL,aLl);
|
||||
Yap_FreeCodeSpace((ADDR)oipc);
|
||||
#ifdef DEBUG
|
||||
Yap_DirtyCps--;
|
||||
@ -1118,23 +1118,23 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
|
||||
Yap_DirtyCps--;
|
||||
Yap_FreedCps++;
|
||||
#endif
|
||||
decrease_ref_counter(ipc->u.lld.d->ClCode, beg, end, suspend_code);
|
||||
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop *)NULL,lld);
|
||||
decrease_ref_counter(ipc->u.ILl.d->ClCode, beg, end, suspend_code);
|
||||
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop *)NULL,ILl);
|
||||
Yap_FreeCodeSpace((ADDR)ipc);
|
||||
return;
|
||||
case _enter_lu_pred:
|
||||
{
|
||||
yamop *oipc = ipc;
|
||||
if (ipc->u.Ill.I->ClFlags & InUseMask || ipc->u.Ill.I->ClRefCount)
|
||||
if (ipc->u.Ills.I->ClFlags & InUseMask || ipc->u.Ills.I->ClRefCount)
|
||||
return;
|
||||
#ifdef DEBUG
|
||||
Yap_DirtyCps+=ipc->u.Ill.s;
|
||||
Yap_LiveCps-=ipc->u.Ill.s;
|
||||
Yap_DirtyCps+=ipc->u.Ills.s;
|
||||
Yap_LiveCps-=ipc->u.Ills.s;
|
||||
#endif
|
||||
ipc = ipc->u.Ill.l1;
|
||||
ipc = ipc->u.Ills.l1;
|
||||
/* in case we visit again */
|
||||
oipc->u.Ill.l1 = FAILCODE;
|
||||
oipc->u.Ill.s = 0;
|
||||
oipc->u.Ills.l1 = FAILCODE;
|
||||
oipc->u.Ills.s = 0;
|
||||
}
|
||||
break;
|
||||
case _try_in:
|
||||
@ -1637,12 +1637,12 @@ add_first_dynamic(PredEntry *p, yamop *cp, int spy_flag)
|
||||
/* allocate starter block, containing info needed to start execution,
|
||||
* that is a try_mark to start the code and a fail to finish things up */
|
||||
cl =
|
||||
(DynamicClause *) Yap_AllocCodeSpace((Int)NEXTOP(NEXTOP(NEXTOP(ncp,ld),e),l));
|
||||
(DynamicClause *) Yap_AllocCodeSpace((Int)NEXTOP(NEXTOP(NEXTOP(ncp,apl),e),l));
|
||||
if (cl == NIL) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"Heap crashed against Stacks");
|
||||
return;
|
||||
}
|
||||
Yap_ClauseSpace += (Int)NEXTOP(NEXTOP(NEXTOP(ncp,ld),e),l);
|
||||
Yap_ClauseSpace += (Int)NEXTOP(NEXTOP(NEXTOP(ncp,apl),e),l);
|
||||
/* skip the first entry, this contains the back link and will always be
|
||||
empty for this entry */
|
||||
ncp = (yamop *)(((CELL *)ncp)+1);
|
||||
@ -1658,9 +1658,9 @@ add_first_dynamic(PredEntry *p, yamop *cp, int spy_flag)
|
||||
p->OpcodeOfPred = ncp->opc = Yap_opcode(_spy_or_trymark);
|
||||
else
|
||||
p->OpcodeOfPred = ncp->opc = Yap_opcode(_try_and_mark);
|
||||
ncp->u.ld.s = p->ArityOfPE;
|
||||
ncp->u.ld.p = p;
|
||||
ncp->u.ld.d = cp;
|
||||
ncp->u.apl.s = p->ArityOfPE;
|
||||
ncp->u.apl.p = p;
|
||||
ncp->u.apl.d = cp;
|
||||
/* This is the point we enter the code */
|
||||
p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = ncp;
|
||||
p->cs.p_code.NOfClauses = 1;
|
||||
@ -1679,9 +1679,9 @@ add_first_dynamic(PredEntry *p, yamop *cp, int spy_flag)
|
||||
cp->opc = Yap_opcode(_count_retry_and_mark);
|
||||
else
|
||||
cp->opc = Yap_opcode(_retry_and_mark);
|
||||
cp->u.ld.s = p->ArityOfPE;
|
||||
cp->u.ld.p = p;
|
||||
cp->u.ld.d = ncp;
|
||||
cp->u.apl.s = p->ArityOfPE;
|
||||
cp->u.apl.p = p;
|
||||
cp->u.apl.d = ncp;
|
||||
/* also, keep a backpointer for the days you delete the clause */
|
||||
ClauseCodeToDynamicClause(cp)->ClPrevious = ncp;
|
||||
/* Don't forget to say who is the only clause for the predicate so
|
||||
@ -1689,7 +1689,7 @@ add_first_dynamic(PredEntry *p, yamop *cp, int spy_flag)
|
||||
p->cs.p_code.LastClause = p->cs.p_code.FirstClause = cp;
|
||||
/* we're only missing what to do when we actually exit the procedure
|
||||
*/
|
||||
ncp = NEXTOP(ncp,ld);
|
||||
ncp = NEXTOP(ncp,apl);
|
||||
/* and the last instruction to execute to exit the predicate, note
|
||||
the retry is pointing to this pseudo clause */
|
||||
ncp->opc = Yap_opcode(_trust_fail);
|
||||
@ -1741,7 +1741,7 @@ asserta_stat_clause(PredEntry *p, yamop *q, int spy_flag)
|
||||
p->OpcodeOfPred = INDEX_OPCODE;
|
||||
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||
}
|
||||
p->cs.p_code.LastClause->u.ld.d = q;
|
||||
p->cs.p_code.LastClause->u.apl.d = q;
|
||||
}
|
||||
|
||||
/* p is already locked */
|
||||
@ -1757,22 +1757,22 @@ asserta_dynam_clause(PredEntry *p, yamop *cp)
|
||||
cl->ClPrevious = (yamop *)(p->CodeOfPred);
|
||||
cl->ClFlags |= DynamicMask;
|
||||
UNLOCK(ClauseCodeToDynamicClause(p->cs.p_code.FirstClause)->ClLock);
|
||||
q->u.ld.d = p->cs.p_code.FirstClause;
|
||||
q->u.ld.s = p->ArityOfPE;
|
||||
q->u.ld.p = p;
|
||||
q->u.apl.d = p->cs.p_code.FirstClause;
|
||||
q->u.apl.s = p->ArityOfPE;
|
||||
q->u.apl.p = p;
|
||||
if (p->PredFlags & ProfiledPredFlag)
|
||||
cp->opc = Yap_opcode(_profiled_retry_and_mark);
|
||||
else if (p->PredFlags & CountPredFlag)
|
||||
cp->opc = Yap_opcode(_count_retry_and_mark);
|
||||
else
|
||||
cp->opc = Yap_opcode(_retry_and_mark);
|
||||
cp->u.ld.s = p->ArityOfPE;
|
||||
cp->u.ld.p = p;
|
||||
cp->u.apl.s = p->ArityOfPE;
|
||||
cp->u.apl.p = p;
|
||||
p->cs.p_code.FirstClause = cp;
|
||||
q = p->CodeOfPred;
|
||||
q->u.ld.d = cp;
|
||||
q->u.ld.s = p->ArityOfPE;
|
||||
q->u.ld.p = p;
|
||||
q->u.apl.d = cp;
|
||||
q->u.apl.s = p->ArityOfPE;
|
||||
q->u.apl.p = p;
|
||||
|
||||
}
|
||||
|
||||
@ -1830,7 +1830,7 @@ assertz_dynam_clause(PredEntry *p, yamop *cp)
|
||||
|
||||
q = p->cs.p_code.LastClause;
|
||||
LOCK(ClauseCodeToDynamicClause(q)->ClLock);
|
||||
q->u.ld.d = cp;
|
||||
q->u.apl.d = cp;
|
||||
p->cs.p_code.LastClause = cp;
|
||||
/* also, keep backpointers for the days we'll delete all the clause */
|
||||
cl->ClPrevious = q;
|
||||
@ -1843,9 +1843,9 @@ assertz_dynam_clause(PredEntry *p, yamop *cp)
|
||||
q->opc = Yap_opcode(_count_retry_and_mark);
|
||||
else
|
||||
q->opc = Yap_opcode(_retry_and_mark);
|
||||
q->u.ld.d = p->CodeOfPred;
|
||||
q->u.ld.s = p->ArityOfPE;
|
||||
q->u.ld.p = p;
|
||||
q->u.apl.d = p->CodeOfPred;
|
||||
q->u.apl.s = p->ArityOfPE;
|
||||
q->u.apl.p = p;
|
||||
p->cs.p_code.NOfClauses++;
|
||||
}
|
||||
|
||||
@ -3202,16 +3202,16 @@ search_for_static_predicate_in_use(PredEntry *p, int check_everything)
|
||||
if (p->PredFlags & LogUpdatePredFlag) {
|
||||
LogUpdIndex *cl = ClauseCodeToLogUpdIndex(code_beg);
|
||||
if (find_owner_log_index(cl, code_p))
|
||||
b_ptr->cp_ap = cur_log_upd_clause(pe, b_ptr->cp_ap->u.ld.d);
|
||||
b_ptr->cp_ap = cur_log_upd_clause(pe, b_ptr->cp_ap->u.apl.d);
|
||||
} else if (p->PredFlags & MegaClausePredFlag) {
|
||||
StaticIndex *cl = ClauseCodeToStaticIndex(code_beg);
|
||||
if (find_owner_static_index(cl, code_p))
|
||||
b_ptr->cp_ap = cur_clause(pe, b_ptr->cp_ap->u.ld.d);
|
||||
b_ptr->cp_ap = cur_clause(pe, b_ptr->cp_ap->u.apl.d);
|
||||
} else {
|
||||
/* static clause */
|
||||
StaticIndex *cl = ClauseCodeToStaticIndex(code_beg);
|
||||
if (find_owner_static_index(cl, code_p)) {
|
||||
b_ptr->cp_ap = cur_clause(pe, b_ptr->cp_ap->u.ld.d);
|
||||
b_ptr->cp_ap = cur_clause(pe, b_ptr->cp_ap->u.apl.d);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3797,19 +3797,19 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _table_answer_resolution:
|
||||
case _table_completion:
|
||||
#endif /* TABLING */
|
||||
pc = NEXTOP(pc,ld);
|
||||
pc = NEXTOP(pc, apl);
|
||||
break;
|
||||
case _try_logical:
|
||||
case _retry_logical:
|
||||
case _count_retry_logical:
|
||||
case _profiled_retry_logical:
|
||||
pc = pc->u.lld.n;
|
||||
pc = pc->u.aLl.n;
|
||||
break;
|
||||
case _trust_logical:
|
||||
case _count_trust_logical:
|
||||
case _profiled_trust_logical:
|
||||
{
|
||||
LogUpdIndex *cl = pc->u.lld.t.block;
|
||||
LogUpdIndex *cl = pc->u.ILl.block;
|
||||
pp = cl->ClPred;
|
||||
*startp = (CODEADDR)cl;
|
||||
*endp = (CODEADDR)cl+cl->ClSize;
|
||||
@ -3817,7 +3817,7 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
}
|
||||
case _enter_lu_pred:
|
||||
{
|
||||
LogUpdIndex *cl = pc->u.Ill.I;
|
||||
LogUpdIndex *cl = pc->u.Ills.I;
|
||||
pp = cl->ClPred;
|
||||
*startp = (CODEADDR)cl;
|
||||
*endp = (CODEADDR)cl+cl->ClSize;
|
||||
@ -3873,7 +3873,7 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
/* instructions type EC */
|
||||
case _alloc_for_logical_pred:
|
||||
{
|
||||
LogUpdClause *cl = pc->u.EC.ClBase;
|
||||
LogUpdClause *cl = pc->u.L.ClBase;
|
||||
|
||||
*startp = (CODEADDR)cl;
|
||||
*endp = (CODEADDR)cl+cl->ClSize;
|
||||
@ -3967,7 +3967,7 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _write_x_loc:
|
||||
pc = NEXTOP(pc,x);
|
||||
break;
|
||||
/* instructions type xF */
|
||||
/* instructions type xl */
|
||||
case _p_atom_x:
|
||||
case _p_atomic_x:
|
||||
case _p_integer_x:
|
||||
@ -3979,7 +3979,7 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _p_compound_x:
|
||||
case _p_float_x:
|
||||
case _p_cut_by_x:
|
||||
pc = NEXTOP(pc,xF);
|
||||
pc = NEXTOP(pc,xl);
|
||||
break;
|
||||
/* instructions type y */
|
||||
case _save_b_y:
|
||||
@ -3989,7 +3989,7 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _write_y_loc:
|
||||
pc = NEXTOP(pc,y);
|
||||
break;
|
||||
/* instructions type yF */
|
||||
/* instructions type yl */
|
||||
case _p_atom_y:
|
||||
case _p_atomic_y:
|
||||
case _p_integer_y:
|
||||
@ -4001,9 +4001,9 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _p_compound_y:
|
||||
case _p_float_y:
|
||||
case _p_cut_by_y:
|
||||
pc = NEXTOP(pc,yF);
|
||||
pc = NEXTOP(pc,yl);
|
||||
break;
|
||||
/* instructions type sla */
|
||||
/* instructions type sbpp or sbmp */
|
||||
case _p_execute_tail:
|
||||
case _p_execute:
|
||||
case _p_execute2:
|
||||
@ -4018,17 +4018,21 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _or_last:
|
||||
#endif
|
||||
clause_code = TRUE;
|
||||
pp = pc->u.sla.sla_u.p;
|
||||
pc = NEXTOP(pc,sla);
|
||||
pp = pc->u.sbpp.p;
|
||||
pc = NEXTOP(pc,sbpp);
|
||||
break;
|
||||
/* instructions type sla, but for disjunctions */
|
||||
/* instructions type sbpp, but for disjunctions */
|
||||
case _either:
|
||||
case _or_else:
|
||||
clause_code = TRUE;
|
||||
pp = pc->u.sblp.p0;
|
||||
pc = NEXTOP(pc,sblp);
|
||||
break;
|
||||
case _call_cpred:
|
||||
case _call_usercpred:
|
||||
clause_code = TRUE;
|
||||
pp = pc->u.sla.p0;
|
||||
pc = NEXTOP(pc,sla);
|
||||
pp = pc->u.sbpp.p0;
|
||||
pc = NEXTOP(pc,sbpp);
|
||||
break;
|
||||
/* instructions type xx */
|
||||
case _get_x_var:
|
||||
@ -4088,10 +4092,10 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _get_6atoms:
|
||||
pc = NEXTOP(pc,cccccc);
|
||||
break;
|
||||
/* instructions type xf */
|
||||
/* instructions type xfa */
|
||||
case _get_struct:
|
||||
case _put_struct:
|
||||
pc = NEXTOP(pc,xf);
|
||||
pc = NEXTOP(pc,xfa);
|
||||
break;
|
||||
/* instructions type xy */
|
||||
case _glist_valy:
|
||||
@ -4196,7 +4200,7 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _unify_struct:
|
||||
case _unify_l_struc_write:
|
||||
case _unify_l_struc:
|
||||
pc = NEXTOP(pc,of);
|
||||
pc = NEXTOP(pc,ofa);
|
||||
break;
|
||||
/* instructions type s */
|
||||
case _write_n_voids:
|
||||
@ -4228,22 +4232,22 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
/* instructions type f */
|
||||
case _write_struct:
|
||||
case _write_l_struc:
|
||||
pc = NEXTOP(pc,f);
|
||||
pc = NEXTOP(pc,fa);
|
||||
break;
|
||||
/* instructions type sdl */
|
||||
/* instructions type sdlp */
|
||||
case _call_c_wfail:
|
||||
clause_code = TRUE;
|
||||
pp = pc->u.sdl.p;
|
||||
pc = NEXTOP(pc,sdl);
|
||||
pp = pc->u.sdlp.p;
|
||||
pc = NEXTOP(pc,sdlp);
|
||||
break;
|
||||
/* instructions type lds */
|
||||
/* instructions type apFs */
|
||||
case _try_c:
|
||||
case _try_userc:
|
||||
case _retry_c:
|
||||
case _retry_userc:
|
||||
clause_code = TRUE;
|
||||
pp = pc->u.lds.p;
|
||||
pc = NEXTOP(pc,lds);
|
||||
pp = pc->u.apFs.p;
|
||||
pc = NEXTOP(pc,apFs);
|
||||
break;
|
||||
#ifdef CUT_C
|
||||
case _cut_c:
|
||||
@ -4315,16 +4319,16 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
case _p_slr_cv:
|
||||
case _p_arg_cv:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,xcx);
|
||||
pc = NEXTOP(pc,xxc);
|
||||
break;
|
||||
case _p_func2s_cv:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,xcx);
|
||||
pc = NEXTOP(pc,xxc);
|
||||
break;
|
||||
/* instructions type xyx */
|
||||
/* instructions type xxy */
|
||||
case _p_func2f_xy:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,xyx);
|
||||
pc = NEXTOP(pc,xxy);
|
||||
break;
|
||||
/* instructions type yxx */
|
||||
case _p_plus_y_vv:
|
||||
@ -4360,32 +4364,33 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,yxc);
|
||||
break;
|
||||
/* instructions type ycx */
|
||||
/* instructions type yxc */
|
||||
case _p_sll_y_cv:
|
||||
case _p_slr_y_cv:
|
||||
case _p_arg_y_cv:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,ycx);
|
||||
pc = NEXTOP(pc,yxc);
|
||||
break;
|
||||
/* instructions type ycx */
|
||||
/* instructions type yxc */
|
||||
case _p_func2s_y_cv:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,ycx);
|
||||
pc = NEXTOP(pc,yxc);
|
||||
break;
|
||||
/* instructions type llxx */
|
||||
/* instructions type plxxs */
|
||||
case _call_bfunc_xx:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,llxx);
|
||||
pc = NEXTOP(pc,plxxs);
|
||||
break;
|
||||
/* instructions type llxy */
|
||||
/* instructions type plxys */
|
||||
case _call_bfunc_yx:
|
||||
case _call_bfunc_xy:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,llxy);
|
||||
pc = NEXTOP(pc,plxys);
|
||||
break;
|
||||
/* instructions type plyys */
|
||||
case _call_bfunc_yy:
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,llyy);
|
||||
pc = NEXTOP(pc,plyys);
|
||||
break;
|
||||
case _expand_index:
|
||||
pp = ((PredEntry *)(Unsigned(pc)-(CELL)(&(((PredEntry *)NULL)->cs.p_code.ExpandCode))));
|
||||
@ -4404,10 +4409,10 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
|
||||
return pp;
|
||||
case _expand_clauses:
|
||||
/* expansion points may not be found when following the indices tree */
|
||||
pp = codeptr->u.sp.p;
|
||||
pp = codeptr->u.sssllp.p;
|
||||
if (pc == codeptr) {
|
||||
*startp = (CODEADDR)codeptr;
|
||||
*endp = (CODEADDR)NEXTOP(codeptr,sp);
|
||||
*endp = (CODEADDR)NEXTOP(codeptr,sssllp);
|
||||
}
|
||||
return pp;
|
||||
case _op_fail:
|
||||
@ -4895,7 +4900,7 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya
|
||||
Terms[0] = th;
|
||||
Terms[1] = tb;
|
||||
Terms[2] = tr;
|
||||
cl = Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredLogUpdClause->CodeOfPred,ld), cp_ptr);
|
||||
cl = Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredLogUpdClause->CodeOfPred,apl), cp_ptr);
|
||||
th = Terms[0];
|
||||
tb = Terms[1];
|
||||
tr = Terms[2];
|
||||
@ -5028,7 +5033,7 @@ fetch_next_lu_clause_erase(PredEntry *pe, yamop *i_code, Term th, Term tb, Term
|
||||
Terms[0] = th;
|
||||
Terms[1] = tb;
|
||||
Terms[2] = tr;
|
||||
cl = Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredLogUpdClauseErase->CodeOfPred,ld), cp_ptr);
|
||||
cl = Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredLogUpdClauseErase->CodeOfPred,apl), cp_ptr);
|
||||
th = Terms[0];
|
||||
tb = Terms[1];
|
||||
tr = Terms[2];
|
||||
@ -5165,7 +5170,7 @@ fetch_next_lu_clause0(PredEntry *pe, yamop *i_code, Term th, Term tb, yamop *cp_
|
||||
Terms[0] = th;
|
||||
Terms[1] = tb;
|
||||
Terms[2] = TermNil;
|
||||
cl = Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredLogUpdClause0->CodeOfPred,ld), cp_ptr);
|
||||
cl = Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredLogUpdClause0->CodeOfPred,apl), cp_ptr);
|
||||
th = Terms[0];
|
||||
tb = Terms[1];
|
||||
/* don't do this!! I might have stored a choice-point and changed ASP
|
||||
@ -5307,9 +5312,9 @@ void /* $hidden_predicate(P) */
|
||||
Yap_UpdateTimestamps(PredEntry *ap)
|
||||
{
|
||||
choiceptr bptr = B;
|
||||
yamop *cl0 = NEXTOP(PredLogUpdClause0->CodeOfPred,ld);
|
||||
yamop *cl = NEXTOP(PredLogUpdClause->CodeOfPred,ld);
|
||||
yamop *cle = NEXTOP(PredLogUpdClauseErase->CodeOfPred,ld);
|
||||
yamop *cl0 = NEXTOP(PredLogUpdClause0->CodeOfPred,apl);
|
||||
yamop *cl = NEXTOP(PredLogUpdClause->CodeOfPred,apl);
|
||||
yamop *cle = NEXTOP(PredLogUpdClauseErase->CodeOfPred,apl);
|
||||
UInt ar = ap->ArityOfPE;
|
||||
UInt *arp, *top, *base;
|
||||
LogUpdClause *lcl;
|
||||
@ -5333,7 +5338,7 @@ Yap_UpdateTimestamps(PredEntry *ap)
|
||||
case _trust_logical:
|
||||
case _count_trust_logical:
|
||||
case _profiled_trust_logical:
|
||||
if (bptr->cp_ap->u.lld.d->ClPred == ap) {
|
||||
if (bptr->cp_ap->u.aLl.d->ClPred == ap) {
|
||||
UInt ts = IntegerOfTerm(bptr->cp_args[ar]);
|
||||
if (ts != arp[0]) {
|
||||
if (arp-H < 1024) {
|
||||
@ -5397,7 +5402,7 @@ Yap_UpdateTimestamps(PredEntry *ap)
|
||||
case _trust_logical:
|
||||
case _count_trust_logical:
|
||||
case _profiled_trust_logical:
|
||||
if (bptr->cp_ap->u.lld.d->ClPred == ap) {
|
||||
if (bptr->cp_ap->u.aLl.d->ClPred == ap) {
|
||||
UInt ts = IntegerOfTerm(bptr->cp_args[ar]);
|
||||
while (ts != arp[0])
|
||||
arp--;
|
||||
@ -5439,7 +5444,7 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr
|
||||
Terms[0] = th;
|
||||
Terms[1] = tb;
|
||||
Terms[2] = tr;
|
||||
cl = (StaticClause *)Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredStaticClause->CodeOfPred,ld), cp_ptr);
|
||||
cl = (StaticClause *)Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredStaticClause->CodeOfPred,apl), cp_ptr);
|
||||
UNLOCK(pe->PELock);
|
||||
th = Terms[0];
|
||||
tb = Terms[1];
|
||||
@ -5954,7 +5959,7 @@ p_env_info(void)
|
||||
env_b = MkIntegerTerm((Int)(LCL0-(CELL *)env[E_CB]));
|
||||
env_cp = (yamop *)env[E_CP];
|
||||
|
||||
pe = PREVOP(env_cp,sla)->u.sla.p0;
|
||||
pe = PREVOP(env_cp,sbpp)->u.sbpp.p0;
|
||||
taddr = MkIntegerTerm((Int)env);
|
||||
return Yap_unify(ARG3,MkIntegerTerm((Int)env_cp)) &&
|
||||
Yap_unify(ARG2, taddr) &&
|
||||
@ -5967,7 +5972,7 @@ p_cpc_info(void)
|
||||
PredEntry *pe;
|
||||
yamop *ipc = (yamop *)IntegerOfTerm(Deref(ARG1));
|
||||
|
||||
pe = PREVOP(ipc,sla)->u.sla.p0;
|
||||
pe = PREVOP(ipc,sbpp)->u.sbpp.p0;
|
||||
return UnifyPredInfo(pe, 2) &&
|
||||
Yap_unify(ARG5,MkIntegerTerm(ClauseId(ipc,pe)));
|
||||
}
|
||||
@ -6047,12 +6052,12 @@ p_choicepoint_info(void)
|
||||
case _count_trust_logical:
|
||||
case _profiled_retry_logical:
|
||||
case _profiled_trust_logical:
|
||||
ncl = ipc->u.lld.d->ClCode;
|
||||
pe = ipc->u.lld.d->ClPred;
|
||||
ncl = ipc->u.aLl.d->ClCode;
|
||||
pe = ipc->u.aLl.d->ClPred;
|
||||
t = BuildActivePred(pe, cptr->cp_args);
|
||||
break;
|
||||
case _or_else:
|
||||
pe = ipc->u.sla.p0;
|
||||
pe = ipc->u.sblp.p0;
|
||||
ncl = ipc;
|
||||
t = Yap_MkNewApplTerm(FunctorOr, 2);
|
||||
break;
|
||||
@ -6068,7 +6073,7 @@ p_choicepoint_info(void)
|
||||
t = TermNil;
|
||||
ipc = NEXTOP(ipc,l);
|
||||
if (!ncl)
|
||||
ncl = ipc->u.ld.d;
|
||||
ncl = ipc->u.apl.d;
|
||||
go_on = TRUE;
|
||||
break;
|
||||
case _jump:
|
||||
@ -6079,15 +6084,15 @@ p_choicepoint_info(void)
|
||||
break;
|
||||
case _retry_c:
|
||||
case _retry_userc:
|
||||
ncl = ipc->u.ld.d;
|
||||
pe = ipc->u.lds.p;
|
||||
ncl = NEXTOP(ipc,apFs);
|
||||
pe = ipc->u.apFs.p;
|
||||
t = BuildActivePred(pe, cptr->cp_args);
|
||||
break;
|
||||
case _retry_profiled:
|
||||
case _count_retry:
|
||||
pe = NULL;
|
||||
t = TermNil;
|
||||
ncl = ipc->u.ld.d;
|
||||
ncl = ipc->u.apl.d;
|
||||
ipc = NEXTOP(ipc,p);
|
||||
go_on = TRUE;
|
||||
break;
|
||||
@ -6102,8 +6107,8 @@ p_choicepoint_info(void)
|
||||
case _retry:
|
||||
case _trust:
|
||||
if (!ncl)
|
||||
ncl = ipc->u.ld.d;
|
||||
pe = ipc->u.ld.p;
|
||||
ncl = ipc->u.apl.d;
|
||||
pe = ipc->u.apl.p;
|
||||
t = BuildActivePred(pe, cptr->cp_args);
|
||||
break;
|
||||
case _Nstop:
|
||||
|
39
C/dbase.c
39
C/dbase.c
@ -3696,14 +3696,14 @@ index_sz(LogUpdIndex *x)
|
||||
endop = Yap_opcode(_profiled_trust_logical);
|
||||
else
|
||||
endop = Yap_opcode(_trust_logical);
|
||||
start = start->u.Ill.l1;
|
||||
start = start->u.Ills.l1;
|
||||
do {
|
||||
sz += (UInt)NEXTOP((yamop*)NULL,lld);
|
||||
sz += (UInt)NEXTOP((yamop*)NULL,aLl);
|
||||
op1 = start->opc;
|
||||
count++;
|
||||
if (start->u.lld.d->ClFlags & ErasedMask)
|
||||
if (start->u.aLl.d->ClFlags & ErasedMask)
|
||||
dead++;
|
||||
start = start->u.lld.n;
|
||||
start = start->u.aLl.n;
|
||||
} while (op1 != endop);
|
||||
}
|
||||
x = x->ChildIndex;
|
||||
@ -3989,7 +3989,7 @@ find_next_clause(DBRef ref0)
|
||||
static Int
|
||||
p_jump_to_next_dynamic_clause(void)
|
||||
{
|
||||
DBRef ref = (DBRef)(((yamop *)((CODEADDR)P-(CELL)NEXTOP((yamop *)NULL,sla)))->u.sla.bmap);
|
||||
DBRef ref = (DBRef)(((yamop *)((CODEADDR)P-(CELL)NEXTOP((yamop *)NULL,sbpp)))->u.sbpp.bmap);
|
||||
yamop *newp = find_next_clause(ref);
|
||||
|
||||
if (newp == NULL) {
|
||||
@ -3998,7 +3998,7 @@ p_jump_to_next_dynamic_clause(void)
|
||||
/* the next alternative to try must be obtained from this clause */
|
||||
B->cp_ap = newp;
|
||||
/* and next, enter the clause */
|
||||
P = NEXTOP(newp,ld);
|
||||
P = NEXTOP(newp,apl);
|
||||
/* and return like if nothing had happened. */
|
||||
return TRUE;
|
||||
}
|
||||
@ -4015,11 +4015,6 @@ complete_lu_erase(LogUpdClause *clau)
|
||||
if (CL_IN_USE(clau)) {
|
||||
return;
|
||||
}
|
||||
if (clau->ClFlags & LogUpdRuleMask &&
|
||||
clau->ClExt &&
|
||||
clau->ClExt->u.EC.ClRefs > 0) {
|
||||
return;
|
||||
}
|
||||
#ifndef THREADS
|
||||
if (clau->ClNext)
|
||||
clau->ClNext->ClPrev = clau->ClPrev;
|
||||
@ -4150,20 +4145,20 @@ MyEraseClause(DynamicClause *clau)
|
||||
I don't need to lock the clause at this point because
|
||||
I am the last one using it anyway.
|
||||
*/
|
||||
ref = (DBRef) NEXTOP(clau->ClCode,ld)->u.sla.bmap;
|
||||
ref = (DBRef) NEXTOP(clau->ClCode,apl)->u.sbpp.bmap;
|
||||
/* don't do nothing if the reference is still in use */
|
||||
if (DBREF_IN_USE(ref))
|
||||
return;
|
||||
if ( P == clau->ClCode ) {
|
||||
yamop *np = RTRYCODE;
|
||||
/* make it the next alternative */
|
||||
np->u.ld.d = find_next_clause((DBRef)(NEXTOP(P,ld)->u.sla.bmap));
|
||||
if (np->u.ld.d == NULL)
|
||||
np->u.apl.d = find_next_clause((DBRef)(NEXTOP(P,apl)->u.sbpp.bmap));
|
||||
if (np->u.apl.d == NULL)
|
||||
P = (yamop *)FAILCODE;
|
||||
else {
|
||||
/* with same arity as before */
|
||||
np->u.ld.s = P->u.ld.s;
|
||||
np->u.ld.p = P->u.ld.p;
|
||||
np->u.apl.s = P->u.apl.s;
|
||||
np->u.apl.p = P->u.apl.p;
|
||||
/* go ahead and try this code */
|
||||
P = np;
|
||||
}
|
||||
@ -4213,7 +4208,7 @@ PrepareToEraseLogUpdClause(LogUpdClause *clau, DBRef dbr)
|
||||
if (p->cs.p_code.FirstClause != cl) {
|
||||
/* we are not the first clause... */
|
||||
yamop *prev_code_p = (yamop *)(dbr->Prev->Code);
|
||||
prev_code_p->u.ld.d = code_p->u.ld.d;
|
||||
prev_code_p->u.apl.d = code_p->u.apl.d;
|
||||
/* are we the last? */
|
||||
if (p->cs.p_code.LastClause == cl)
|
||||
p->cs.p_code.LastClause = prev_code_p;
|
||||
@ -4222,7 +4217,7 @@ PrepareToEraseLogUpdClause(LogUpdClause *clau, DBRef dbr)
|
||||
if (p->cs.p_code.LastClause == p->cs.p_code.FirstClause) {
|
||||
p->cs.p_code.LastClause = p->cs.p_code.FirstClause = NULL;
|
||||
} else {
|
||||
p->cs.p_code.FirstClause = code_p->u.ld.d;
|
||||
p->cs.p_code.FirstClause = code_p->u.apl.d;
|
||||
p->cs.p_code.FirstClause->opc =
|
||||
Yap_opcode(_try_me);
|
||||
}
|
||||
@ -4237,8 +4232,8 @@ PrepareToEraseLogUpdClause(LogUpdClause *clau, DBRef dbr)
|
||||
if (p->cs.p_code.FirstClause == p->cs.p_code.LastClause) {
|
||||
if (p->cs.p_code.FirstClause != NULL) {
|
||||
code_p = p->cs.p_code.FirstClause;
|
||||
code_p->u.ld.d = p->cs.p_code.FirstClause;
|
||||
p->cs.p_code.TrueCodeOfPred = NEXTOP(code_p, ld);
|
||||
code_p->u.apl.d = p->cs.p_code.FirstClause;
|
||||
p->cs.p_code.TrueCodeOfPred = NEXTOP(code_p, apl);
|
||||
if (p->PredFlags & SpiedPredFlag) {
|
||||
p->OpcodeOfPred = Yap_opcode(_spy_pred);
|
||||
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
|
||||
@ -5450,9 +5445,9 @@ void
|
||||
Yap_InitBackDB(void)
|
||||
{
|
||||
Yap_InitCPredBack("$recorded_with_key", 3, 3, in_rded_with_key, co_rded, SyncPredFlag|HiddenPredFlag);
|
||||
RETRY_C_RECORDED_K_CODE = NEXTOP(PredRecordedWithKey->cs.p_code.FirstClause,lds);
|
||||
RETRY_C_RECORDED_K_CODE = NEXTOP(PredRecordedWithKey->cs.p_code.FirstClause,apFs);
|
||||
Yap_InitCPredBack("$recordedp", 3, 3, in_rdedp, co_rdedp, SyncPredFlag|HiddenPredFlag);
|
||||
RETRY_C_RECORDEDP_CODE = NEXTOP(RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom("$recordedp"), 3),0))->cs.p_code.FirstClause,lds);
|
||||
RETRY_C_RECORDEDP_CODE = NEXTOP(RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom("$recordedp"), 3),0))->cs.p_code.FirstClause,apFs);
|
||||
Yap_InitCPredBack("$current_immediate_key", 2, 4, init_current_key, cont_current_key,
|
||||
SyncPredFlag|HiddenPredFlag);
|
||||
}
|
||||
|
@ -790,7 +790,7 @@ showprofres(UInt type) {
|
||||
InCCall++; /* I Was in a C Call */
|
||||
pc_ptr=y;
|
||||
/*
|
||||
printf("Aqui está um call_cpred(%p) \n",y->u.sla.sla_u.p->cs.f_code);
|
||||
printf("Aqui está um call_cpred(%p) \n",y->u.sbpp.p->cs.f_code);
|
||||
for(i=0;i<_std_top && pc_ptr->opc!=Yap_ABSMI_OPCODES[i];i++);
|
||||
printf("Outro syscall diferente %s\n", Yap_op_names[i]);
|
||||
*/
|
||||
@ -973,11 +973,11 @@ prof_alrm(int signo, siginfo_t *si, void *scv)
|
||||
current_p = P;
|
||||
#endif
|
||||
} else {
|
||||
op_numbers oop = Yap_op_from_opcode(PREVOP(P,sla)->opc);
|
||||
op_numbers oop = Yap_op_from_opcode(PREVOP(P,sbpp)->opc);
|
||||
|
||||
if (oop == _call_cpred || oop == _call_usercpred) {
|
||||
/* doing C-code */
|
||||
current_p = PREVOP(P,sla)->u.sla.sla_u.p->CodeOfPred;
|
||||
current_p = PREVOP(P,sbpp)->u.sbpp.p->CodeOfPred;
|
||||
} else {
|
||||
current_p = P;
|
||||
}
|
||||
|
62
C/heapgc.c
62
C/heapgc.c
@ -1817,10 +1817,10 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
||||
{
|
||||
OPCODE trust_lu = Yap_opcode(_trust_logical);
|
||||
|
||||
yamop *lu_cl0 = NEXTOP(PredLogUpdClause0->CodeOfPred,ld),
|
||||
*lu_cl = NEXTOP(PredLogUpdClause->CodeOfPred,ld),
|
||||
*lu_cle = NEXTOP(PredLogUpdClauseErase->CodeOfPred,ld),
|
||||
*su_cl = NEXTOP(PredStaticClause->CodeOfPred,ld);
|
||||
yamop *lu_cl0 = NEXTOP(PredLogUpdClause0->CodeOfPred,apl),
|
||||
*lu_cl = NEXTOP(PredLogUpdClause->CodeOfPred,apl),
|
||||
*lu_cle = NEXTOP(PredLogUpdClauseErase->CodeOfPred,apl),
|
||||
*su_cl = NEXTOP(PredStaticClause->CodeOfPred,apl);
|
||||
#ifdef TABLING
|
||||
dep_fr_ptr depfr = LOCAL_top_dep_fr;
|
||||
#endif /* TABLING */
|
||||
@ -1889,13 +1889,8 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
||||
if (opnum == _or_else || opnum == _or_last) {
|
||||
/* ; choice point */
|
||||
mark_environments((CELL_PTR) (gc_B->cp_a1),
|
||||
#ifdef YAPOR
|
||||
-gc_B->cp_cp->u.ldl.s / ((OPREG)sizeof(CELL)),
|
||||
(CELL *)(gc_B->cp_cp->u.ldl.bl)
|
||||
#else
|
||||
-gc_B->cp_cp->u.sla.s / ((OPREG)sizeof(CELL)),
|
||||
gc_B->cp_cp->u.sla.bmap
|
||||
#endif
|
||||
-gc_B->cp_cp->u.sblp.s / ((OPREG)sizeof(CELL)),
|
||||
gc_B->cp_cp->u.sblp.bmap
|
||||
);
|
||||
} else {
|
||||
/* choicepoint with arguments */
|
||||
@ -1943,7 +1938,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
||||
}
|
||||
B = old_b;
|
||||
}
|
||||
nargs = rtp->u.lds.s+rtp->u.lds.extra;
|
||||
nargs = rtp->u.apFs.s+rtp->u.apFs.extra;
|
||||
break;
|
||||
case _jump:
|
||||
rtp = rtp->u.l.l;
|
||||
@ -1980,7 +1975,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
||||
{
|
||||
CELL *vars_ptr, vars;
|
||||
vars_ptr = (CELL *)(GEN_CP(gc_B) + 1);
|
||||
nargs = rtp->u.ld.s;
|
||||
nargs = rtp->u.apl.s;
|
||||
while (nargs--) {
|
||||
mark_external_reference(vars_ptr);
|
||||
vars_ptr++;
|
||||
@ -2096,20 +2091,20 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
||||
on the other hand it's the only way we can be sure we can reclaim
|
||||
space
|
||||
*/
|
||||
yamop *end = rtp->u.lld.n;
|
||||
yamop *end = rtp->u.aLl.n;
|
||||
while (end->opc != trust_lu)
|
||||
end = end->u.lld.n;
|
||||
mark_ref_in_use((DBRef)end->u.lld.t.block);
|
||||
end = end->u.aLl.n;
|
||||
mark_ref_in_use((DBRef)end->u.ILl.block);
|
||||
}
|
||||
/* mark timestamp */
|
||||
nargs = rtp->u.lld.t.s+1;
|
||||
nargs = rtp->u.aLl.s+1;
|
||||
break;
|
||||
case _trust_logical:
|
||||
case _count_trust_logical:
|
||||
case _profiled_trust_logical:
|
||||
/* mark timestamp */
|
||||
mark_ref_in_use((DBRef)rtp->u.lld.t.block);
|
||||
nargs = rtp->u.lld.d->ClPred->ArityOfPE+1;
|
||||
mark_ref_in_use((DBRef)rtp->u.ILl.block);
|
||||
nargs = rtp->u.ILl.d->ClPred->ArityOfPE+1;
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
case _retry_me:
|
||||
@ -2120,14 +2115,14 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
||||
case _count_trust_me:
|
||||
case _retry:
|
||||
case _trust:
|
||||
nargs = rtp->u.ld.s;
|
||||
nargs = rtp->u.apl.s;
|
||||
break;
|
||||
default:
|
||||
fprintf(Yap_stderr, "OOps in GC: Unexpected opcode: %d\n", opnum);
|
||||
nargs = 0;
|
||||
#else
|
||||
default:
|
||||
nargs = rtp->u.ld.s;
|
||||
nargs = rtp->u.apl.s;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2141,8 +2136,8 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
|
||||
mark_db_fixed((CELL *)pt);
|
||||
} else {
|
||||
while (pt->opc != trust_lu)
|
||||
pt = pt->u.lld.n;
|
||||
mark_ref_in_use((DBRef)pt->u.lld.t.block);
|
||||
pt = pt->u.aLl.n;
|
||||
mark_ref_in_use((DBRef)pt->u.ILl.block);
|
||||
}
|
||||
}
|
||||
/* for each saved register */
|
||||
@ -2752,13 +2747,8 @@ sweep_choicepoints(choiceptr gc_B)
|
||||
case _or_last:
|
||||
|
||||
sweep_environments((CELL_PTR)(gc_B->cp_a1),
|
||||
#ifdef YAPOR
|
||||
-gc_B->cp_cp->u.ldl.s / ((OPREG)sizeof(CELL)),
|
||||
(CELL *)(gc_B->cp_cp->u.ldl.bl)
|
||||
#else
|
||||
-gc_B->cp_cp->u.sla.s / ((OPREG)sizeof(CELL)),
|
||||
gc_B->cp_cp->u.sla.bmap
|
||||
#endif
|
||||
-gc_B->cp_cp->u.sblp.s / ((OPREG)sizeof(CELL)),
|
||||
gc_B->cp_cp->u.sblp.bmap
|
||||
);
|
||||
break;
|
||||
case _retry_profiled:
|
||||
@ -2801,7 +2791,7 @@ sweep_choicepoints(choiceptr gc_B)
|
||||
CELL *vars_ptr, vars;
|
||||
sweep_environments(gc_B->cp_env, EnvSize((CELL_PTR) (gc_B->cp_cp)), EnvBMap((CELL_PTR) (gc_B->cp_cp)));
|
||||
vars_ptr = (CELL *)(GEN_CP(gc_B) + 1);
|
||||
nargs = rtp->u.ld.s;
|
||||
nargs = rtp->u.apl.s;
|
||||
while(nargs--) {
|
||||
CELL cp_cell = *vars_ptr;
|
||||
if (MARKED_PTR(vars_ptr)) {
|
||||
@ -2947,12 +2937,12 @@ sweep_choicepoints(choiceptr gc_B)
|
||||
case _count_retry_logical:
|
||||
case _profiled_retry_logical:
|
||||
/* sweep timestamp */
|
||||
sweep_b(gc_B, rtp->u.lld.t.s+1);
|
||||
sweep_b(gc_B, rtp->u.aLl.s+1);
|
||||
break;
|
||||
case _trust_logical:
|
||||
case _count_trust_logical:
|
||||
case _profiled_trust_logical:
|
||||
sweep_b(gc_B, rtp->u.lld.d->ClPred->ArityOfPE+1);
|
||||
sweep_b(gc_B, rtp->u.ILl.d->ClPred->ArityOfPE+1);
|
||||
break;
|
||||
case _retry2:
|
||||
sweep_b(gc_B, 2);
|
||||
@ -2969,8 +2959,8 @@ sweep_choicepoints(choiceptr gc_B)
|
||||
register CELL_PTR saved_reg;
|
||||
|
||||
/* for each extra saved register */
|
||||
for (saved_reg = &(gc_B->cp_a1)+rtp->u.lds.s;
|
||||
saved_reg < &(gc_B->cp_a1)+rtp->u.lds.s+rtp->u.lds.extra;
|
||||
for (saved_reg = &(gc_B->cp_a1)+rtp->u.apFs.s;
|
||||
saved_reg < &(gc_B->cp_a1)+rtp->u.apFs.s+rtp->u.apFs.extra;
|
||||
saved_reg++) {
|
||||
CELL cp_cell = *saved_reg;
|
||||
if (MARKED_PTR(saved_reg)) {
|
||||
@ -2983,7 +2973,7 @@ sweep_choicepoints(choiceptr gc_B)
|
||||
}
|
||||
/* continue to clean environments and arguments */
|
||||
default:
|
||||
sweep_b(gc_B,rtp->u.ld.s);
|
||||
sweep_b(gc_B,rtp->u.apl.s);
|
||||
}
|
||||
|
||||
/* link to prev choicepoint */
|
||||
|
102
C/init.c
102
C/init.c
@ -504,9 +504,9 @@ Yap_InitCPred(char *Name, unsigned long int Arity, CPredicate code, int flags)
|
||||
UInt sz;
|
||||
|
||||
if (flags & SafePredFlag) {
|
||||
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(p_code,sla),p),l);
|
||||
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(p_code,sbpp),p),l);
|
||||
} else {
|
||||
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(NEXTOP(p_code,e),sla),e),p),l);
|
||||
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(NEXTOP(p_code,e),sbpp),e),p),l);
|
||||
}
|
||||
cl = (StaticClause *)Yap_AllocCodeSpace(sz);
|
||||
if (!cl) {
|
||||
@ -535,12 +535,12 @@ Yap_InitCPred(char *Name, unsigned long int Arity, CPredicate code, int flags)
|
||||
p_code->opc = Yap_opcode(_call_usercpred);
|
||||
else
|
||||
p_code->opc = Yap_opcode(_call_cpred);
|
||||
p_code->u.sla.bmap = NULL;
|
||||
p_code->u.sla.s = -Signed(RealEnvSize);
|
||||
p_code->u.sla.sla_u.p =
|
||||
p_code->u.sla.p0 =
|
||||
p_code->u.sbpp.bmap = NULL;
|
||||
p_code->u.sbpp.s = -Signed(RealEnvSize);
|
||||
p_code->u.sbpp.p =
|
||||
p_code->u.sbpp.p0 =
|
||||
pe;
|
||||
p_code = NEXTOP(p_code,sla);
|
||||
p_code = NEXTOP(p_code,sbpp);
|
||||
if (!(flags & SafePredFlag)) {
|
||||
p_code->opc = Yap_opcode(_deallocate);
|
||||
p_code = NEXTOP(p_code,e);
|
||||
@ -571,7 +571,7 @@ Yap_InitCmpPred(char *Name, unsigned long int Arity, CmpPredicate cmp_code, int
|
||||
/* already exists */
|
||||
} else {
|
||||
while (!cl) {
|
||||
UInt sz = sizeof(StaticClause)+(CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)NULL),llxx),p),l);
|
||||
UInt sz = sizeof(StaticClause)+(CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)NULL),plxxs),p),l);
|
||||
cl = (StaticClause *)Yap_AllocCodeSpace(sz);
|
||||
if (!cl) {
|
||||
if (!Yap_growheap(FALSE, sz, NULL)) {
|
||||
@ -594,12 +594,12 @@ Yap_InitCmpPred(char *Name, unsigned long int Arity, CmpPredicate cmp_code, int
|
||||
pe->cs.d_code = cmp_code;
|
||||
pe->ModuleOfPred = CurrentModule;
|
||||
p_code->opc = pe->OpcodeOfPred = Yap_opcode(_call_bfunc_xx);
|
||||
p_code->u.llxx.p = pe;
|
||||
p_code->u.llxx.f = FAILCODE;
|
||||
p_code->u.llxx.x1 = Yap_emit_x(1);
|
||||
p_code->u.llxx.x2 = Yap_emit_x(2);
|
||||
p_code->u.llxx.flags = Yap_compile_cmp_flags(pe);
|
||||
p_code = NEXTOP(p_code,llxx);
|
||||
p_code->u.plxxs.p = pe;
|
||||
p_code->u.plxxs.f = FAILCODE;
|
||||
p_code->u.plxxs.x1 = Yap_emit_x(1);
|
||||
p_code->u.plxxs.x2 = Yap_emit_x(2);
|
||||
p_code->u.plxxs.flags = Yap_compile_cmp_flags(pe);
|
||||
p_code = NEXTOP(p_code,plxxs);
|
||||
p_code->opc = Yap_opcode(_procceed);
|
||||
p_code->u.p.p = pe;
|
||||
p_code = NEXTOP(p_code,p);
|
||||
@ -625,26 +625,26 @@ Yap_InitAsmPred(char *Name, unsigned long int Arity, int code, CPredicate def,
|
||||
StaticClause *cl;
|
||||
|
||||
if (pe->CodeOfPred == (yamop *)(&(pe->OpcodeOfPred))) {
|
||||
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),sla),p),l));
|
||||
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),sbpp),p),l));
|
||||
if (!cl) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitAsmPred");
|
||||
return;
|
||||
}
|
||||
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),sla),p),l);
|
||||
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),sbpp),p),l);
|
||||
} else {
|
||||
cl = ClauseCodeToStaticClause(pe->CodeOfPred);
|
||||
}
|
||||
cl->ClFlags = StaticMask;
|
||||
cl->ClNext = NULL;
|
||||
cl->ClSize = (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),sla),e),e);
|
||||
cl->ClSize = (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),sbpp),e),e);
|
||||
cl->usc.ClPred = pe;
|
||||
p_code = cl->ClCode;
|
||||
pe->CodeOfPred = p_code;
|
||||
p_code->opc = pe->OpcodeOfPred = Yap_opcode(_call_cpred);
|
||||
p_code->u.sla.bmap = NULL;
|
||||
p_code->u.sla.s = -Signed(RealEnvSize);
|
||||
p_code->u.sla.sla_u.p = p_code->u.sla.p0 = pe;
|
||||
p_code = NEXTOP(p_code,sla);
|
||||
p_code->u.sbpp.bmap = NULL;
|
||||
p_code->u.sbpp.s = -Signed(RealEnvSize);
|
||||
p_code->u.sbpp.p = p_code->u.sbpp.p0 = pe;
|
||||
p_code = NEXTOP(p_code,sbpp);
|
||||
p_code->opc = Yap_opcode(_procceed);
|
||||
p_code->u.p.p = pe;
|
||||
p_code = NEXTOP(p_code,p);
|
||||
@ -681,8 +681,8 @@ CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont)
|
||||
INIT_YAMOP_LTT(code, 2);
|
||||
PUT_YAMOP_SEQ(code);
|
||||
#endif /* YAPOR */
|
||||
code->u.lds.f = Start;
|
||||
code = NEXTOP(code,lds);
|
||||
code->u.apFs.f = Start;
|
||||
code = NEXTOP(code,apFs);
|
||||
if (pe->PredFlags & UserCPredFlag)
|
||||
code->opc = Yap_opcode(_retry_userc);
|
||||
else
|
||||
@ -691,14 +691,14 @@ CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont)
|
||||
INIT_YAMOP_LTT(code, 1);
|
||||
PUT_YAMOP_SEQ(code);
|
||||
#endif /* YAPOR */
|
||||
code->u.lds.f = Cont;
|
||||
code->u.apFs.f = Cont;
|
||||
#ifdef CUT_C
|
||||
code = NEXTOP(code,lds);
|
||||
code = NEXTOP(code,apFs);
|
||||
if (pe->PredFlags & UserCPredFlag)
|
||||
code->opc = Yap_opcode(_cut_c);
|
||||
else
|
||||
code->opc = Yap_opcode(_cut_userc);
|
||||
code->u.lds.f = Cut;
|
||||
code->u.apFs.f = Cut;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -758,9 +758,9 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
|
||||
#endif /* YAPOR */
|
||||
|
||||
#ifdef CUT_C
|
||||
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,lds),lds),lds),l));
|
||||
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),apFs),l));
|
||||
#else
|
||||
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(code,lds),lds),l));
|
||||
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),l));
|
||||
#endif
|
||||
|
||||
if (cl == NULL) {
|
||||
@ -770,13 +770,13 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
|
||||
cl->ClFlags = StaticMask;
|
||||
cl->ClNext = NULL;
|
||||
#ifdef CUT_C
|
||||
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,lds),lds),lds),l);
|
||||
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),apFs),l);
|
||||
cl->ClSize =
|
||||
(CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,lds),lds),lds),e);
|
||||
(CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),apFs),e);
|
||||
#else
|
||||
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(code,lds),lds),l);
|
||||
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),l);
|
||||
cl->ClSize =
|
||||
(CELL)NEXTOP(NEXTOP(NEXTOP(code,lds),lds),e);
|
||||
(CELL)NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),e);
|
||||
#endif
|
||||
cl->usc.ClPred = pe;
|
||||
|
||||
@ -787,38 +787,38 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
|
||||
pe->OpcodeOfPred = code->opc = Yap_opcode(_try_userc);
|
||||
else
|
||||
pe->OpcodeOfPred = code->opc = Yap_opcode(_try_c);
|
||||
code->u.lds.f = Start;
|
||||
code->u.lds.p = pe;
|
||||
code->u.lds.s = Arity;
|
||||
code->u.lds.extra = Extra;
|
||||
code->u.apFs.f = Start;
|
||||
code->u.apFs.p = pe;
|
||||
code->u.apFs.s = Arity;
|
||||
code->u.apFs.extra = Extra;
|
||||
#ifdef YAPOR
|
||||
INIT_YAMOP_LTT(code, 2);
|
||||
PUT_YAMOP_SEQ(code);
|
||||
#endif /* YAPOR */
|
||||
code = NEXTOP(code,lds);
|
||||
code = NEXTOP(code,apFs);
|
||||
if (flags & UserCPredFlag)
|
||||
code->opc = Yap_opcode(_retry_userc);
|
||||
else
|
||||
code->opc = Yap_opcode(_retry_c);
|
||||
code->u.lds.f = Cont;
|
||||
code->u.lds.p = pe;
|
||||
code->u.lds.s = Arity;
|
||||
code->u.lds.extra = Extra;
|
||||
code->u.apFs.f = Cont;
|
||||
code->u.apFs.p = pe;
|
||||
code->u.apFs.s = Arity;
|
||||
code->u.apFs.extra = Extra;
|
||||
#ifdef YAPOR
|
||||
INIT_YAMOP_LTT(code, 1);
|
||||
PUT_YAMOP_SEQ(code);
|
||||
#endif /* YAPOR */
|
||||
code = NEXTOP(code,lds);
|
||||
code = NEXTOP(code,apFs);
|
||||
#ifdef CUT_C
|
||||
if (flags & UserCPredFlag)
|
||||
code->opc = Yap_opcode(_cut_userc);
|
||||
else
|
||||
code->opc = Yap_opcode(_cut_c);
|
||||
code->u.lds.f = Cut;
|
||||
code->u.lds.p = pe;
|
||||
code->u.lds.s = Arity;
|
||||
code->u.lds.extra = Extra;
|
||||
code = NEXTOP(code,lds);
|
||||
code->u.apFs.f = Cut;
|
||||
code->u.apFs.p = pe;
|
||||
code->u.apFs.s = Arity;
|
||||
code->u.apFs.extra = Extra;
|
||||
code = NEXTOP(code,apFs);
|
||||
#endif /* CUT_C */
|
||||
code->opc = Yap_opcode(_Ystop);
|
||||
code->u.l.l = cl->ClCode;
|
||||
@ -958,8 +958,8 @@ InitCodes(void)
|
||||
Yap_heap_regs->nocode.opc = Yap_opcode(_Nstop);
|
||||
|
||||
Yap_heap_regs->rtrycode.opc = Yap_opcode(_retry_and_mark);
|
||||
Yap_heap_regs->rtrycode.u.ld.s = 0;
|
||||
Yap_heap_regs->rtrycode.u.ld.d = NIL;
|
||||
Yap_heap_regs->rtrycode.u.apl.s = 0;
|
||||
Yap_heap_regs->rtrycode.u.apl.d = NIL;
|
||||
#ifdef YAPOR
|
||||
INIT_YAMOP_LTT(&(Yap_heap_regs->rtrycode), 1);
|
||||
#endif /* YAPOR */
|
||||
@ -1309,8 +1309,8 @@ InitCodes(void)
|
||||
modp->PredFlags |= MetaPredFlag;
|
||||
}
|
||||
#ifdef YAPOR
|
||||
Yap_heap_regs->getwork_code.u.ld.p = RepPredProp(PredPropByAtom(Yap_FullLookupAtom("$getwork"), PROLOG_MODULE));
|
||||
Yap_heap_regs->getwork_seq_code.u.ld.p = RepPredProp(PredPropByAtom(Yap_FullLookupAtom("$getwork_seq"), PROLOG_MODULE));
|
||||
Yap_heap_regs->getwork_code.u.apl.p = RepPredProp(PredPropByAtom(Yap_FullLookupAtom("$getwork"), PROLOG_MODULE));
|
||||
Yap_heap_regs->getwork_seq_code.u.apl.p = RepPredProp(PredPropByAtom(Yap_FullLookupAtom("$getwork_seq"), PROLOG_MODULE));
|
||||
#endif /* YAPOR */
|
||||
Yap_heap_regs->db_erased_marker =
|
||||
(DBRef)Yap_AllocCodeSpace(sizeof(DBStruct));
|
||||
|
873
H/YapOpcodes.h
873
H/YapOpcodes.h
@ -1,503 +1,380 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* YAP Prolog *
|
||||
* *
|
||||
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
||||
* *
|
||||
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
||||
* *
|
||||
**************************************************************************
|
||||
* *
|
||||
* File: YapOpcodes.h *
|
||||
* comments: Central Table with all YAP opcodes *
|
||||
* *
|
||||
* Last rev: $Date: 2008-07-24 16:02:01 $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.45 2008/07/16 10:58:59 vsc
|
||||
* small fixes
|
||||
*
|
||||
* Revision 1.44 2008/03/25 22:03:13 vsc
|
||||
* fix some icc warnings
|
||||
*
|
||||
* Revision 1.43 2007/11/26 23:43:09 vsc
|
||||
* fixes to support threads and assert correctly, even if inefficiently.
|
||||
*
|
||||
* Revision 1.42 2007/11/07 09:25:27 vsc
|
||||
* speedup meta-calls
|
||||
*
|
||||
* Revision 1.41 2007/11/06 17:02:12 vsc
|
||||
* compile ground terms away.
|
||||
*
|
||||
* Revision 1.40 2006/10/10 14:08:17 vsc
|
||||
* small fixes on threaded implementation.
|
||||
*
|
||||
* Revision 1.39 2006/09/20 20:03:51 vsc
|
||||
* improve indexing on floats
|
||||
* fix sending large lists to DB
|
||||
*
|
||||
* Revision 1.38 2006/04/27 14:13:24 rslopes
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 1.37 2006/03/24 16:34:21 rslopes
|
||||
* New update to BEAM engine.
|
||||
* BEAM now uses YAP Indexing (JITI)
|
||||
*
|
||||
* Revision 1.36 2005/12/17 03:25:39 vsc
|
||||
* major changes to support online event-based profiling
|
||||
* improve error discovery and restart on scanner.
|
||||
*
|
||||
* Revision 1.35 2005/11/18 18:50:34 tiagosoares
|
||||
* support for executing c code when a cut occurs
|
||||
*
|
||||
* Revision 1.34 2005/09/08 21:55:48 rslopes
|
||||
* BEAM for YAP update...
|
||||
*
|
||||
* Revision 1.33 2005/08/01 15:40:38 ricroc
|
||||
* TABLING NEW: better support for incomplete tabling
|
||||
*
|
||||
* Revision 1.32 2005/07/06 19:34:11 ricroc
|
||||
* TABLING: answers for completed calls can now be obtained by loading (new option) or executing (default) them from the trie data structure.
|
||||
*
|
||||
* Revision 1.31 2005/07/06 15:10:15 vsc
|
||||
* improvements to compiler: merged instructions and fixes for ->
|
||||
*
|
||||
* Revision 1.30 2005/06/04 07:26:43 ricroc
|
||||
* long int support for tabling
|
||||
*
|
||||
* Revision 1.29 2005/06/03 08:18:25 ricroc
|
||||
* float support for tabling
|
||||
*
|
||||
* Revision 1.28 2005/06/01 20:25:23 vsc
|
||||
* == and \= should not need a choice-point in ->
|
||||
*
|
||||
* Revision 1.27 2005/06/01 14:02:52 vsc
|
||||
* get_rid of try_me?, retry_me? and trust_me? instructions: they are not
|
||||
* significantly used nowadays.
|
||||
*
|
||||
* Revision 1.26 2005/04/10 04:01:13 vsc
|
||||
* bug fixes, I hope!
|
||||
*
|
||||
* Revision 1.25 2004/10/26 20:16:04 vsc
|
||||
* More bug fixes for overflow handling
|
||||
*
|
||||
* Revision 1.24 2004/09/27 20:45:04 vsc
|
||||
* Mega clauses
|
||||
* Fixes to sizeof(expand_clauses) which was being overestimated
|
||||
* Fixes to profiling+indexing
|
||||
* Fixes to reallocation of memory after restoring
|
||||
* Make sure all clauses, even for C, end in _Ystop
|
||||
* Don't reuse space for Streams
|
||||
* Fix Stream_F on StreaNo+1
|
||||
*
|
||||
* Revision 1.23 2004/03/31 01:03:10 vsc
|
||||
* support expand group of clauses
|
||||
*
|
||||
* Revision 1.22 2004/03/19 11:35:42 vsc
|
||||
* trim_trail for default machine
|
||||
* be more aggressive about try-retry-trust chains.
|
||||
* - handle cases where block starts with a wait
|
||||
* - don't use _killed instructions, just let the thing rot by itself.
|
||||
*
|
||||
* Revision 1.21 2004/03/10 14:59:55 vsc
|
||||
* optimise -> for type tests
|
||||
* *
|
||||
* *
|
||||
*************************************************************************/
|
||||
OPCODE(Ystop ,l),
|
||||
OPCODE(Nstop ,e),
|
||||
OPCODE(execute ,pp),
|
||||
OPCODE(call ,sla),
|
||||
OPCODE(procceed ,p),
|
||||
OPCODE(allocate ,e),
|
||||
OPCODE(deallocate ,e),
|
||||
OPCODE(op_fail ,e),
|
||||
|
||||
/* This file was generated automatically by "yap -L misc/buildops"
|
||||
please do not update */
|
||||
|
||||
OPCODE(Ystop ,l),
|
||||
OPCODE(Nstop ,e),
|
||||
OPCODE(try_me ,apl),
|
||||
OPCODE(retry_me ,apl),
|
||||
OPCODE(trust_me ,apl),
|
||||
OPCODE(enter_profiling ,p),
|
||||
OPCODE(enter_a_profiling ,e),
|
||||
OPCODE(retry_profiled ,p),
|
||||
OPCODE(profiled_retry_me ,apl),
|
||||
OPCODE(profiled_trust_me ,apl),
|
||||
OPCODE(profiled_retry_logical ,aLl),
|
||||
OPCODE(profiled_trust_logical ,ILl),
|
||||
OPCODE(count_call ,p),
|
||||
OPCODE(count_a_call ,e),
|
||||
OPCODE(count_retry ,p),
|
||||
OPCODE(count_retry_me ,apl),
|
||||
OPCODE(count_trust_me ,apl),
|
||||
OPCODE(count_retry_logical ,aLl),
|
||||
OPCODE(count_trust_logical ,ILl),
|
||||
OPCODE(lock_lu ,e),
|
||||
OPCODE(unlock_lu ,e),
|
||||
OPCODE(alloc_for_logical_pred ,L),
|
||||
OPCODE(copy_idb_term ,e),
|
||||
OPCODE(unify_idb_term ,e),
|
||||
OPCODE(spy_or_trymark ,apl),
|
||||
OPCODE(try_and_mark ,apl),
|
||||
OPCODE(count_retry_and_mark ,apl),
|
||||
OPCODE(profiled_retry_and_mark ,apl),
|
||||
OPCODE(retry_and_mark ,apl),
|
||||
OPCODE(trust_fail ,e),
|
||||
OPCODE(op_fail ,e),
|
||||
OPCODE(cut ,e),
|
||||
OPCODE(cut_t ,e),
|
||||
OPCODE(cut_e ,e),
|
||||
OPCODE(save_b_x ,x),
|
||||
OPCODE(save_b_y ,y),
|
||||
OPCODE(commit_b_x ,x),
|
||||
OPCODE(commit_b_y ,y),
|
||||
OPCODE(execute ,pp),
|
||||
OPCODE(dexecute ,pp),
|
||||
OPCODE(fcall ,sbpp),
|
||||
OPCODE(call ,sbpp),
|
||||
OPCODE(procceed ,p),
|
||||
OPCODE(allocate ,e),
|
||||
OPCODE(deallocate ,e),
|
||||
#ifdef BEAM
|
||||
OPCODE(retry_eam ,e),
|
||||
#endif
|
||||
#ifdef BEAM
|
||||
OPCODE(run_eam ,os),
|
||||
#endif
|
||||
OPCODE(get_x_var ,xx),
|
||||
OPCODE(get_y_var ,yx),
|
||||
OPCODE(get_x_val ,xx),
|
||||
OPCODE(get_y_val ,yx),
|
||||
OPCODE(get_atom ,xc),
|
||||
OPCODE(get_2atoms ,cc),
|
||||
OPCODE(get_3atoms ,ccc),
|
||||
OPCODE(get_4atoms ,cccc),
|
||||
OPCODE(get_5atoms ,ccccc),
|
||||
OPCODE(get_6atoms ,cccccc),
|
||||
OPCODE(get_list ,x),
|
||||
OPCODE(get_struct ,xfa),
|
||||
OPCODE(get_float ,xd),
|
||||
OPCODE(get_longint ,xi),
|
||||
OPCODE(get_bigint ,xc),
|
||||
OPCODE(get_dbterm ,xc),
|
||||
OPCODE(glist_valx ,xx),
|
||||
OPCODE(glist_valy ,xy),
|
||||
OPCODE(gl_void_varx ,xx),
|
||||
OPCODE(gl_void_vary ,xy),
|
||||
OPCODE(gl_void_valx ,xx),
|
||||
OPCODE(gl_void_valy ,xy),
|
||||
OPCODE(unify_x_var ,ox),
|
||||
OPCODE(unify_x_var_write ,ox),
|
||||
OPCODE(unify_l_x_var ,ox),
|
||||
OPCODE(unify_l_x_var_write ,ox),
|
||||
OPCODE(unify_x_var2 ,oxx),
|
||||
OPCODE(unify_x_var2_write ,oxx),
|
||||
OPCODE(unify_l_x_var2 ,oxx),
|
||||
OPCODE(unify_l_x_var2_write ,oxx),
|
||||
OPCODE(unify_y_var ,oy),
|
||||
OPCODE(unify_y_var_write ,oy),
|
||||
OPCODE(unify_l_y_var ,oy),
|
||||
OPCODE(unify_l_y_var_write ,oy),
|
||||
OPCODE(unify_x_val ,ox),
|
||||
OPCODE(unify_x_val_write ,ox),
|
||||
OPCODE(unify_l_x_val ,ox),
|
||||
OPCODE(unify_l_x_val_write ,ox),
|
||||
OPCODE(unify_y_val ,oy),
|
||||
OPCODE(unify_y_val_write ,oy),
|
||||
OPCODE(unify_l_y_val ,oy),
|
||||
OPCODE(unify_l_y_val_write ,oy),
|
||||
OPCODE(unify_x_loc ,ox),
|
||||
OPCODE(unify_x_loc_write ,ox),
|
||||
OPCODE(unify_l_x_loc ,ox),
|
||||
OPCODE(unify_l_x_loc_write ,ox),
|
||||
OPCODE(unify_y_loc ,oy),
|
||||
OPCODE(unify_y_loc_write ,oy),
|
||||
OPCODE(unify_l_y_loc ,oy),
|
||||
OPCODE(unify_l_y_loc_write ,oy),
|
||||
OPCODE(unify_void ,o),
|
||||
OPCODE(unify_void_write ,o),
|
||||
OPCODE(unify_l_void ,o),
|
||||
OPCODE(unify_l_void_write ,o),
|
||||
OPCODE(unify_n_voids ,os),
|
||||
OPCODE(unify_n_voids_write ,os),
|
||||
OPCODE(unify_l_n_voids ,os),
|
||||
OPCODE(unify_l_n_voids_write ,os),
|
||||
OPCODE(unify_atom ,oc),
|
||||
OPCODE(unify_atom_write ,oc),
|
||||
OPCODE(unify_l_atom ,oc),
|
||||
OPCODE(unify_l_atom_write ,oc),
|
||||
OPCODE(unify_n_atoms ,osc),
|
||||
OPCODE(unify_n_atoms_write ,osc),
|
||||
OPCODE(unify_float ,od),
|
||||
OPCODE(unify_float_write ,od),
|
||||
OPCODE(unify_l_float ,od),
|
||||
OPCODE(unify_l_float_write ,od),
|
||||
OPCODE(unify_longint ,oi),
|
||||
OPCODE(unify_longint_write ,oi),
|
||||
OPCODE(unify_l_longint ,oi),
|
||||
OPCODE(unify_l_longint_write ,oi),
|
||||
OPCODE(unify_bigint ,oc),
|
||||
OPCODE(unify_l_bigint ,oc),
|
||||
OPCODE(unify_dbterm ,oc),
|
||||
OPCODE(unify_l_dbterm ,oc),
|
||||
OPCODE(unify_list ,o),
|
||||
OPCODE(unify_list_write ,o),
|
||||
OPCODE(unify_l_list ,o),
|
||||
OPCODE(unify_l_list_write ,o),
|
||||
OPCODE(unify_struct ,ofa),
|
||||
OPCODE(unify_struct_write ,ofa),
|
||||
OPCODE(unify_l_struc ,ofa),
|
||||
OPCODE(unify_l_struc_write ,ofa),
|
||||
OPCODE(put_x_var ,xx),
|
||||
OPCODE(put_y_var ,yx),
|
||||
OPCODE(put_x_val ,xx),
|
||||
OPCODE(put_xx_val ,xxxx),
|
||||
OPCODE(put_y_val ,yx),
|
||||
OPCODE(put_unsafe ,yx),
|
||||
OPCODE(put_atom ,xc),
|
||||
OPCODE(put_float ,xd),
|
||||
OPCODE(put_longint ,xi),
|
||||
OPCODE(put_list ,x),
|
||||
OPCODE(put_struct ,xfa),
|
||||
OPCODE(write_x_var ,x),
|
||||
OPCODE(write_void ,e),
|
||||
OPCODE(write_n_voids ,s),
|
||||
OPCODE(write_y_var ,y),
|
||||
OPCODE(write_x_val ,x),
|
||||
OPCODE(write_x_loc ,x),
|
||||
OPCODE(write_y_val ,y),
|
||||
OPCODE(write_y_loc ,y),
|
||||
OPCODE(write_atom ,c),
|
||||
OPCODE(write_float ,d),
|
||||
OPCODE(write_longint ,i),
|
||||
OPCODE(write_n_atoms ,sc),
|
||||
OPCODE(write_list ,e),
|
||||
OPCODE(write_l_list ,e),
|
||||
OPCODE(write_struct ,fa),
|
||||
OPCODE(write_l_struc ,fa),
|
||||
OPCODE(save_pair_x ,ox),
|
||||
OPCODE(save_pair_x_write ,ox),
|
||||
OPCODE(save_pair_y ,oy),
|
||||
OPCODE(save_pair_y_write ,oy),
|
||||
OPCODE(save_appl_x ,ox),
|
||||
OPCODE(save_appl_x_write ,ox),
|
||||
OPCODE(save_appl_y ,oy),
|
||||
OPCODE(save_appl_y_write ,oy),
|
||||
OPCODE(jump ,l),
|
||||
OPCODE(move_back ,l),
|
||||
OPCODE(skip ,l),
|
||||
OPCODE(either ,sblp),
|
||||
OPCODE(or_else ,sblp),
|
||||
OPCODE(pop_n ,s),
|
||||
OPCODE(pop ,e),
|
||||
OPCODE(call_cpred ,sbpp),
|
||||
OPCODE(call_usercpred ,sbpp),
|
||||
OPCODE(call_c_wfail ,sdlp),
|
||||
OPCODE(try_c ,apFs),
|
||||
OPCODE(retry_c ,apFs),
|
||||
#ifdef CUT_C
|
||||
OPCODE(cut_c ,apFs),
|
||||
#endif
|
||||
OPCODE(try_userc ,apFs),
|
||||
OPCODE(retry_userc ,apFs),
|
||||
#ifdef CUT_C
|
||||
OPCODE(cut_userc ,apFs),
|
||||
#endif
|
||||
OPCODE(lock_pred ,e),
|
||||
OPCODE(index_pred ,e),
|
||||
#ifdef THREADS
|
||||
OPCODE(thread_local ,e),
|
||||
#endif
|
||||
OPCODE(expand_index ,e),
|
||||
OPCODE(expand_clauses ,sssllp),
|
||||
OPCODE(undef_p ,e),
|
||||
OPCODE(spy_pred ,e),
|
||||
OPCODE(try_clause ,apl),
|
||||
OPCODE(try_clause2 ,l),
|
||||
OPCODE(try_clause3 ,l),
|
||||
OPCODE(try_clause4 ,l),
|
||||
OPCODE(retry ,apl),
|
||||
OPCODE(retry2 ,l),
|
||||
OPCODE(retry3 ,l),
|
||||
OPCODE(retry4 ,l),
|
||||
OPCODE(trust ,apl),
|
||||
OPCODE(try_in ,l),
|
||||
OPCODE(enter_lu_pred ,Ills),
|
||||
OPCODE(try_logical ,aLl),
|
||||
OPCODE(retry_logical ,aLl),
|
||||
OPCODE(trust_logical ,ILl),
|
||||
OPCODE(switch_on_type ,llll),
|
||||
OPCODE(switch_list_nl ,ollll),
|
||||
OPCODE(switch_on_arg_type ,xllll),
|
||||
OPCODE(switch_on_sub_arg_type ,sllll),
|
||||
OPCODE(jump_if_var ,l),
|
||||
OPCODE(jump_if_nonvar ,xll),
|
||||
OPCODE(if_not_then ,clll),
|
||||
OPCODE(switch_on_func ,sssl),
|
||||
OPCODE(switch_on_cons ,sssl),
|
||||
OPCODE(go_on_func ,sssl),
|
||||
OPCODE(go_on_cons ,sssl),
|
||||
OPCODE(if_func ,sssl),
|
||||
OPCODE(if_cons ,sssl),
|
||||
OPCODE(index_dbref ,e),
|
||||
OPCODE(index_blob ,e),
|
||||
OPCODE(p_atom_x ,xl),
|
||||
OPCODE(p_atom_y ,yl),
|
||||
OPCODE(p_atomic_x ,xl),
|
||||
OPCODE(p_atomic_y ,yl),
|
||||
OPCODE(p_integer_x ,xl),
|
||||
OPCODE(p_integer_y ,yl),
|
||||
OPCODE(p_nonvar_x ,xl),
|
||||
OPCODE(p_nonvar_y ,yl),
|
||||
OPCODE(p_number_x ,xl),
|
||||
OPCODE(p_number_y ,xl),
|
||||
OPCODE(p_var_x ,xl),
|
||||
OPCODE(p_var_y ,yl),
|
||||
OPCODE(p_db_ref_x ,xl),
|
||||
OPCODE(p_db_ref_y ,yl),
|
||||
OPCODE(p_primitive_x ,xl),
|
||||
OPCODE(p_primitive_y ,yl),
|
||||
OPCODE(p_compound_x ,xl),
|
||||
OPCODE(p_compound_y ,yl),
|
||||
OPCODE(p_float_x ,xl),
|
||||
OPCODE(p_float_y ,yl),
|
||||
OPCODE(p_cut_by_x ,xl),
|
||||
OPCODE(p_cut_by_y ,yl),
|
||||
OPCODE(p_plus_vv ,xxx),
|
||||
OPCODE(p_plus_vc ,xxc),
|
||||
OPCODE(p_plus_y_vv ,yxx),
|
||||
OPCODE(p_plus_y_vc ,yxc),
|
||||
OPCODE(p_minus_vv ,xxx),
|
||||
OPCODE(p_minus_cv ,xxc),
|
||||
OPCODE(p_minus_y_vv ,yxx),
|
||||
OPCODE(p_minus_y_cv ,yxc),
|
||||
OPCODE(p_times_vv ,xxx),
|
||||
OPCODE(p_times_vc ,xxc),
|
||||
OPCODE(p_times_y_vv ,yxx),
|
||||
OPCODE(p_times_y_vc ,yxc),
|
||||
OPCODE(p_div_vv ,xxx),
|
||||
OPCODE(p_div_vc ,xxc),
|
||||
OPCODE(p_div_cv ,xxc),
|
||||
OPCODE(p_div_y_vv ,yxx),
|
||||
OPCODE(p_div_y_vc ,yxc),
|
||||
OPCODE(p_div_y_cv ,yxc),
|
||||
OPCODE(p_and_vv ,xxx),
|
||||
OPCODE(p_and_vc ,xxc),
|
||||
OPCODE(p_and_y_vv ,yxx),
|
||||
OPCODE(p_and_y_vc ,yxc),
|
||||
OPCODE(p_or_vv ,xxx),
|
||||
OPCODE(p_or_vc ,xxc),
|
||||
OPCODE(p_or_y_vv ,yxx),
|
||||
OPCODE(p_or_y_vc ,yxc),
|
||||
OPCODE(p_sll_vv ,xxx),
|
||||
OPCODE(p_sll_vc ,xxc),
|
||||
OPCODE(p_sll_cv ,xxc),
|
||||
OPCODE(p_sll_y_vv ,yxx),
|
||||
OPCODE(p_sll_y_vc ,yxc),
|
||||
OPCODE(p_sll_y_cv ,yxc),
|
||||
OPCODE(p_slr_vv ,xxx),
|
||||
OPCODE(p_slr_vc ,xxc),
|
||||
OPCODE(p_slr_cv ,xxc),
|
||||
OPCODE(p_slr_y_vv ,yxx),
|
||||
OPCODE(p_slr_y_vc ,yxc),
|
||||
OPCODE(p_slr_y_cv ,yxc),
|
||||
OPCODE(call_bfunc_xx ,plxxs),
|
||||
OPCODE(call_bfunc_yx ,plxys),
|
||||
OPCODE(call_bfunc_xy ,plxys),
|
||||
OPCODE(call_bfunc_yy ,plyys),
|
||||
OPCODE(p_equal ,e),
|
||||
OPCODE(p_dif ,l),
|
||||
OPCODE(p_eq ,l),
|
||||
OPCODE(p_arg_vv ,xxx),
|
||||
OPCODE(p_arg_cv ,xxc),
|
||||
OPCODE(p_arg_y_vv ,yxx),
|
||||
OPCODE(p_arg_y_cv ,xxc),
|
||||
OPCODE(p_func2s_vv ,xxx),
|
||||
OPCODE(p_func2s_cv ,xxc),
|
||||
OPCODE(p_func2s_vc ,xxc),
|
||||
OPCODE(p_func2s_y_vv ,yxx),
|
||||
OPCODE(p_func2s_y_cv ,yxc),
|
||||
OPCODE(p_func2s_y_vc ,yxc),
|
||||
OPCODE(p_func2f_xx ,xxx),
|
||||
OPCODE(p_func2f_xy ,xxy),
|
||||
OPCODE(p_func2f_yx ,yxx),
|
||||
OPCODE(p_func2f_yy ,yyx),
|
||||
OPCODE(p_functor ,e),
|
||||
OPCODE(p_execute2 ,sbpp),
|
||||
OPCODE(p_execute ,sbmp),
|
||||
OPCODE(p_execute_tail ,sbpp),
|
||||
#ifdef YAPOR
|
||||
OPCODE(getwork_first_time ,e),
|
||||
OPCODE(getwork ,ld),
|
||||
OPCODE(getwork_seq ,ld),
|
||||
OPCODE(sync ,ld),
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING_INNER_CUTS
|
||||
OPCODE(clause_with_cut ,e),
|
||||
#endif /* TABLING_INNER_CUTS */
|
||||
OPCODE(getwork_first_time ,e),
|
||||
OPCODE(getwork ,apl),
|
||||
OPCODE(getwork_seq ,apl),
|
||||
OPCODE(sync ,apl),
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
OPCODE(table_load_answer ,ld),
|
||||
OPCODE(table_try_answer ,ld),
|
||||
OPCODE(table_try_single ,ld),
|
||||
OPCODE(table_try_me ,ld),
|
||||
OPCODE(table_try ,ld),
|
||||
OPCODE(table_retry_me ,ld),
|
||||
OPCODE(table_retry ,ld),
|
||||
OPCODE(table_trust_me ,ld),
|
||||
OPCODE(table_trust ,ld),
|
||||
OPCODE(table_new_answer ,s),
|
||||
OPCODE(table_answer_resolution ,ld),
|
||||
OPCODE(table_completion ,ld),
|
||||
|
||||
OPCODE(trie_do_null ,e),
|
||||
OPCODE(trie_trust_null ,e),
|
||||
OPCODE(trie_try_null ,e),
|
||||
OPCODE(trie_retry_null ,e),
|
||||
OPCODE(trie_do_var ,e),
|
||||
OPCODE(trie_trust_var ,e),
|
||||
OPCODE(trie_try_var ,e),
|
||||
OPCODE(trie_retry_var ,e),
|
||||
OPCODE(trie_do_val ,e),
|
||||
OPCODE(trie_trust_val ,e),
|
||||
OPCODE(trie_try_val ,e),
|
||||
OPCODE(trie_retry_val ,e),
|
||||
OPCODE(trie_do_atom ,e),
|
||||
OPCODE(trie_trust_atom ,e),
|
||||
OPCODE(trie_try_atom ,e),
|
||||
OPCODE(trie_retry_atom ,e),
|
||||
OPCODE(trie_do_list ,e),
|
||||
OPCODE(trie_trust_list ,e),
|
||||
OPCODE(trie_try_list ,e),
|
||||
OPCODE(trie_retry_list ,e),
|
||||
OPCODE(trie_do_struct ,e),
|
||||
OPCODE(trie_trust_struct ,e),
|
||||
OPCODE(trie_try_struct ,e),
|
||||
OPCODE(trie_retry_struct ,e),
|
||||
OPCODE(trie_do_extension ,e),
|
||||
OPCODE(trie_trust_extension ,e),
|
||||
OPCODE(trie_try_extension ,e),
|
||||
OPCODE(trie_retry_extension ,e),
|
||||
OPCODE(trie_do_float ,e),
|
||||
OPCODE(trie_trust_float ,e),
|
||||
OPCODE(trie_try_float ,e),
|
||||
OPCODE(trie_retry_float ,e),
|
||||
OPCODE(trie_do_long ,e),
|
||||
OPCODE(trie_trust_long ,e),
|
||||
OPCODE(trie_try_long ,e),
|
||||
OPCODE(trie_retry_long ,e),
|
||||
#endif /* TABLING */
|
||||
OPCODE(try_me ,ld),
|
||||
OPCODE(retry_me ,ld),
|
||||
OPCODE(trust_me ,ld),
|
||||
OPCODE(try_and_mark ,ld),
|
||||
OPCODE(retry_and_mark ,ld),
|
||||
OPCODE(try_c ,lds),
|
||||
OPCODE(retry_c ,lds),
|
||||
#ifdef CUT_C
|
||||
OPCODE(cut_c ,lds),
|
||||
#endif
|
||||
OPCODE(try_userc ,lds),
|
||||
OPCODE(retry_userc ,lds),
|
||||
#ifdef CUT_C
|
||||
OPCODE(cut_userc ,lds),
|
||||
#endif
|
||||
OPCODE(cut ,e),
|
||||
OPCODE(get_x_var ,xx),
|
||||
OPCODE(get_y_var ,yx),
|
||||
OPCODE(get_x_val ,xx),
|
||||
OPCODE(get_y_val ,yx),
|
||||
OPCODE(get_atom ,xc),
|
||||
OPCODE(get_2atoms ,cc), /* peephole */
|
||||
OPCODE(get_3atoms ,ccc), /* peephole */
|
||||
OPCODE(get_4atoms ,cccc), /* peephole */
|
||||
OPCODE(get_5atoms ,ccccc), /* peephole */
|
||||
OPCODE(get_6atoms ,cccccc), /* peephole */
|
||||
OPCODE(get_float ,xd),
|
||||
OPCODE(get_longint ,xi),
|
||||
OPCODE(get_bigint ,xc),
|
||||
OPCODE(get_dbterm ,xc),
|
||||
OPCODE(get_list ,x),
|
||||
OPCODE(get_struct ,xf),
|
||||
OPCODE(unify_x_var ,ox),
|
||||
OPCODE(unify_y_var ,oy),
|
||||
OPCODE(unify_x_val ,ox),
|
||||
OPCODE(unify_y_val ,oy),
|
||||
OPCODE(unify_atom ,oc),
|
||||
OPCODE(unify_float ,od),
|
||||
OPCODE(unify_longint ,oi),
|
||||
OPCODE(unify_bigint ,oc),
|
||||
OPCODE(unify_dbterm ,oc),
|
||||
OPCODE(unify_list ,o),
|
||||
OPCODE(unify_struct ,of),
|
||||
OPCODE(put_x_var ,xx),
|
||||
OPCODE(put_y_var ,yx),
|
||||
OPCODE(put_x_val ,xx),
|
||||
OPCODE(put_y_val ,yx),
|
||||
OPCODE(put_unsafe ,yx),
|
||||
OPCODE(put_xx_val ,xxxx), /* peephole */
|
||||
OPCODE(put_atom ,xc),
|
||||
OPCODE(put_float ,xd),
|
||||
OPCODE(put_longint ,xi),
|
||||
OPCODE(put_list ,x),
|
||||
OPCODE(put_struct ,xf),
|
||||
OPCODE(write_x_var ,x),
|
||||
OPCODE(write_y_var ,y),
|
||||
OPCODE(write_x_val ,x),
|
||||
OPCODE(write_y_val ,y),
|
||||
OPCODE(write_atom ,c),
|
||||
OPCODE(write_float ,d),
|
||||
OPCODE(write_longint ,i),
|
||||
OPCODE(write_list ,e),
|
||||
OPCODE(write_struct ,f),
|
||||
OPCODE(pop ,e),
|
||||
OPCODE(pop_n ,s),
|
||||
OPCODE(jump ,l),
|
||||
OPCODE(move_back ,l),
|
||||
OPCODE(skip ,l),
|
||||
OPCODE(either ,sla),
|
||||
OPCODE(or_else ,sla),
|
||||
OPCODE(clause_with_cut ,e),
|
||||
OPCODE(table_load_answer ,apl),
|
||||
OPCODE(table_try_answer ,apl),
|
||||
OPCODE(table_try_single ,apl),
|
||||
OPCODE(table_try_me ,apl),
|
||||
OPCODE(table_try ,apl),
|
||||
OPCODE(table_retry_me ,apl),
|
||||
OPCODE(table_retry ,apl),
|
||||
OPCODE(table_trust_me ,apl),
|
||||
OPCODE(table_trust ,apl),
|
||||
OPCODE(table_new_answer ,s),
|
||||
OPCODE(table_answer_resolution ,apl),
|
||||
OPCODE(table_completion ,apl),
|
||||
OPCODE(trie_do_null ,e),
|
||||
OPCODE(trie_try_null ,e),
|
||||
OPCODE(trie_retry_null ,e),
|
||||
OPCODE(trie_trust_null ,e),
|
||||
OPCODE(trie_do_var ,e),
|
||||
OPCODE(trie_try_var ,e),
|
||||
OPCODE(trie_retry_var ,e),
|
||||
OPCODE(trie_trust_var ,e),
|
||||
OPCODE(trie_do_val ,e),
|
||||
OPCODE(trie_try_val ,e),
|
||||
OPCODE(trie_retry_val ,e),
|
||||
OPCODE(trie_trust_val ,e),
|
||||
OPCODE(trie_do_atom ,e),
|
||||
OPCODE(trie_try_atom ,e),
|
||||
OPCODE(trie_retry_atom ,e),
|
||||
OPCODE(trie_trust_atom ,e),
|
||||
OPCODE(trie_do_list ,e),
|
||||
OPCODE(trie_try_list ,e),
|
||||
OPCODE(trie_retry_list ,e),
|
||||
OPCODE(trie_trust_list ,e),
|
||||
OPCODE(trie_do_struct ,e),
|
||||
OPCODE(trie_try_struct ,e),
|
||||
OPCODE(trie_retry_struct ,e),
|
||||
OPCODE(trie_trust_struct ,e),
|
||||
OPCODE(trie_do_extension ,e),
|
||||
OPCODE(trie_try_extension ,e),
|
||||
OPCODE(trie_retry_extension ,e),
|
||||
OPCODE(trie_trust_extension ,e),
|
||||
OPCODE(trie_do_float ,e),
|
||||
OPCODE(trie_try_float ,e),
|
||||
OPCODE(trie_retry_float ,e),
|
||||
OPCODE(trie_trust_float ,e),
|
||||
OPCODE(trie_do_long ,e),
|
||||
OPCODE(trie_try_long ,e),
|
||||
OPCODE(trie_retry_long ,e),
|
||||
OPCODE(trie_trust_long ,e),
|
||||
#endif
|
||||
/* this instruction is hardwired */
|
||||
#ifdef YAPOR
|
||||
OPCODE(or_last ,sla),
|
||||
OPCODE(or_last ,sblp)
|
||||
#else
|
||||
OPCODE(or_last ,p),
|
||||
#endif /* YAPOR */
|
||||
#ifdef BEAM
|
||||
OPCODE(retry_eam ,e),
|
||||
OPCODE(run_eam ,os),
|
||||
OPCODE(or_last ,p)
|
||||
#endif
|
||||
OPCODE(call_cpred ,sla),
|
||||
OPCODE(call_usercpred ,sla),
|
||||
OPCODE(call_c_wfail ,sdl),
|
||||
OPCODE(call_bfunc_xx ,llxx),
|
||||
OPCODE(call_bfunc_xy ,llxy),
|
||||
OPCODE(call_bfunc_yx ,llxy),
|
||||
OPCODE(call_bfunc_yy ,llyy),
|
||||
OPCODE(cut_t ,e),
|
||||
OPCODE(cut_e ,sla),
|
||||
OPCODE(try_clause ,ld),
|
||||
OPCODE(try_clause2 ,l),
|
||||
OPCODE(try_clause3 ,l),
|
||||
OPCODE(try_clause4 ,l),
|
||||
OPCODE(retry ,ld),
|
||||
OPCODE(retry2 ,l),
|
||||
OPCODE(retry3 ,l),
|
||||
OPCODE(retry4 ,l),
|
||||
OPCODE(trust ,ld),
|
||||
OPCODE(try_in ,l),
|
||||
OPCODE(enter_lu_pred ,Ill),
|
||||
OPCODE(try_logical ,lld),
|
||||
OPCODE(retry_logical ,lld),
|
||||
OPCODE(trust_logical ,lld),
|
||||
OPCODE(count_retry_logical ,lld),
|
||||
OPCODE(count_trust_logical ,lld),
|
||||
OPCODE(profiled_retry_logical ,lld),
|
||||
OPCODE(profiled_trust_logical ,lld),
|
||||
OPCODE(jump_if_var ,l),
|
||||
OPCODE(jump_if_nonvar ,xll),
|
||||
OPCODE(switch_on_cons ,sssl),
|
||||
OPCODE(switch_on_type ,llll),
|
||||
OPCODE(switch_list_nl ,ollll),
|
||||
OPCODE(switch_on_arg_type ,xllll),
|
||||
OPCODE(switch_on_sub_arg_type ,sllll),
|
||||
OPCODE(go_on_cons ,sssl),
|
||||
OPCODE(if_cons ,sssl),
|
||||
OPCODE(switch_on_func ,sssl),
|
||||
OPCODE(go_on_func ,sssl),
|
||||
OPCODE(if_func ,sssl),
|
||||
OPCODE(if_not_then ,clll),
|
||||
OPCODE(index_dbref ,e),
|
||||
OPCODE(index_blob ,e),
|
||||
OPCODE(trust_fail ,e),
|
||||
OPCODE(index_pred ,e),
|
||||
OPCODE(lock_pred ,e),
|
||||
OPCODE(expand_index ,e),
|
||||
OPCODE(expand_clauses ,sp),
|
||||
OPCODE(save_b_x ,x),
|
||||
OPCODE(save_b_y ,y),
|
||||
OPCODE(commit_b_x ,x),
|
||||
OPCODE(commit_b_y ,y),
|
||||
OPCODE(undef_p ,e),
|
||||
OPCODE(spy_pred ,e),
|
||||
OPCODE(spy_or_trymark ,ld),
|
||||
OPCODE(unify_void ,o),
|
||||
OPCODE(write_void ,e),
|
||||
OPCODE(save_pair_x ,ox),
|
||||
OPCODE(save_pair_y ,oy),
|
||||
OPCODE(save_appl_x ,ox),
|
||||
OPCODE(save_appl_y ,oy),
|
||||
OPCODE(unify_n_atoms ,osc),
|
||||
OPCODE(write_n_atoms ,sc),
|
||||
OPCODE(unify_n_voids ,os),
|
||||
OPCODE(write_n_voids ,s),
|
||||
OPCODE(glist_valx ,xx), /* peephole */
|
||||
OPCODE(glist_valy ,xy), /* peephole */
|
||||
OPCODE(fcall ,sla),
|
||||
OPCODE(dexecute ,pp),
|
||||
OPCODE(gl_void_varx ,xx), /* peephole */
|
||||
OPCODE(gl_void_vary ,xy), /* peephole */
|
||||
OPCODE(gl_void_valx ,xx), /* peephole */
|
||||
OPCODE(gl_void_valy ,xy), /* peephole */
|
||||
OPCODE(unify_x_loc ,ox),
|
||||
OPCODE(unify_y_loc ,oy),
|
||||
OPCODE(write_x_loc ,ox),
|
||||
OPCODE(write_y_loc ,oy),
|
||||
OPCODE(unify_x_var2 ,oxx),
|
||||
OPCODE(unify_l_struc ,of),
|
||||
OPCODE(unify_l_list ,o),
|
||||
OPCODE(write_l_struc ,f),
|
||||
OPCODE(write_l_list ,e),
|
||||
OPCODE(unify_l_x_var ,ox),
|
||||
OPCODE(unify_l_y_var ,oy),
|
||||
OPCODE(unify_l_x_val ,ox),
|
||||
OPCODE(unify_l_y_val ,oy),
|
||||
OPCODE(unify_l_atom ,oc),
|
||||
OPCODE(unify_l_float ,od),
|
||||
OPCODE(unify_l_longint ,oi),
|
||||
OPCODE(unify_l_bigint ,oc),
|
||||
OPCODE(unify_l_dbterm ,oc),
|
||||
OPCODE(unify_l_void ,o),
|
||||
OPCODE(unify_l_n_voids ,os),
|
||||
OPCODE(unify_l_x_loc ,ox),
|
||||
OPCODE(unify_l_y_loc ,oy),
|
||||
OPCODE(unify_l_x_var2 ,oxx),
|
||||
OPCODE(unify_x_var_write ,ox),
|
||||
OPCODE(unify_y_var_write ,oy),
|
||||
OPCODE(unify_x_val_write ,ox),
|
||||
OPCODE(unify_y_val_write ,oy),
|
||||
OPCODE(unify_atom_write ,oc),
|
||||
OPCODE(unify_float_write ,od),
|
||||
OPCODE(unify_longint_write ,oi),
|
||||
OPCODE(unify_n_atoms_write ,osc),
|
||||
OPCODE(unify_list_write ,o),
|
||||
OPCODE(unify_x_var2_write ,oxx),
|
||||
OPCODE(unify_struct_write ,of),
|
||||
OPCODE(unify_void_write ,o),
|
||||
OPCODE(unify_n_voids_write ,os),
|
||||
OPCODE(unify_x_loc_write ,ox),
|
||||
OPCODE(unify_y_loc_write ,oy),
|
||||
OPCODE(unify_l_x_var_write ,ox),
|
||||
OPCODE(unify_l_y_var_write ,oy),
|
||||
OPCODE(unify_l_x_val_write ,ox),
|
||||
OPCODE(unify_l_y_val_write ,oy),
|
||||
OPCODE(unify_l_atom_write ,oc),
|
||||
OPCODE(unify_l_float_write ,od),
|
||||
OPCODE(unify_l_longint_write ,oi),
|
||||
OPCODE(unify_l_void_write ,o),
|
||||
OPCODE(unify_l_n_voids_write ,os),
|
||||
OPCODE(unify_l_x_loc_write ,ox),
|
||||
OPCODE(unify_l_y_loc_write ,oy),
|
||||
OPCODE(unify_l_x_var2_write ,oxx),
|
||||
OPCODE(unify_l_list_write ,o),
|
||||
OPCODE(unify_l_struc_write ,of),
|
||||
OPCODE(save_pair_x_write ,ox),
|
||||
OPCODE(save_pair_y_write ,oy),
|
||||
OPCODE(save_appl_x_write ,ox),
|
||||
OPCODE(save_appl_y_write ,oy),
|
||||
OPCODE(enter_profiling ,l),
|
||||
OPCODE(enter_a_profiling ,e),
|
||||
OPCODE(retry_profiled ,l),
|
||||
OPCODE(profiled_retry_me ,ld),
|
||||
OPCODE(profiled_trust_me ,ld),
|
||||
OPCODE(profiled_retry_and_mark ,ld),
|
||||
OPCODE(count_call ,l),
|
||||
OPCODE(count_a_call ,e),
|
||||
OPCODE(count_retry ,l),
|
||||
OPCODE(count_retry_me ,ld),
|
||||
OPCODE(count_trust_me ,ld),
|
||||
OPCODE(count_retry_and_mark ,ld),
|
||||
OPCODE(lock_lu ,p),
|
||||
OPCODE(unlock_lu ,e),
|
||||
OPCODE(alloc_for_logical_pred ,EC),
|
||||
OPCODE(unify_idb_term ,e),
|
||||
OPCODE(copy_idb_term ,e),
|
||||
#if defined(THREADS)
|
||||
OPCODE(thread_local ,e),
|
||||
#endif
|
||||
#ifdef SFUNC
|
||||
OPCODE(get_s_f ,),
|
||||
OPCODE(put_s_f ,),
|
||||
OPCODE(unify_s_f ,),
|
||||
OPCODE(write_s_f ,),
|
||||
OPCODE(unify_s_xvar ,),
|
||||
OPCODE(unify_s_yvar ,),
|
||||
OPCODE(write_s_xvar ,),
|
||||
OPCODE(write_s_yvar ,),
|
||||
OPCODE(unify_s_xval ,),
|
||||
OPCODE(unify_s_yval ,),
|
||||
OPCODE(write_s_xval ,),
|
||||
OPCODE(write_s_yval ,),
|
||||
OPCODE(unify_s_a ,),
|
||||
OPCODE(write_s_a ,),
|
||||
OPCODE(get_s_end ,),
|
||||
OPCODE(put_s_end ,),
|
||||
OPCODE(unify_s_end ,),
|
||||
OPCODE(write_s_end ,),
|
||||
#endif /* SFUNC */
|
||||
OPCODE(p_atom_x ,xF),
|
||||
OPCODE(p_atom_y ,yF),
|
||||
OPCODE(p_atomic_x ,xF),
|
||||
OPCODE(p_atomic_y ,yF),
|
||||
OPCODE(p_integer_x ,xF),
|
||||
OPCODE(p_integer_y ,yF),
|
||||
OPCODE(p_nonvar_x ,xF),
|
||||
OPCODE(p_nonvar_y ,yF),
|
||||
OPCODE(p_number_x ,xF),
|
||||
OPCODE(p_number_y ,yF),
|
||||
OPCODE(p_var_x ,xF),
|
||||
OPCODE(p_var_y ,yF),
|
||||
OPCODE(p_compound_x ,xF),
|
||||
OPCODE(p_compound_y ,yF),
|
||||
OPCODE(p_float_x ,xF),
|
||||
OPCODE(p_float_y ,yF),
|
||||
OPCODE(p_db_ref_x ,xF),
|
||||
OPCODE(p_db_ref_y ,yF),
|
||||
OPCODE(p_cut_by_x ,xF),
|
||||
OPCODE(p_cut_by_y ,yF),
|
||||
OPCODE(p_primitive_x ,xF),
|
||||
OPCODE(p_primitive_y ,yF),
|
||||
OPCODE(p_equal ,e),
|
||||
OPCODE(p_dif ,l),
|
||||
OPCODE(p_eq ,l),
|
||||
OPCODE(p_functor ,e),
|
||||
OPCODE(p_plus_vv ,xxx),
|
||||
OPCODE(p_plus_vc ,xxc),
|
||||
OPCODE(p_plus_y_vv ,yxx),
|
||||
OPCODE(p_plus_y_vc ,yxc),
|
||||
OPCODE(p_minus_vv ,xxx),
|
||||
OPCODE(p_minus_cv ,xcx),
|
||||
OPCODE(p_minus_y_vv ,yxx),
|
||||
OPCODE(p_minus_y_cv ,ycx),
|
||||
OPCODE(p_times_vv ,xxx),
|
||||
OPCODE(p_times_vc ,xxc),
|
||||
OPCODE(p_times_y_vv ,yxx),
|
||||
OPCODE(p_times_y_vc ,yxc),
|
||||
OPCODE(p_div_vv ,xxx),
|
||||
OPCODE(p_div_cv ,xcx),
|
||||
OPCODE(p_div_vc ,xxc),
|
||||
OPCODE(p_div_y_vv ,yxx),
|
||||
OPCODE(p_div_y_cv ,ycx),
|
||||
OPCODE(p_div_y_vc ,yxc),
|
||||
OPCODE(p_and_vv ,xxx),
|
||||
OPCODE(p_and_vc ,xxc),
|
||||
OPCODE(p_and_y_vv ,yxx),
|
||||
OPCODE(p_and_y_vc ,yxc),
|
||||
OPCODE(p_or_vv ,xxx),
|
||||
OPCODE(p_or_vc ,xxc),
|
||||
OPCODE(p_or_y_vv ,yxx),
|
||||
OPCODE(p_or_y_vc ,yxc),
|
||||
OPCODE(p_sll_vv ,xxx),
|
||||
OPCODE(p_sll_cv ,xcx),
|
||||
OPCODE(p_sll_vc ,xxc),
|
||||
OPCODE(p_sll_y_vv ,yxx),
|
||||
OPCODE(p_sll_y_cv ,ycx),
|
||||
OPCODE(p_sll_y_vc ,yxc),
|
||||
OPCODE(p_slr_vv ,xcx),
|
||||
OPCODE(p_slr_vc ,xxc),
|
||||
OPCODE(p_slr_cv ,xcx),
|
||||
OPCODE(p_slr_y_vv ,yxx),
|
||||
OPCODE(p_slr_y_vc ,yxc),
|
||||
OPCODE(p_slr_y_cv ,ycx),
|
||||
OPCODE(p_arg_vv ,xxx),
|
||||
OPCODE(p_arg_cv ,xxc),
|
||||
OPCODE(p_arg_y_vv ,yxx),
|
||||
OPCODE(p_arg_y_cv ,yxc),
|
||||
OPCODE(p_func2s_vv ,xxx),
|
||||
OPCODE(p_func2s_cv ,xcx),
|
||||
OPCODE(p_func2s_vc ,xxc),
|
||||
OPCODE(p_func2s_y_vv ,xxx),
|
||||
OPCODE(p_func2s_y_cv ,xcx),
|
||||
OPCODE(p_func2s_y_vc ,xxc),
|
||||
OPCODE(p_func2f_xx ,xxx),
|
||||
OPCODE(p_func2f_xy ,xyx),
|
||||
OPCODE(p_func2f_yx ,yxx),
|
||||
OPCODE(p_func2f_yy ,yyx),
|
||||
OPCODE(p_execute ,sla),
|
||||
OPCODE(p_execute2 ,sla),
|
||||
OPCODE(p_execute_tail ,e)
|
||||
|
||||
|
||||
|
193
H/amidefs.h
193
H/amidefs.h
@ -105,7 +105,7 @@ typedef enum {
|
||||
#undef OPCODE
|
||||
} op_numbers;
|
||||
|
||||
#define _std_top _p_execute_tail
|
||||
#define _std_top _or_last
|
||||
|
||||
/* use similar trick for keeping instruction names */
|
||||
#if defined(ANALYST) || defined(DEBUG)
|
||||
@ -164,12 +164,20 @@ typedef enum {
|
||||
The meaning of the symbols in a abstract machine instruction is:
|
||||
|
||||
c: constant, is a Term
|
||||
d: double (functor + unaligned)
|
||||
b: bitmap (CELL *)
|
||||
d: double (functor + unaligned double)
|
||||
f: functor
|
||||
F: Function, CPredicate
|
||||
i: large integer (functor + long)
|
||||
l: label, yamop *
|
||||
L: logic upd clause, logic_upd_clause *
|
||||
m: module, Term
|
||||
o: opcode, OPCODE
|
||||
s: small integer, COUNT
|
||||
x: wam register, wamreg
|
||||
|
||||
|
||||
d: predicate definition
|
||||
f: functor
|
||||
n: small number
|
||||
x: argument or temporary register
|
||||
y: environment slot
|
||||
@ -232,38 +240,15 @@ typedef struct yami {
|
||||
CELL next;
|
||||
} d;
|
||||
struct {
|
||||
Int ClTrail;
|
||||
Int ClENV;
|
||||
Int ClRefs;
|
||||
struct logic_upd_clause *ClBase;
|
||||
#if defined(THREADS) || defined(YAPOR)
|
||||
struct pred_entry *p;
|
||||
#endif
|
||||
CELL next;
|
||||
} EC;
|
||||
} L;
|
||||
struct {
|
||||
Functor f;
|
||||
Int a;
|
||||
CELL next;
|
||||
} f;
|
||||
} fa;
|
||||
struct {
|
||||
Functor f;
|
||||
CODEADDR l1;
|
||||
CODEADDR l2;
|
||||
CELL next;
|
||||
} fll;
|
||||
struct {
|
||||
wamreg x;
|
||||
struct yami *f;
|
||||
CELL next;
|
||||
} fx;
|
||||
struct {
|
||||
yslot y;
|
||||
struct yami *f;
|
||||
CELL next;
|
||||
} fy;
|
||||
struct {
|
||||
OPCODE opcw;
|
||||
CELL i[2];
|
||||
CELL next;
|
||||
} i;
|
||||
@ -272,11 +257,8 @@ typedef struct yami {
|
||||
struct yami *l1;
|
||||
struct yami *l2;
|
||||
COUNT s;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
struct pred_entry *p;
|
||||
#endif
|
||||
CELL next;
|
||||
} Ill;
|
||||
} Ills;
|
||||
struct {
|
||||
struct yami *l;
|
||||
CELL next;
|
||||
@ -288,11 +270,16 @@ typedef struct yami {
|
||||
#ifdef TABLING
|
||||
struct table_entry *te; /* pointer to table entry */
|
||||
#endif /* TABLING */
|
||||
COUNT s;
|
||||
Int s;
|
||||
struct pred_entry *p;
|
||||
struct yami *d;
|
||||
CELL next;
|
||||
} ld;
|
||||
} apl;
|
||||
/* The next two instructions are twin: they both correspond to the old ldd.
|
||||
The first one, aLl, handles try_logical and retry_logical,
|
||||
Ill handles trust_logical.
|
||||
They must have the same fields.
|
||||
*/
|
||||
struct {
|
||||
#ifdef YAPOR
|
||||
unsigned int or_arg;
|
||||
@ -300,16 +287,25 @@ typedef struct yami {
|
||||
#ifdef TABLING
|
||||
struct table_entry *te; /* pointer to table entry */
|
||||
#endif /* TABLING */
|
||||
union {
|
||||
/* either number of arguments or */
|
||||
COUNT s;
|
||||
/* timestamp it was entered */
|
||||
struct logic_upd_index *block;
|
||||
} t;
|
||||
/* number of arguments */
|
||||
COUNT s;
|
||||
struct logic_upd_clause *d;
|
||||
struct yami *n;
|
||||
CELL next;
|
||||
} lld;
|
||||
} aLl;
|
||||
struct {
|
||||
#ifdef YAPOR
|
||||
unsigned int or_arg;
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
struct table_entry *te; /* pointer to table entry */
|
||||
#endif /* TABLING */
|
||||
/* number of arguments */
|
||||
struct logic_upd_index *block;
|
||||
struct logic_upd_clause *d;
|
||||
struct yami *n;
|
||||
CELL next;
|
||||
} ILl;
|
||||
struct {
|
||||
#ifdef YAPOR
|
||||
unsigned int or_arg;
|
||||
@ -317,30 +313,12 @@ typedef struct yami {
|
||||
#ifdef TABLING
|
||||
struct table_entry *te; /* pointer to table entry */
|
||||
#endif /* TABLING */
|
||||
COUNT s;
|
||||
struct pred_entry *p;
|
||||
struct yami *d;
|
||||
struct yami *bl;
|
||||
CELL next;
|
||||
} ldl;
|
||||
struct {
|
||||
CODEADDR l;
|
||||
SMALLUNSGN flags;
|
||||
CELL next;
|
||||
} lf;
|
||||
struct {
|
||||
#ifdef YAPOR
|
||||
unsigned int or_arg;
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
struct table_entry *te; /* pointer to table entry */
|
||||
#endif /* TABLING */
|
||||
COUNT s;
|
||||
Int s;
|
||||
struct pred_entry *p;
|
||||
CPredicate f;
|
||||
COUNT extra;
|
||||
CELL next;
|
||||
} lds;
|
||||
} apFs;
|
||||
struct {
|
||||
struct yami *l1;
|
||||
struct yami *l2;
|
||||
@ -348,20 +326,6 @@ typedef struct yami {
|
||||
CELL next;
|
||||
} lll;
|
||||
struct {
|
||||
#ifdef YAPOR
|
||||
unsigned int or_arg;
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
struct table_entry *te; /* pointer to table entry */
|
||||
#endif /* TABLING */
|
||||
COUNT s;
|
||||
struct pred_entry *p;
|
||||
struct yami *l1;
|
||||
struct yami *l2;
|
||||
struct yami *l3;
|
||||
CELL next;
|
||||
} slll;
|
||||
struct {
|
||||
struct yami *l1;
|
||||
struct yami *l2;
|
||||
struct yami *l3;
|
||||
@ -389,25 +353,25 @@ typedef struct yami {
|
||||
struct yami *f;
|
||||
wamreg x1;
|
||||
wamreg x2;
|
||||
wamreg flags;
|
||||
COUNT flags;
|
||||
CELL next;
|
||||
} llxx;
|
||||
} plxxs;
|
||||
struct {
|
||||
struct pred_entry *p;
|
||||
struct yami *f;
|
||||
wamreg x;
|
||||
yslot y;
|
||||
wamreg flags;
|
||||
COUNT flags;
|
||||
CELL next;
|
||||
} llxy;
|
||||
} plxys;
|
||||
struct {
|
||||
struct pred_entry *p;
|
||||
struct yami *f;
|
||||
wamreg y1;
|
||||
yslot y2;
|
||||
wamreg flags;
|
||||
COUNT flags;
|
||||
CELL next;
|
||||
} llyy;
|
||||
} plyys;
|
||||
struct {
|
||||
OPCODE pop;
|
||||
struct yami *l1;
|
||||
@ -422,7 +386,7 @@ typedef struct yami {
|
||||
} o;
|
||||
struct {
|
||||
OPCODE opcw;
|
||||
CELL c;
|
||||
Term c;
|
||||
CELL next;
|
||||
} oc;
|
||||
struct {
|
||||
@ -435,7 +399,7 @@ typedef struct yami {
|
||||
Functor f;
|
||||
Int a;
|
||||
CELL next;
|
||||
} of;
|
||||
} ofa;
|
||||
struct {
|
||||
OPCODE opcw;
|
||||
CELL i[2];
|
||||
@ -481,6 +445,7 @@ typedef struct yami {
|
||||
COUNT s;
|
||||
CELL next;
|
||||
} s;
|
||||
/* format of expand_clauses */
|
||||
struct {
|
||||
COUNT s1;
|
||||
COUNT s2;
|
||||
@ -488,7 +453,7 @@ typedef struct yami {
|
||||
struct yami *sprev, *snext;
|
||||
struct pred_entry *p;
|
||||
CELL next;
|
||||
} sp;
|
||||
} sssllp;
|
||||
struct {
|
||||
COUNT s;
|
||||
CELL c;
|
||||
@ -500,21 +465,39 @@ typedef struct yami {
|
||||
struct yami *l;
|
||||
struct pred_entry *p;
|
||||
CELL next;
|
||||
} sdl;
|
||||
} sdlp;
|
||||
/* the next 3 instructions must have same size and have fields in same order! */
|
||||
/* also check env for yes and trustfail code before making any changes */
|
||||
struct {
|
||||
#ifdef YAPOR
|
||||
unsigned int or_arg;
|
||||
#endif /* YAPOR */
|
||||
COUNT s;
|
||||
CELL *bmap;
|
||||
union {
|
||||
struct yami *l;
|
||||
struct pred_entry *p;
|
||||
Term mod;
|
||||
} sla_u;
|
||||
struct yami *l;
|
||||
struct pred_entry *p0;
|
||||
CELL next;
|
||||
} sla; /* also check env for yes and trustfail code before making any changes */
|
||||
} sblp;
|
||||
struct {
|
||||
#ifdef YAPOR
|
||||
unsigned int or_arg;
|
||||
#endif /* YAPOR */
|
||||
COUNT s;
|
||||
CELL *bmap;
|
||||
struct pred_entry *p;
|
||||
struct pred_entry *p0;
|
||||
CELL next;
|
||||
} sbpp;
|
||||
struct {
|
||||
#ifdef YAPOR
|
||||
unsigned int or_arg;
|
||||
#endif /* YAPOR */
|
||||
COUNT s;
|
||||
CELL *bmap;
|
||||
Term mod;
|
||||
struct pred_entry *p0;
|
||||
CELL next;
|
||||
} sbmp;
|
||||
struct {
|
||||
COUNT s; /* size of table */
|
||||
COUNT e; /* live entries */
|
||||
@ -541,12 +524,12 @@ typedef struct yami {
|
||||
Functor f;
|
||||
Int a;
|
||||
CELL next;
|
||||
} xf;
|
||||
} xfa;
|
||||
struct {
|
||||
wamreg x;
|
||||
struct yami *F;
|
||||
CELL next;
|
||||
} xF;
|
||||
} xl;
|
||||
struct {
|
||||
wamreg x;
|
||||
CELL i[2];
|
||||
@ -578,10 +561,10 @@ typedef struct yami {
|
||||
} xxxx;
|
||||
struct {
|
||||
wamreg x;
|
||||
Int c;
|
||||
wamreg xi;
|
||||
COUNT c;
|
||||
CELL next;
|
||||
} xcx, xxc;
|
||||
} xxc;
|
||||
struct {
|
||||
wamreg x;
|
||||
yslot y;
|
||||
@ -589,10 +572,10 @@ typedef struct yami {
|
||||
} xy;
|
||||
struct {
|
||||
wamreg x;
|
||||
yslot y2;
|
||||
wamreg x1;
|
||||
yslot y2;
|
||||
CELL next;
|
||||
} xyx;
|
||||
} xxy;
|
||||
struct {
|
||||
yslot y;
|
||||
CELL next;
|
||||
@ -601,7 +584,7 @@ typedef struct yami {
|
||||
yslot y;
|
||||
struct yami *F;
|
||||
CELL next;
|
||||
} yF;
|
||||
} yl;
|
||||
struct {
|
||||
yslot y;
|
||||
wamreg x;
|
||||
@ -626,11 +609,11 @@ typedef struct yami {
|
||||
CELL next;
|
||||
} yyy;
|
||||
struct {
|
||||
wamreg xi;
|
||||
yslot y;
|
||||
Int c;
|
||||
wamreg xi;
|
||||
CELL next;
|
||||
} ycx, yxc;
|
||||
} yxc;
|
||||
} u;
|
||||
} yamop;
|
||||
|
||||
@ -780,12 +763,12 @@ typedef struct choicept {
|
||||
#endif
|
||||
#define RealEnvSize (EnvSizeInCells*sizeof(CELL))
|
||||
|
||||
#define ENV_Size(cp) (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,sla)))->u.sla.s)
|
||||
#define ENV_ToP(cp) (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,sla)))->u.sla.sla_u.p)
|
||||
#define ENV_ToOp(cp) (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,sla)))->opc)
|
||||
#define ENV_Size(cp) (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->u.sbpp.s)
|
||||
#define ENV_ToP(cp) (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->u.sla.p)
|
||||
#define ENV_ToOp(cp) (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->opc)
|
||||
#define EnvSize(cp) ((-ENV_Size(cp))/(OPREG)sizeof(CELL))
|
||||
#define EnvBMap(p) (((yamop *)((CODEADDR)(p) - (CELL)NEXTOP((yamop *)NULL,sla)))->u.sla.bmap)
|
||||
#define EnvPreg(p) (((yamop *)((CODEADDR)(p) - (CELL)NEXTOP((yamop *)NULL,sla)))->u.sla.p0)
|
||||
#define EnvBMap(p) (((yamop *)((CODEADDR)(p) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->u.sbpp.bmap)
|
||||
#define EnvPreg(p) (((yamop *)((CODEADDR)(p) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->u.sbpp.p0)
|
||||
|
||||
/* access to instructions */
|
||||
|
||||
|
@ -33,7 +33,7 @@ typedef union CONSULT_OBJ {
|
||||
#define ASSEMBLING_INDEX 1
|
||||
#define ASSEMBLING_EINDEX 2
|
||||
|
||||
#define NextDynamicClause(X) (((yamop *)X)->u.ld.d)
|
||||
#define NextDynamicClause(X) (((yamop *)X)->u.apl.d)
|
||||
|
||||
#define PredFirstClause 0
|
||||
#define PredMiddleClause 1
|
||||
@ -197,7 +197,7 @@ typedef struct dbterm_list {
|
||||
|
||||
/* amasm.c */
|
||||
wamreg STD_PROTO(Yap_emit_x,(CELL));
|
||||
wamreg STD_PROTO(Yap_compile_cmp_flags,(PredEntry *));
|
||||
COUNT STD_PROTO(Yap_compile_cmp_flags,(PredEntry *));
|
||||
void STD_PROTO(Yap_InitComma,(void));
|
||||
|
||||
/* cdmgr.c */
|
||||
|
232
H/rclause.h
232
H/rclause.h
@ -192,30 +192,30 @@ restore_opcodes(yamop *pc)
|
||||
case _table_answer_resolution:
|
||||
case _table_completion:
|
||||
#endif /* TABLING */
|
||||
pc->u.ld.p = PtoPredAdjust(pc->u.ld.p);
|
||||
pc->u.ld.d = PtoOpAdjust(pc->u.ld.d);
|
||||
pc = NEXTOP(pc,ld);
|
||||
pc->u.apl.p = PtoPredAdjust(pc->u.apl.p);
|
||||
pc->u.apl.d = PtoOpAdjust(pc->u.apl.d);
|
||||
pc = NEXTOP(pc,apl);
|
||||
break;
|
||||
case _try_logical:
|
||||
case _retry_logical:
|
||||
case _count_retry_logical:
|
||||
case _profiled_retry_logical:
|
||||
pc->u.lld.n = PtoOpAdjust(pc->u.lld.n);
|
||||
pc->u.lld.d = PtoLUClauseAdjust(pc->u.lld.d);
|
||||
pc = pc->u.lld.n;
|
||||
pc->u.aLl.n = PtoOpAdjust(pc->u.aLl.n);
|
||||
pc->u.aLl.d = PtoLUClauseAdjust(pc->u.aLl.d);
|
||||
pc = pc->u.aLl.n;
|
||||
break;
|
||||
case _trust_logical:
|
||||
case _count_trust_logical:
|
||||
case _profiled_trust_logical:
|
||||
pc->u.lld.n = PtoOpAdjust(pc->u.lld.n);
|
||||
pc->u.lld.d = PtoLUClauseAdjust(pc->u.lld.d);
|
||||
pc->u.lld.t.block = PtoLUIndexAdjust(pc->u.lld.t.block);
|
||||
pc->u.ILl.n = PtoOpAdjust(pc->u.ILl.n);
|
||||
pc->u.ILl.d = PtoLUClauseAdjust(pc->u.ILl.d);
|
||||
pc->u.ILl.block = PtoLUIndexAdjust(pc->u.ILl.block);
|
||||
return;
|
||||
case _enter_lu_pred:
|
||||
pc->u.Ill.I = (LogUpdIndex *)PtoOpAdjust((yamop *)(pc->u.Ill.I));
|
||||
pc->u.Ill.l1 = PtoOpAdjust(pc->u.Ill.l1);
|
||||
pc->u.Ill.l2 = PtoOpAdjust(pc->u.Ill.l2);
|
||||
pc = pc->u.Ill.l1;
|
||||
pc->u.Ills.I = (LogUpdIndex *)PtoOpAdjust((yamop *)(pc->u.Ills.I));
|
||||
pc->u.Ills.l1 = PtoOpAdjust(pc->u.Ills.l1);
|
||||
pc->u.Ills.l2 = PtoOpAdjust(pc->u.Ills.l2);
|
||||
pc = pc->u.Ills.l1;
|
||||
break;
|
||||
/* instructions type p */
|
||||
#if !defined(YAPOR)
|
||||
@ -259,13 +259,10 @@ restore_opcodes(yamop *pc)
|
||||
pc->u.xll.x = XAdjust(pc->u.xll.x);
|
||||
pc = NEXTOP(pc,xll);
|
||||
break;
|
||||
/* instructions type EC */
|
||||
/* instructions type L */
|
||||
case _alloc_for_logical_pred:
|
||||
pc->u.EC.ClBase = (struct logic_upd_clause *)PtoOpAdjust((yamop *)pc->u.EC.ClBase);
|
||||
#if defined(THREADS) || defined(YAPOR)
|
||||
pc->u.EC.p = PtoPredAdjust(pc->u.EC.p);
|
||||
#endif
|
||||
pc = NEXTOP(pc,EC);
|
||||
pc->u.L.ClBase = (struct logic_upd_clause *)PtoOpAdjust((yamop *)pc->u.L.ClBase);
|
||||
pc = NEXTOP(pc,L);
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _unify_idb_term:
|
||||
@ -358,7 +355,7 @@ restore_opcodes(yamop *pc)
|
||||
pc->u.x.x = XAdjust(pc->u.x.x);
|
||||
pc = NEXTOP(pc,x);
|
||||
break;
|
||||
/* instructions type xF */
|
||||
/* instructions type xl */
|
||||
case _p_atom_x:
|
||||
case _p_atomic_x:
|
||||
case _p_integer_x:
|
||||
@ -370,9 +367,9 @@ restore_opcodes(yamop *pc)
|
||||
case _p_compound_x:
|
||||
case _p_float_x:
|
||||
case _p_cut_by_x:
|
||||
pc->u.xF.x = XAdjust(pc->u.xF.x);
|
||||
pc->u.xF.F = PtoOpAdjust(pc->u.xF.F);
|
||||
pc = NEXTOP(pc,xF);
|
||||
pc->u.xl.x = XAdjust(pc->u.xl.x);
|
||||
pc->u.xl.F = PtoOpAdjust(pc->u.xl.F);
|
||||
pc = NEXTOP(pc,xl);
|
||||
break;
|
||||
case _expand_clauses:
|
||||
Yap_Error(SYSTEM_ERROR, TermNil,
|
||||
@ -387,7 +384,7 @@ restore_opcodes(yamop *pc)
|
||||
pc->u.y.y = YAdjust(pc->u.y.y);
|
||||
pc = NEXTOP(pc,y);
|
||||
break;
|
||||
/* instructions type yF */
|
||||
/* instructions type yl */
|
||||
case _p_atom_y:
|
||||
case _p_atomic_y:
|
||||
case _p_integer_y:
|
||||
@ -399,57 +396,61 @@ restore_opcodes(yamop *pc)
|
||||
case _p_compound_y:
|
||||
case _p_float_y:
|
||||
case _p_cut_by_y:
|
||||
pc->u.yF.y = YAdjust(pc->u.yF.y);
|
||||
pc->u.yF.F = PtoOpAdjust(pc->u.yF.F);
|
||||
pc = NEXTOP(pc,yF);
|
||||
pc->u.yl.y = YAdjust(pc->u.yl.y);
|
||||
pc->u.yl.F = PtoOpAdjust(pc->u.yl.F);
|
||||
pc = NEXTOP(pc,yl);
|
||||
break;
|
||||
/* instructions type sla */
|
||||
case _p_execute_tail:
|
||||
/* instructions type sbpp */
|
||||
case _p_execute:
|
||||
if (pc->u.sbmp.mod != 0) {
|
||||
pc->u.sbmp.mod = AtomTermAdjust(pc->u.sbmp.mod);
|
||||
}
|
||||
pc->u.sbmp.p0 = PtoPredAdjust(pc->u.sbmp.p0);
|
||||
if (pc->u.sbmp.bmap != NULL) {
|
||||
pc->u.sbmp.bmap = CellPtoHeapAdjust(pc->u.sbmp.bmap);
|
||||
}
|
||||
pc = NEXTOP(pc,sbmp);
|
||||
break;
|
||||
case _p_execute_tail:
|
||||
case _p_execute2:
|
||||
if (pc->u.sla.sla_u.mod != 0) {
|
||||
if (IsAtomTerm(pc->u.sla.sla_u.mod))
|
||||
pc->u.sla.sla_u.mod = AtomTermAdjust(pc->u.sla.sla_u.mod);
|
||||
else
|
||||
pc->u.sla.sla_u.p = PtoPredAdjust(pc->u.sla.sla_u.p);
|
||||
pc->u.sbpp.p = PtoPredAdjust(pc->u.sbpp.p);
|
||||
pc->u.sbpp.p0 = PtoPredAdjust(pc->u.sbpp.p0);
|
||||
if (pc->u.sbpp.bmap != NULL) {
|
||||
pc->u.sbpp.bmap = CellPtoHeapAdjust(pc->u.sbpp.bmap);
|
||||
}
|
||||
pc->u.sla.p0 = PtoPredAdjust(pc->u.sla.p0);
|
||||
if (pc->u.sla.bmap != NULL) {
|
||||
pc->u.sla.bmap = CellPtoHeapAdjust(pc->u.sla.bmap);
|
||||
}
|
||||
pc = NEXTOP(pc,sla);
|
||||
pc = NEXTOP(pc,sbpp);
|
||||
break;
|
||||
case _fcall:
|
||||
case _call:
|
||||
#ifdef YAPOR
|
||||
case _or_last:
|
||||
#endif
|
||||
pc->u.sla.sla_u.p = PtoPredAdjust(pc->u.sla.sla_u.p);
|
||||
if (pc->u.sla.bmap != NULL) {
|
||||
pc->u.sla.bmap = CellPtoHeapAdjust(pc->u.sla.bmap);
|
||||
pc->u.sbpp.p = PtoPredAdjust(pc->u.sbpp.p);
|
||||
if (pc->u.sbpp.bmap != NULL) {
|
||||
pc->u.sbpp.bmap = CellPtoHeapAdjust(pc->u.sbpp.bmap);
|
||||
}
|
||||
pc->u.sla.p0 = PtoPredAdjust(pc->u.sla.p0);
|
||||
pc = NEXTOP(pc,sla);
|
||||
pc->u.sbpp.p0 = PtoPredAdjust(pc->u.sbpp.p0);
|
||||
pc = NEXTOP(pc,sbpp);
|
||||
break;
|
||||
/* instructions type sla, but for disjunctions */
|
||||
/* instructions type sbpp, but for disjunctions */
|
||||
case _either:
|
||||
case _or_else:
|
||||
if (pc->u.sla.bmap != NULL) {
|
||||
pc->u.sla.bmap = CellPtoHeapAdjust(pc->u.sla.bmap);
|
||||
if (pc->u.sblp.bmap != NULL) {
|
||||
pc->u.sblp.bmap = CellPtoHeapAdjust(pc->u.sblp.bmap);
|
||||
}
|
||||
pc->u.sla.sla_u.l = PtoOpAdjust(pc->u.sla.sla_u.l);
|
||||
pc->u.sla.p0 = PtoPredAdjust(pc->u.sla.p0);
|
||||
pc = NEXTOP(pc,sla);
|
||||
pc->u.sblp.l = PtoOpAdjust(pc->u.sblp.l);
|
||||
pc->u.sblp.p0 = PtoPredAdjust(pc->u.sblp.p0);
|
||||
pc = NEXTOP(pc,sblp);
|
||||
break;
|
||||
/* instructions type sla, but for functions */
|
||||
/* instructions type sbpp, but for functions */
|
||||
case _call_cpred:
|
||||
case _call_usercpred:
|
||||
pc->u.sla.sla_u.p = PtoPredAdjust(pc->u.sla.sla_u.p);
|
||||
pc->u.sla.p0 = PtoPredAdjust(pc->u.sla.p0);
|
||||
if (pc->u.sla.bmap != NULL) {
|
||||
pc->u.sla.bmap = CellPtoHeapAdjust(pc->u.sla.bmap);
|
||||
pc->u.sbpp.p = PtoPredAdjust(pc->u.sbpp.p);
|
||||
pc->u.sbpp.p0 = PtoPredAdjust(pc->u.sbpp.p0);
|
||||
if (pc->u.sbpp.bmap != NULL) {
|
||||
pc->u.sbpp.bmap = CellPtoHeapAdjust(pc->u.sbpp.bmap);
|
||||
}
|
||||
pc = NEXTOP(pc,sla);
|
||||
pc = NEXTOP(pc,sbpp);
|
||||
break;
|
||||
/* instructions type xx */
|
||||
case _get_x_var:
|
||||
@ -682,12 +683,12 @@ restore_opcodes(yamop *pc)
|
||||
}
|
||||
pc = NEXTOP(pc,cccccc);
|
||||
break;
|
||||
/* instructions type xf */
|
||||
/* instructions type xfa */
|
||||
case _get_struct:
|
||||
case _put_struct:
|
||||
pc->u.xf.x = XAdjust(pc->u.xf.x);
|
||||
pc->u.xf.f = FuncAdjust(pc->u.xf.f);
|
||||
pc = NEXTOP(pc,xf);
|
||||
pc->u.xfa.x = XAdjust(pc->u.xfa.x);
|
||||
pc->u.xfa.f = FuncAdjust(pc->u.xfa.f);
|
||||
pc = NEXTOP(pc,xfa);
|
||||
break;
|
||||
/* instructions type xy */
|
||||
case _glist_valy:
|
||||
@ -819,14 +820,14 @@ restore_opcodes(yamop *pc)
|
||||
}
|
||||
pc = NEXTOP(pc,osc);
|
||||
break;
|
||||
/* instructions type of */
|
||||
/* instructions type ofa */
|
||||
case _unify_struct_write:
|
||||
case _unify_struct:
|
||||
case _unify_l_struc_write:
|
||||
case _unify_l_struc:
|
||||
pc->u.of.opcw = Yap_opcode(Yap_op_from_opcode(pc->u.of.opcw));
|
||||
pc->u.of.f = FuncAdjust(pc->u.of.f);
|
||||
pc = NEXTOP(pc,of);
|
||||
pc->u.ofa.opcw = Yap_opcode(Yap_op_from_opcode(pc->u.ofa.opcw));
|
||||
pc->u.ofa.f = FuncAdjust(pc->u.ofa.f);
|
||||
pc = NEXTOP(pc,ofa);
|
||||
break;
|
||||
/* instructions type s */
|
||||
case _write_n_voids:
|
||||
@ -872,29 +873,29 @@ restore_opcodes(yamop *pc)
|
||||
/* instructions type f */
|
||||
case _write_struct:
|
||||
case _write_l_struc:
|
||||
pc->u.f.f = FuncAdjust(pc->u.f.f);
|
||||
pc = NEXTOP(pc,f);
|
||||
pc->u.fa.f = FuncAdjust(pc->u.fa.f);
|
||||
pc = NEXTOP(pc,fa);
|
||||
break;
|
||||
/* instructions type sdl */
|
||||
/* instructions type sdlp */
|
||||
case _call_c_wfail:
|
||||
pc->u.sdl.p = PtoPredAdjust(pc->u.sdl.p);
|
||||
pc->u.sdl.l = PtoOpAdjust(pc->u.sdl.l);
|
||||
pc = NEXTOP(pc,sdl);
|
||||
pc->u.sdlp.p = PtoPredAdjust(pc->u.sdlp.p);
|
||||
pc->u.sdlp.l = PtoOpAdjust(pc->u.sdlp.l);
|
||||
pc = NEXTOP(pc,sdlp);
|
||||
break;
|
||||
/* instructions type lds */
|
||||
/* instructions type apFs */
|
||||
case _try_c:
|
||||
case _try_userc:
|
||||
/* don't need to do no nothing here, initstaff will do it for us
|
||||
*/
|
||||
pc->u.lds.p = PtoPredAdjust(pc->u.lds.p);
|
||||
pc = NEXTOP(pc,lds);
|
||||
pc->u.apFs.p = PtoPredAdjust(pc->u.apFs.p);
|
||||
pc = NEXTOP(pc,apFs);
|
||||
break;
|
||||
case _retry_c:
|
||||
case _retry_userc:
|
||||
/* don't need to do no nothing here, initstaff will do it for us
|
||||
pc->u.lds.d = CCodeAdjust(pc->u.lds.d); */
|
||||
pc->u.lds.p = PtoPredAdjust(pc->u.lds.p);
|
||||
pc = NEXTOP(pc,lds);
|
||||
pc->u.apFs.d = CCodeAdjust(pc->u.apFs.d); */
|
||||
pc->u.apFs.p = PtoPredAdjust(pc->u.apFs.p);
|
||||
pc = NEXTOP(pc,apFs);
|
||||
break;
|
||||
#ifdef CUT_C
|
||||
case _cut_c:
|
||||
@ -1095,23 +1096,23 @@ restore_opcodes(yamop *pc)
|
||||
case _p_sll_cv:
|
||||
case _p_slr_cv:
|
||||
case _p_arg_cv:
|
||||
pc->u.xcx.x = XAdjust(pc->u.xcx.x);
|
||||
pc->u.xcx.xi = XAdjust(pc->u.xcx.xi);
|
||||
pc = NEXTOP(pc,xcx);
|
||||
pc->u.xxc.x = XAdjust(pc->u.xxc.x);
|
||||
pc->u.xxc.xi = XAdjust(pc->u.xxc.xi);
|
||||
pc = NEXTOP(pc,xxc);
|
||||
break;
|
||||
case _p_func2s_cv:
|
||||
pc->u.xcx.x = XAdjust(pc->u.xcx.x);
|
||||
if (IsAtomTerm(pc->u.xcx.c))
|
||||
pc->u.xcx.c = AtomTermAdjust(pc->u.xcx.c);
|
||||
pc->u.xcx.xi = XAdjust(pc->u.xcx.xi);
|
||||
pc = NEXTOP(pc,xcx);
|
||||
pc->u.xxc.x = XAdjust(pc->u.xxc.x);
|
||||
if (IsAtomTerm(pc->u.xxc.c))
|
||||
pc->u.xxc.c = AtomTermAdjust(pc->u.xxc.c);
|
||||
pc->u.xxc.xi = XAdjust(pc->u.xxc.xi);
|
||||
pc = NEXTOP(pc,xxc);
|
||||
break;
|
||||
/* instructions type xyx */
|
||||
/* instructions type xxy */
|
||||
case _p_func2f_xy:
|
||||
pc->u.xyx.x = XAdjust(pc->u.xyx.x);
|
||||
pc->u.xyx.x1 = XAdjust(pc->u.xyx.x1);
|
||||
pc->u.xyx.y2 = YAdjust(pc->u.xyx.y2);
|
||||
pc = NEXTOP(pc,xyx);
|
||||
pc->u.xxy.x = XAdjust(pc->u.xxy.x);
|
||||
pc->u.xxy.x1 = XAdjust(pc->u.xxy.x1);
|
||||
pc->u.xxy.y2 = YAdjust(pc->u.xxy.y2);
|
||||
pc = NEXTOP(pc,xxy);
|
||||
break;
|
||||
/* instructions type yxx */
|
||||
case _p_plus_y_vv:
|
||||
@ -1152,45 +1153,44 @@ restore_opcodes(yamop *pc)
|
||||
pc->u.yxc.xi = XAdjust(pc->u.yxc.xi);
|
||||
pc = NEXTOP(pc,yxc);
|
||||
break;
|
||||
/* instructions type ycx */
|
||||
/* instructions type yxc */
|
||||
case _p_sll_y_cv:
|
||||
case _p_slr_y_cv:
|
||||
case _p_arg_y_cv:
|
||||
pc->u.ycx.y = YAdjust(pc->u.ycx.y);
|
||||
pc->u.ycx.xi = XAdjust(pc->u.ycx.xi);
|
||||
pc = NEXTOP(pc,ycx);
|
||||
pc->u.yxc.y = YAdjust(pc->u.yxc.y);
|
||||
pc->u.yxc.xi = XAdjust(pc->u.yxc.xi);
|
||||
pc = NEXTOP(pc,yxc);
|
||||
break;
|
||||
/* instructions type ycx */
|
||||
case _p_func2s_y_cv:
|
||||
pc->u.ycx.y = YAdjust(pc->u.ycx.y);
|
||||
if (IsAtomTerm(pc->u.ycx.c))
|
||||
pc->u.ycx.c = AtomTermAdjust(pc->u.ycx.c);
|
||||
pc->u.ycx.xi = XAdjust(pc->u.ycx.xi);
|
||||
pc = NEXTOP(pc,ycx);
|
||||
pc->u.yxc.y = YAdjust(pc->u.yxc.y);
|
||||
if (IsAtomTerm(pc->u.yxc.c))
|
||||
pc->u.yxc.c = AtomTermAdjust(pc->u.yxc.c);
|
||||
pc->u.yxc.xi = XAdjust(pc->u.yxc.xi);
|
||||
pc = NEXTOP(pc,yxc);
|
||||
break;
|
||||
/* instructions type llxx */
|
||||
/* instructions type plxxs */
|
||||
case _call_bfunc_xx:
|
||||
pc->u.llxx.p = PtoPredAdjust(pc->u.llxx.p);
|
||||
pc->u.llxx.f = PtoOpAdjust(pc->u.llxx.f);
|
||||
pc->u.llxx.x1 = XAdjust(pc->u.llxx.x1);
|
||||
pc->u.llxx.x2 = XAdjust(pc->u.llxx.x2);
|
||||
pc = NEXTOP(pc,llxx);
|
||||
pc->u.plxxs.p = PtoPredAdjust(pc->u.plxxs.p);
|
||||
pc->u.plxxs.f = PtoOpAdjust(pc->u.plxxs.f);
|
||||
pc->u.plxxs.x1 = XAdjust(pc->u.plxxs.x1);
|
||||
pc->u.plxxs.x2 = XAdjust(pc->u.plxxs.x2);
|
||||
pc = NEXTOP(pc,plxxs);
|
||||
break;
|
||||
/* instructions type llxy */
|
||||
/* instructions type plxys */
|
||||
case _call_bfunc_yx:
|
||||
case _call_bfunc_xy:
|
||||
pc->u.llxy.p = PtoPredAdjust(pc->u.llxy.p);
|
||||
pc->u.llxy.f = PtoOpAdjust(pc->u.llxy.f);
|
||||
pc->u.llxy.x = XAdjust(pc->u.llxy.x);
|
||||
pc->u.llxy.y = YAdjust(pc->u.llxy.y);
|
||||
pc = NEXTOP(pc,llxy);
|
||||
pc->u.plxys.p = PtoPredAdjust(pc->u.plxys.p);
|
||||
pc->u.plxys.f = PtoOpAdjust(pc->u.plxys.f);
|
||||
pc->u.plxys.x = XAdjust(pc->u.plxys.x);
|
||||
pc->u.plxys.y = YAdjust(pc->u.plxys.y);
|
||||
pc = NEXTOP(pc,plxys);
|
||||
break;
|
||||
case _call_bfunc_yy:
|
||||
pc->u.llyy.p = PtoPredAdjust(pc->u.llyy.p);
|
||||
pc->u.llyy.f = PtoOpAdjust(pc->u.llxy.f);
|
||||
pc->u.llyy.y1 = YAdjust(pc->u.llyy.y1);
|
||||
pc->u.llyy.y2 = YAdjust(pc->u.llyy.y2);
|
||||
pc = NEXTOP(pc,llyy);
|
||||
pc->u.plyys.p = PtoPredAdjust(pc->u.plyys.p);
|
||||
pc->u.plyys.f = PtoOpAdjust(pc->u.plyys.f);
|
||||
pc->u.plyys.y1 = YAdjust(pc->u.plyys.y1);
|
||||
pc->u.plyys.y2 = YAdjust(pc->u.plyys.y2);
|
||||
pc = NEXTOP(pc,plyys);
|
||||
break;
|
||||
}
|
||||
} while (TRUE);
|
||||
|
22
H/rheap.h
22
H/rheap.h
@ -244,17 +244,17 @@ static char SccsId[] = "@(#)rheap.c 1.3 3/15/90";
|
||||
static void
|
||||
do_clean_susp_clauses(yamop *ipc) {
|
||||
COUNT i;
|
||||
yamop **st = (yamop **)NEXTOP(ipc,sp);
|
||||
yamop **st = (yamop **)NEXTOP(ipc,sssllp);
|
||||
|
||||
ipc->opc = Yap_opcode(_expand_clauses);
|
||||
ipc->u.sp.p = PtoPredAdjust(ipc->u.sp.p);
|
||||
if (ipc->u.sp.sprev) {
|
||||
ipc->u.sp.sprev = PtoOpAdjust(ipc->u.sp.sprev);
|
||||
ipc->u.sssllp.p = PtoPredAdjust(ipc->u.sssllp.p);
|
||||
if (ipc->u.sssllp.sprev) {
|
||||
ipc->u.sssllp.sprev = PtoOpAdjust(ipc->u.sssllp.sprev);
|
||||
}
|
||||
if (ipc->u.sp.snext) {
|
||||
ipc->u.sp.snext = PtoOpAdjust(ipc->u.sp.snext);
|
||||
if (ipc->u.sssllp.snext) {
|
||||
ipc->u.sssllp.snext = PtoOpAdjust(ipc->u.sssllp.snext);
|
||||
}
|
||||
for (i = 0; i < ipc->u.sp.s1; i++, st++) {
|
||||
for (i = 0; i < ipc->u.sssllp.s1; i++, st++) {
|
||||
if (*st) {
|
||||
*st = PtoOpAdjust(*st);
|
||||
}
|
||||
@ -516,7 +516,7 @@ restore_codes(void)
|
||||
yamop *ptr = Yap_heap_regs->expand_clauses_first;
|
||||
while (ptr) {
|
||||
do_clean_susp_clauses(ptr);
|
||||
ptr = ptr->u.sp.snext;
|
||||
ptr = ptr->u.sssllp.snext;
|
||||
}
|
||||
}
|
||||
Yap_heap_regs->failcode->opc = Yap_opcode(_op_fail);
|
||||
@ -542,9 +542,9 @@ restore_codes(void)
|
||||
INIT_YAMOP_LTT(&(Yap_heap_regs->nocode), 1);
|
||||
INIT_YAMOP_LTT(&(Yap_heap_regs->rtrycode), 1);
|
||||
#endif /* YAPOR */
|
||||
if (((yamop *)(&Yap_heap_regs->rtrycode))->u.ld.d != NIL)
|
||||
((yamop *)(&Yap_heap_regs->rtrycode))->u.ld.d =
|
||||
PtoOpAdjust(((yamop *)(&Yap_heap_regs->rtrycode))->u.ld.d);
|
||||
if (((yamop *)(&Yap_heap_regs->rtrycode))->u.apl.d != NIL)
|
||||
((yamop *)(&Yap_heap_regs->rtrycode))->u.apl.d =
|
||||
PtoOpAdjust(((yamop *)(&Yap_heap_regs->rtrycode))->u.apl.d);
|
||||
{
|
||||
int arity;
|
||||
arity = Yap_heap_regs->clausecode->arity;
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
|
||||
PBOp(getwork,ld)
|
||||
PBOp(getwork,apl)
|
||||
#ifdef TABLING
|
||||
if (DepFr_leader_cp(LOCAL_top_dep_fr) == LOCAL_top_cp) {
|
||||
/* the current top node is a leader node with consumer nodes below */
|
||||
@ -93,7 +93,7 @@
|
||||
|
||||
/* The idea is to check whether we are the last worker in the node.
|
||||
If we are, we can go ahead, otherwise we should call the scheduler. */
|
||||
PBOp(getwork_seq,ld)
|
||||
PBOp(getwork_seq,apl)
|
||||
LOCK_OR_FRAME(LOCAL_top_or_fr);
|
||||
if (OrFr_alternative(LOCAL_top_or_fr) &&
|
||||
BITMAP_alone(OrFr_members(LOCAL_top_or_fr), worker_id)) {
|
||||
@ -108,9 +108,9 @@
|
||||
|
||||
|
||||
|
||||
PBOp(sync,ld)
|
||||
PBOp(sync,apl)
|
||||
CUT_wait_leftmost();
|
||||
PREG = NEXTOP(PREG, ld);
|
||||
PREG = NEXTOP(PREG, apl);
|
||||
PREFETCH_OP(PREG);
|
||||
GONext();
|
||||
ENDPBOp();
|
||||
|
@ -75,16 +75,16 @@ STD_PROTO(static inline qg_sol_fr_ptr CUT_prune_solution_frames, (qg_sol_fr_ptr,
|
||||
#define YAMOP_LTT_BITS OOOOPPS!!! Unknown Integer Sizeof
|
||||
#endif /* SIZEOF_INT */
|
||||
|
||||
#define YAMOP_OR_ARG(INST) ((INST)->u.ld.or_arg)
|
||||
#define YAMOP_LTT(INST) (((INST)->u.ld.or_arg) & YAMOP_LTT_BITS)
|
||||
#define YAMOP_SEQ(INST) (((INST)->u.ld.or_arg) & YAMOP_SEQ_FLAG)
|
||||
#define YAMOP_CUT(INST) (((INST)->u.ld.or_arg) & YAMOP_CUT_FLAG)
|
||||
#define YAMOP_FLAGS(INST) (((INST)->u.ld.or_arg) & YAMOP_FLAGS_BITS)
|
||||
#define YAMOP_OR_ARG(INST) ((INST)->u.apl.or_arg)
|
||||
#define YAMOP_LTT(INST) (((INST)->u.apl.or_arg) & YAMOP_LTT_BITS)
|
||||
#define YAMOP_SEQ(INST) (((INST)->u.apl.or_arg) & YAMOP_SEQ_FLAG)
|
||||
#define YAMOP_CUT(INST) (((INST)->u.apl.or_arg) & YAMOP_CUT_FLAG)
|
||||
#define YAMOP_FLAGS(INST) (((INST)->u.apl.or_arg) & YAMOP_FLAGS_BITS)
|
||||
|
||||
#define INIT_YAMOP_LTT(INST, LTT) (INST)->u.ld.or_arg = LTT
|
||||
#define PUT_YAMOP_LTT(INST, LTT) (INST)->u.ld.or_arg = YAMOP_FLAGS(INST) | (LTT)
|
||||
#define PUT_YAMOP_SEQ(INST) (INST)->u.ld.or_arg |= YAMOP_SEQ_FLAG
|
||||
#define PUT_YAMOP_CUT(INST) (INST)->u.ld.or_arg |= YAMOP_CUT_FLAG
|
||||
#define INIT_YAMOP_LTT(INST, LTT) (INST)->u.apl.or_arg = LTT
|
||||
#define PUT_YAMOP_LTT(INST, LTT) (INST)->u.apl.or_arg = YAMOP_FLAGS(INST) | (LTT)
|
||||
#define PUT_YAMOP_SEQ(INST) (INST)->u.apl.or_arg |= YAMOP_SEQ_FLAG
|
||||
#define PUT_YAMOP_CUT(INST) (INST)->u.apl.or_arg |= YAMOP_CUT_FLAG
|
||||
|
||||
#define BRANCH(WORKER, DEPTH) GLOBAL_branch(WORKER, DEPTH)
|
||||
#define BRANCH_LTT(WORKER, DEPTH) (BRANCH(WORKER, DEPTH) & YAMOP_LTT_BITS)
|
||||
|
@ -272,7 +272,7 @@
|
||||
|
||||
|
||||
|
||||
PBOp(table_load_answer, ld)
|
||||
PBOp(table_load_answer, apl)
|
||||
CELL *subs_ptr;
|
||||
ans_node_ptr ans_node;
|
||||
|
||||
@ -299,7 +299,7 @@
|
||||
|
||||
|
||||
|
||||
PBOp(table_try_answer, ld)
|
||||
PBOp(table_try_answer, apl)
|
||||
#ifdef INCOMPLETE_TABLING
|
||||
sg_fr_ptr sg_fr;
|
||||
ans_node_ptr ans_node;
|
||||
@ -330,16 +330,16 @@
|
||||
PREG = SgFr_code(sg_fr);
|
||||
if (PREG->opc == Yap_opcode(_table_try)) {
|
||||
/* table_try */
|
||||
code_ap = NEXTOP(PREG,ld);
|
||||
PREG = PREG->u.ld.d;
|
||||
code_ap = NEXTOP(PREG,apl);
|
||||
PREG = PREG->u.apl.d;
|
||||
} else if (PREG->opc == Yap_opcode(_table_try_single)) {
|
||||
/* table_try_single */
|
||||
code_ap = COMPLETION;
|
||||
PREG = PREG->u.ld.d;
|
||||
PREG = PREG->u.apl.d;
|
||||
} else {
|
||||
/* table_try_me */
|
||||
code_ap = PREG->u.ld.d;
|
||||
PREG = NEXTOP(PREG,ld);
|
||||
code_ap = PREG->u.apl.d;
|
||||
PREG = NEXTOP(PREG,apl);
|
||||
}
|
||||
PREFETCH_OP(PREG);
|
||||
restore_generator_node(SgFr_arity(sg_fr), code_ap);
|
||||
@ -350,7 +350,7 @@
|
||||
GONext();
|
||||
}
|
||||
#else
|
||||
PREG = PREG->u.ld.d;
|
||||
PREG = PREG->u.apl.d;
|
||||
PREFETCH_OP(PREG);
|
||||
GONext();
|
||||
#endif /* INCOMPLETE_TABLING */
|
||||
@ -358,12 +358,12 @@
|
||||
|
||||
|
||||
|
||||
PBOp(table_try_single, ld)
|
||||
PBOp(table_try_single, apl)
|
||||
tab_ent_ptr tab_ent;
|
||||
sg_fr_ptr sg_fr;
|
||||
|
||||
check_trail(TR);
|
||||
tab_ent = PREG->u.ld.te;
|
||||
tab_ent = PREG->u.apl.te;
|
||||
YENV2MEM;
|
||||
sg_fr = subgoal_search(PREG, YENV_ADDRESS);
|
||||
MEM2YENV;
|
||||
@ -372,8 +372,8 @@
|
||||
/* subgoal new */
|
||||
init_subgoal_frame(sg_fr);
|
||||
UNLOCK(SgFr_lock(sg_fr));
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.ld.s, COMPLETION);
|
||||
PREG = PREG->u.ld.d; /* should work also with PREG = NEXTOP(PREG,ld); */
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.apl.s, COMPLETION);
|
||||
PREG = PREG->u.apl.d; /* should work also with PREG = NEXTOP(PREG,apl); */
|
||||
PREFETCH_OP(PREG);
|
||||
allocate_environment();
|
||||
GONext();
|
||||
@ -385,7 +385,7 @@
|
||||
init_subgoal_frame(sg_fr);
|
||||
UNLOCK(SgFr_lock(sg_fr));
|
||||
SgFr_try_answer(sg_fr) = ans_node;
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.ld.s, TRY_ANSWER);
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.apl.s, TRY_ANSWER);
|
||||
PREG = (yamop *) CPREG;
|
||||
PREFETCH_OP(PREG);
|
||||
load_answer_trie(ans_node, subs_ptr);
|
||||
@ -467,12 +467,12 @@
|
||||
|
||||
|
||||
|
||||
PBOp(table_try_me, ld)
|
||||
PBOp(table_try_me, apl)
|
||||
tab_ent_ptr tab_ent;
|
||||
sg_fr_ptr sg_fr;
|
||||
|
||||
check_trail(TR);
|
||||
tab_ent = PREG->u.ld.te;
|
||||
tab_ent = PREG->u.apl.te;
|
||||
YENV2MEM;
|
||||
sg_fr = subgoal_search(PREG, YENV_ADDRESS);
|
||||
MEM2YENV;
|
||||
@ -481,8 +481,8 @@
|
||||
/* subgoal new */
|
||||
init_subgoal_frame(sg_fr);
|
||||
UNLOCK(SgFr_lock(sg_fr));
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.ld.s, PREG->u.ld.d);
|
||||
PREG = NEXTOP(PREG, ld);
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.apl.s, PREG->u.apl.d);
|
||||
PREG = NEXTOP(PREG, apl);
|
||||
PREFETCH_OP(PREG);
|
||||
allocate_environment();
|
||||
GONext();
|
||||
@ -494,7 +494,7 @@
|
||||
init_subgoal_frame(sg_fr);
|
||||
UNLOCK(SgFr_lock(sg_fr));
|
||||
SgFr_try_answer(sg_fr) = ans_node;
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.ld.s, TRY_ANSWER);
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.apl.s, TRY_ANSWER);
|
||||
PREG = (yamop *) CPREG;
|
||||
PREFETCH_OP(PREG);
|
||||
load_answer_trie(ans_node, subs_ptr);
|
||||
@ -576,12 +576,12 @@
|
||||
|
||||
|
||||
|
||||
PBOp(table_try, ld)
|
||||
PBOp(table_try, apl)
|
||||
tab_ent_ptr tab_ent;
|
||||
sg_fr_ptr sg_fr;
|
||||
|
||||
check_trail(TR);
|
||||
tab_ent = PREG->u.ld.te;
|
||||
tab_ent = PREG->u.apl.te;
|
||||
YENV2MEM;
|
||||
sg_fr = subgoal_search(PREG, YENV_ADDRESS);
|
||||
MEM2YENV;
|
||||
@ -590,8 +590,8 @@
|
||||
/* subgoal new */
|
||||
init_subgoal_frame(sg_fr);
|
||||
UNLOCK(SgFr_lock(sg_fr));
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.ld.s, NEXTOP(PREG,ld));
|
||||
PREG = PREG->u.ld.d;
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.apl.s, NEXTOP(PREG,apl));
|
||||
PREG = PREG->u.apl.d;
|
||||
PREFETCH_OP(PREG);
|
||||
allocate_environment();
|
||||
GONext();
|
||||
@ -603,7 +603,7 @@
|
||||
init_subgoal_frame(sg_fr);
|
||||
UNLOCK(SgFr_lock(sg_fr));
|
||||
SgFr_try_answer(sg_fr) = ans_node;
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.ld.s, TRY_ANSWER);
|
||||
store_generator_node(tab_ent, sg_fr, PREG->u.apl.s, TRY_ANSWER);
|
||||
PREG = (yamop *) CPREG;
|
||||
PREFETCH_OP(PREG);
|
||||
load_answer_trie(ans_node, subs_ptr);
|
||||
@ -685,49 +685,49 @@
|
||||
|
||||
|
||||
|
||||
Op(table_retry_me, ld)
|
||||
restore_generator_node(PREG->u.ld.s, PREG->u.ld.d);
|
||||
Op(table_retry_me, apl)
|
||||
restore_generator_node(PREG->u.apl.s, PREG->u.apl.d);
|
||||
YENV = (CELL *) PROTECT_FROZEN_B(B);
|
||||
set_cut(YENV, B->cp_b);
|
||||
SET_BB(NORM_CP(YENV));
|
||||
allocate_environment();
|
||||
PREG = NEXTOP(PREG,ld);
|
||||
PREG = NEXTOP(PREG,apl);
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
|
||||
|
||||
Op(table_retry, ld)
|
||||
restore_generator_node(PREG->u.ld.s, NEXTOP(PREG,ld));
|
||||
Op(table_retry, apl)
|
||||
restore_generator_node(PREG->u.apl.s, NEXTOP(PREG,apl));
|
||||
YENV = (CELL *) PROTECT_FROZEN_B(B);
|
||||
set_cut(YENV, B->cp_b);
|
||||
SET_BB(NORM_CP(YENV));
|
||||
allocate_environment();
|
||||
PREG = PREG->u.ld.d;
|
||||
PREG = PREG->u.apl.d;
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
|
||||
|
||||
Op(table_trust_me, ld)
|
||||
restore_generator_node(PREG->u.ld.s, COMPLETION);
|
||||
Op(table_trust_me, apl)
|
||||
restore_generator_node(PREG->u.apl.s, COMPLETION);
|
||||
YENV = (CELL *) PROTECT_FROZEN_B(B);
|
||||
set_cut(YENV, B->cp_b);
|
||||
SET_BB(NORM_CP(YENV));
|
||||
allocate_environment();
|
||||
PREG = NEXTOP(PREG,ld);
|
||||
PREG = NEXTOP(PREG,apl);
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
|
||||
|
||||
Op(table_trust, ld)
|
||||
restore_generator_node(PREG->u.ld.s, COMPLETION);
|
||||
Op(table_trust, apl)
|
||||
restore_generator_node(PREG->u.apl.s, COMPLETION);
|
||||
YENV = (CELL *) PROTECT_FROZEN_B(B);
|
||||
set_cut(YENV, B->cp_b);
|
||||
SET_BB(NORM_CP(YENV));
|
||||
allocate_environment();
|
||||
PREG = PREG->u.ld.d;
|
||||
PREG = PREG->u.apl.d;
|
||||
GONext();
|
||||
ENDOp();
|
||||
|
||||
@ -973,7 +973,7 @@
|
||||
|
||||
|
||||
|
||||
BOp(table_answer_resolution, ld)
|
||||
BOp(table_answer_resolution, apl)
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
UNLOCK_OR_FRAME(LOCAL_top_or_fr);
|
||||
@ -1259,7 +1259,7 @@
|
||||
|
||||
|
||||
|
||||
BOp(table_completion, ld)
|
||||
BOp(table_completion, apl)
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
if (IS_BATCHED_GEN_CP(B)) {
|
||||
|
@ -88,7 +88,7 @@ typedef struct subgoal_trie_node {
|
||||
typedef struct answer_trie_node {
|
||||
OPCODE trie_instruction; /* u.opc */
|
||||
#ifdef YAPOR
|
||||
int or_arg; /* u.ld.or_arg */
|
||||
int or_arg; /* u.apl.or_arg */
|
||||
#endif /* YAPOR */
|
||||
Term entry;
|
||||
#ifdef TABLE_LOCK_AT_NODE_LEVEL
|
||||
@ -182,8 +182,8 @@ typedef struct subgoal_frame {
|
||||
#define SgFr_gen_worker(X) ((X)->generator_worker)
|
||||
#define SgFr_gen_top_or_fr(X) ((X)->top_or_frame_on_generator_branch)
|
||||
#define SgFr_code(X) ((X)->code_of_subgoal)
|
||||
#define SgFr_tab_ent(X) (((X)->code_of_subgoal)->u.ld.te)
|
||||
#define SgFr_arity(X) (((X)->code_of_subgoal)->u.ld.s)
|
||||
#define SgFr_tab_ent(X) (((X)->code_of_subgoal)->u.apl.te)
|
||||
#define SgFr_arity(X) (((X)->code_of_subgoal)->u.apl.s)
|
||||
#define SgFr_state(X) ((X)->state_flag)
|
||||
#define SgFr_gen_cp(X) ((X)->generator_choice_point)
|
||||
#define SgFr_hash_chain(X) ((X)->hash_chain)
|
||||
|
@ -682,8 +682,8 @@ sg_fr_ptr subgoal_search(yamop *preg, CELL **Yaddr) {
|
||||
tab_ent_ptr tab_ent;
|
||||
sg_fr_ptr sg_fr;
|
||||
|
||||
arity = preg->u.ld.s;
|
||||
tab_ent = preg->u.ld.te;
|
||||
arity = preg->u.apl.s;
|
||||
tab_ent = preg->u.apl.te;
|
||||
count_vars = 0;
|
||||
stack_vars = *Yaddr;
|
||||
stack_terms_limit = (CELL *)TR;
|
||||
|
Reference in New Issue
Block a user