push changes to make tabling work: don't ignore tabling and yapor fields

in optype.
This commit is contained in:
Vítor Santos Costa 2008-09-05 05:22:19 +01:00
parent 65ccd336b2
commit fdf762e326
23 changed files with 814 additions and 804 deletions

466
C/absmi.c

File diff suppressed because it is too large Load Diff

View File

@ -115,6 +115,8 @@ AtomAdjust(Atom a)
#define CharP(X) ((char *)(X))
#define OrArgAdjust(P)
#define TabEntryAdjust(P)
#define IntegerAdjust(D) (D)
#define AddrAdjust(P) (P)
#define MFileAdjust(P) (P)

120
C/amasm.c
View File

@ -1296,22 +1296,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.sbpp.s = emit_count(-Signed(RealEnvSize) - CELLSIZE
code_p->u.Osbpp.s = emit_count(-Signed(RealEnvSize) - CELLSIZE
* (cip->cpc->rnd2));
if (RepPredProp(fe)->FunctorOfPred != FunctorExecuteInMod) {
code_p->u.sbpp.p = RepPredProp(fe);
code_p->u.Osbpp.p = RepPredProp(fe);
} else {
code_p->u.sbmp.mod = cip->cpc->rnd4;
code_p->u.Osbmp.mod = cip->cpc->rnd4;
}
code_p->u.sbpp.p0 = clinfo->CurrentPred;
code_p->u.Osbpp.p0 = clinfo->CurrentPred;
if (cip->cpc->rnd2) {
code_p->u.sbpp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
code_p->u.Osbpp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
} else {
/* there is no bitmap as there are no variables in the environment */
code_p->u.sbpp.bmap = NULL;
code_p->u.Osbpp.bmap = NULL;
}
}
GONEXT(sbpp);
GONEXT(Osbpp);
}
return code_p;
}
@ -1331,17 +1331,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.sbpp.s = emit_count(-Signed(RealEnvSize) - CELLSIZE *
code_p->u.Osbpp.s = emit_count(-Signed(RealEnvSize) - CELLSIZE *
cip->cpc->rnd2);
code_p->u.sbpp.p = RepPredProp(fe);
code_p->u.sbpp.p0 = clinfo->CurrentPred;
code_p->u.Osbpp.p = RepPredProp(fe);
code_p->u.Osbpp.p0 = clinfo->CurrentPred;
if (cip->cpc->rnd2)
code_p->u.sbpp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
code_p->u.Osbpp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
else
/* there is no bitmap as there are no variables in the environment */
code_p->u.sbpp.bmap = NULL;
code_p->u.Osbpp.bmap = NULL;
}
GONEXT(sbpp);
GONEXT(Osbpp);
}
else if (opcode == _execute ||
opcode == _dexecute) {
@ -1382,17 +1382,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.sbpp.s = emit_count(-Signed(RealEnvSize) - CELLSIZE *
code_p->u.Osbpp.s = emit_count(-Signed(RealEnvSize) - CELLSIZE *
cip->cpc->rnd2);
code_p->u.sbpp.p = pe;
code_p->u.sbpp.p0 = clinfo->CurrentPred;
code_p->u.Osbpp.p = pe;
code_p->u.Osbpp.p0 = clinfo->CurrentPred;
if (cip->cpc->rnd2)
code_p->u.sbpp.bmap = emit_bmlabel(cip->cpc->rnd1, cip);
code_p->u.Osbpp.bmap = emit_bmlabel(cip->cpc->rnd1, cip);
else
/* there is no bitmap as there are no variables in the environment */
code_p->u.sbpp.bmap = NULL;
code_p->u.Osbpp.bmap = NULL;
}
GONEXT(sbpp);
GONEXT(Osbpp);
return code_p;
}
@ -1828,7 +1828,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,aLl);
UInt size = (UInt)NEXTOP((yamop *)NULL,OtaLl);
if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) {
/* OOOPS, got in trouble, must do a longjmp and recover space */
save_machine_regs();
@ -1845,15 +1845,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.aLl.n = cip->try_instructions;
newcp->u.OtaLl.n = cip->try_instructions;
cip->try_instructions = newcp;
} else {
newcp->u.aLl.n = *cip->current_try_lab;
newcp->u.OtaLl.n = *cip->current_try_lab;
*cip->current_try_lab = newcp;
}
if (opcode == _try_clause) {
newcp->opc = emit_op(_try_logical);
newcp->u.aLl.s = emit_count(opr);
newcp->u.OtaLl.s = emit_count(opr);
} else if (opcode == _retry) {
if (ap->PredFlags & CountPredFlag)
newcp->opc = emit_op(_count_retry_logical);
@ -1861,7 +1861,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.aLl.s = emit_count(opr);
newcp->u.OtaLl.s = emit_count(opr);
} else {
if (ap->PredFlags & CountPredFlag)
newcp->opc = emit_op(_count_trust_logical);
@ -1869,11 +1869,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.ILl.block = (LogUpdIndex *)(cip->code_addr);
newcp->u.OtILl.block = (LogUpdIndex *)(cip->code_addr);
*cip->current_trust_lab = newcp;
}
newcp->u.aLl.d = ClauseCodeToLogUpdClause(emit_a(lab));
cip->current_try_lab = &(newcp->u.aLl.n);
newcp->u.OtaLl.d = ClauseCodeToLogUpdClause(emit_a(lab));
cip->current_try_lab = &(newcp->u.OtaLl.n);
}
return code_p;
}
@ -1929,11 +1929,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.apl.d = emit_a(lab);
code_p->u.apl.s = emit_count(opr);
code_p->u.apl.p = ap;
code_p->u.Otapl.d = emit_a(lab);
code_p->u.Otapl.s = emit_count(opr);
code_p->u.Otapl.p = ap;
#ifdef TABLING
code_p->u.apl.te = ap->TableOfPred;
code_p->u.Otapl.te = ap->TableOfPred;
#endif
#ifdef YAPOR
INIT_YAMOP_LTT(code_p, nofalts);
@ -1943,7 +1943,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod
PUT_YAMOP_SEQ(code_p);
#endif /* YAPOR */
}
GONEXT(apl);
GONEXT(Otapl);
return code_p;
}
@ -1956,9 +1956,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.sblp.s = emit_count(opr);
code_p->u.sblp.l = emit_a(lab);
code_p->u.sblp.p0 = cip->CurrentPred;
code_p->u.Osblp.s = emit_count(opr);
code_p->u.Osblp.l = emit_a(lab);
code_p->u.Osblp.p0 = cip->CurrentPred;
#ifdef YAPOR
INIT_YAMOP_LTT(code_p, nofalts);
if (hascut)
@ -1966,13 +1966,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.sblp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
code_p->u.Osblp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
}
#else
code_p->u.sblp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
code_p->u.Osblp.bmap = emit_bmlabel(cip->cpc->arnds[1], cip);
#endif /* YAPOR */
}
GONEXT(sblp);
GONEXT(Osblp);
return code_p;
}
@ -2858,7 +2858,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
*entry_codep = code_p;
if (tabled) {
#if TABLING
code_p = a_try(_table_try_single, (CELL)NEXTOP(code_p,apl), IPredArity, code_p, pass_no, cip);
code_p = a_try(_table_try_single, (CELL)NEXTOP(code_p,Otapl), IPredArity, code_p, pass_no, cip);
#endif
}
if (dynamic) {
@ -3597,7 +3597,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),apl),sbpp),e);
(CELL)NEXTOP(NEXTOP(NEXTOP((yamop *)(((DynamicClause *)NULL)->ClCode),Otapl ),Osbpp),e);
}
if ((CELL)code_p > size)
size = (CELL)code_p;
@ -3670,28 +3670,28 @@ Yap_InitComma(void)
{
yamop *code_p = COMMA_CODE;
code_p->opc = opcode(_call);
code_p->u.sbpp.s = emit_count(-Signed(RealEnvSize) - sizeof(CELL) * 3);
code_p->u.sbpp.p =
code_p->u.sbpp.p0 =
code_p->u.Osbpp.s = emit_count(-Signed(RealEnvSize) - sizeof(CELL) * 3);
code_p->u.Osbpp.p =
code_p->u.Osbpp.p0 =
RepPredProp(PredPropByFunc(FunctorComma,0));
code_p->u.sbpp.bmap = NULL;
GONEXT(sbpp);
code_p->u.Osbpp.bmap = NULL;
GONEXT(Osbpp);
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.sbpp.s = emit_count(-Signed(RealEnvSize));
code_p->u.sbpp.p =
code_p->u.sbpp.p0 =
code_p->u.Osbpp.s = emit_count(-Signed(RealEnvSize));
code_p->u.Osbpp.p =
code_p->u.Osbpp.p0 =
RepPredProp(Yap_GetPredPropByFunc(fp,0));
code_p->u.sbpp.bmap = NULL;
GONEXT(sbpp);
code_p->u.Osbpp.bmap = NULL;
GONEXT(Osbpp);
code_p->opc = emit_op(_call);
code_p->u.sbpp.s = emit_count(-Signed(RealEnvSize));
code_p->u.sbpp.p =
code_p->u.sbpp.p0 =
code_p->u.Osbpp.s = emit_count(-Signed(RealEnvSize));
code_p->u.Osbpp.p =
code_p->u.Osbpp.p0 =
PredMetaCall;
code_p->u.sbpp.bmap = NULL;
GONEXT(sbpp);
code_p->u.Osbpp.bmap = NULL;
GONEXT(Osbpp);
code_p->opc = emit_op(_deallocate);
code_p->u.p.p = PredMetaCall;
GONEXT(p);
@ -3708,11 +3708,11 @@ Yap_InitComma(void)
GONEXT(e);
}
code_p->opc = opcode(_p_execute_tail);
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 =
code_p->u.Osbpp.s = emit_count(-Signed(RealEnvSize)-3*sizeof(CELL));
code_p->u.Osbpp.bmap = NULL;
code_p->u.Osbpp.p =
code_p->u.Osbpp.p0 =
RepPredProp(PredPropByFunc(FunctorComma,0));
GONEXT(sbpp);
GONEXT(Osbpp);
}
}

View File

@ -515,8 +515,8 @@ dogc(void)
{
UInt arity;
if (P && PREVOP(P,sbpp)->opc == Yap_opcode(_call_usercpred)) {
arity = PREVOP(P,sbpp)->u.sbpp.p->ArityOfPE;
if (P && PREVOP(P,Osbpp)->opc == Yap_opcode(_call_usercpred)) {
arity = PREVOP(P,Osbpp)->u.Osbpp.p->ArityOfPE;
} else {
arity = 0;
}
@ -531,8 +531,8 @@ doexpand(UInt sz)
{
UInt arity;
if (P && PREVOP(P,sbpp)->opc == Yap_opcode(_call_usercpred)) {
arity = PREVOP(P,sbpp)->u.sbpp.p->ArityOfPE;
if (P && PREVOP(P,Osbpp)->opc == Yap_opcode(_call_usercpred)) {
arity = PREVOP(P,Osbpp)->u.Osbpp.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.apFs.extra));
ptr = (void *)(((CELL *)(Yap_REGS.CUT_C_TOP))-(((yamop *)Yap_REGS.CUT_C_TOP->try_userc_cut_yamop)->u.OtapFs.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.apFs.s);
ptr = (void *)((CELL *)(B+1)+P->u.OtapFs.s);
B->cp_h = H;
RECOVER_H();

148
C/cdmgr.c
View File

@ -549,7 +549,7 @@ PredForChoicePt(yamop *p_code) {
break;
case _retry_me:
case _trust_me:
return p_code->u.apl.p;
return p_code->u.Otapl.p;
case _try_logical:
case _retry_logical:
case _trust_logical:
@ -557,7 +557,7 @@ PredForChoicePt(yamop *p_code) {
case _count_trust_logical:
case _profiled_retry_logical:
case _profiled_trust_logical:
return p_code->u.aLl.d->ClPred;
return p_code->u.OtaLl.d->ClPred;
#ifdef TABLING
case _trie_retry_null:
case _trie_trust_null:
@ -586,17 +586,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.sblp.l) {
if (p_code == p_code->u.Osblp.l) {
/* repeat */
Atom at = Yap_LookupAtom("repeat ");
return RepPredProp(PredPropByAtom(at, PROLOG_MODULE));
} else {
return p_code->u.sblp.p0;
return p_code->u.Osblp.p0;
}
break;
case _or_last:
#ifdef YAPOR
return p_code->u.sblp.p0;
return p_code->u.Osblp.p0;
#else
return p_code->u.p.p;
#endif /* YAPOR */
@ -609,7 +609,7 @@ PredForChoicePt(yamop *p_code) {
p_code = NEXTOP(p_code,l);
break;
default:
return p_code->u.apl.p;
return p_code->u.Otapl.p;
}
}
return NULL;
@ -708,6 +708,8 @@ get_pred(Term t, Term tmod, char *pname)
******************************************************************/
#define OrArgAdjust(P)
#define TabEntryAdjust(P)
#define DoubleInCodeAdjust(D)
#define IntegerInCodeAdjust(D)
#define IntegerAdjust(D) (D)
@ -1113,8 +1115,8 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
break;
case _retry:
case _trust:
decrease_ref_counter(ipc->u.apl.d, beg, end, suspend_code);
ipc = NEXTOP(ipc,apl);
decrease_ref_counter(ipc->u.Otapl.d, beg, end, suspend_code);
ipc = NEXTOP(ipc,Otapl);
break;
case _try_clause:
case _try_me:
@ -1122,7 +1124,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,apl);
ipc = NEXTOP(ipc,Otapl);
break;
case _try_logical:
case _retry_logical:
@ -1130,9 +1132,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.aLl.d->ClCode, beg, end, suspend_code);
ipc = ipc->u.aLl.n;
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop *)NULL,aLl);
decrease_ref_counter(ipc->u.OtaLl.d->ClCode, beg, end, suspend_code);
ipc = ipc->u.OtaLl.n;
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop *)NULL,OtaLl);
Yap_FreeCodeSpace((ADDR)oipc);
#ifdef DEBUG
Yap_DirtyCps--;
@ -1147,8 +1149,8 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
Yap_DirtyCps--;
Yap_FreedCps++;
#endif
decrease_ref_counter(ipc->u.ILl.d->ClCode, beg, end, suspend_code);
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop *)NULL,ILl);
decrease_ref_counter(ipc->u.OtILl.d->ClCode, beg, end, suspend_code);
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop *)NULL,OtILl);
Yap_FreeCodeSpace((ADDR)ipc);
return;
case _enter_lu_pred:
@ -1666,12 +1668,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,apl),e),l));
(DynamicClause *) Yap_AllocCodeSpace((Int)NEXTOP(NEXTOP(NEXTOP(ncp,Otapl),e),l));
if (cl == NIL) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"Heap crashed against Stacks");
return;
}
Yap_ClauseSpace += (Int)NEXTOP(NEXTOP(NEXTOP(ncp,apl),e),l);
Yap_ClauseSpace += (Int)NEXTOP(NEXTOP(NEXTOP(ncp,Otapl),e),l);
/* skip the first entry, this contains the back link and will always be
empty for this entry */
ncp = (yamop *)(((CELL *)ncp)+1);
@ -1687,9 +1689,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.apl.s = p->ArityOfPE;
ncp->u.apl.p = p;
ncp->u.apl.d = cp;
ncp->u.Otapl.s = p->ArityOfPE;
ncp->u.Otapl.p = p;
ncp->u.Otapl.d = cp;
/* This is the point we enter the code */
p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = ncp;
p->cs.p_code.NOfClauses = 1;
@ -1708,9 +1710,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.apl.s = p->ArityOfPE;
cp->u.apl.p = p;
cp->u.apl.d = ncp;
cp->u.Otapl.s = p->ArityOfPE;
cp->u.Otapl.p = p;
cp->u.Otapl.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
@ -1718,7 +1720,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,apl);
ncp = NEXTOP(ncp,Otapl);
/* 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);
@ -1770,7 +1772,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.apl.d = q;
p->cs.p_code.LastClause->u.Otapl.d = q;
}
/* p is already locked */
@ -1786,22 +1788,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.apl.d = p->cs.p_code.FirstClause;
q->u.apl.s = p->ArityOfPE;
q->u.apl.p = p;
q->u.Otapl.d = p->cs.p_code.FirstClause;
q->u.Otapl.s = p->ArityOfPE;
q->u.Otapl.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.apl.s = p->ArityOfPE;
cp->u.apl.p = p;
cp->u.Otapl.s = p->ArityOfPE;
cp->u.Otapl.p = p;
p->cs.p_code.FirstClause = cp;
q = p->CodeOfPred;
q->u.apl.d = cp;
q->u.apl.s = p->ArityOfPE;
q->u.apl.p = p;
q->u.Otapl.d = cp;
q->u.Otapl.s = p->ArityOfPE;
q->u.Otapl.p = p;
}
@ -1859,7 +1861,7 @@ assertz_dynam_clause(PredEntry *p, yamop *cp)
q = p->cs.p_code.LastClause;
LOCK(ClauseCodeToDynamicClause(q)->ClLock);
q->u.apl.d = cp;
q->u.Otapl.d = cp;
p->cs.p_code.LastClause = cp;
/* also, keep backpointers for the days we'll delete all the clause */
cl->ClPrevious = q;
@ -1872,9 +1874,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.apl.d = p->CodeOfPred;
q->u.apl.s = p->ArityOfPE;
q->u.apl.p = p;
q->u.Otapl.d = p->CodeOfPred;
q->u.Otapl.s = p->ArityOfPE;
q->u.Otapl.p = p;
p->cs.p_code.NOfClauses++;
}
@ -3231,16 +3233,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.apl.d);
b_ptr->cp_ap = cur_log_upd_clause(pe, b_ptr->cp_ap->u.Otapl.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.apl.d);
b_ptr->cp_ap = cur_clause(pe, b_ptr->cp_ap->u.Otapl.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.apl.d);
b_ptr->cp_ap = cur_clause(pe, b_ptr->cp_ap->u.Otapl.d);
}
}
}
@ -3826,19 +3828,19 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
case _table_answer_resolution:
case _table_completion:
#endif /* TABLING */
pc = NEXTOP(pc, apl);
pc = NEXTOP(pc, Otapl);
break;
case _try_logical:
case _retry_logical:
case _count_retry_logical:
case _profiled_retry_logical:
pc = pc->u.aLl.n;
pc = pc->u.OtaLl.n;
break;
case _trust_logical:
case _count_trust_logical:
case _profiled_trust_logical:
{
LogUpdIndex *cl = pc->u.ILl.block;
LogUpdIndex *cl = pc->u.OtILl.block;
pp = cl->ClPred;
*startp = (CODEADDR)cl;
*endp = (CODEADDR)cl+cl->ClSize;
@ -4041,7 +4043,7 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
case _p_cut_by_y:
pc = NEXTOP(pc,yl);
break;
/* instructions type sbpp or sbmp */
/* instructions type Osbpp or Osbmp */
case _p_execute_tail:
case _p_execute:
case _p_execute2:
@ -4056,21 +4058,21 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
case _or_last:
#endif
clause_code = TRUE;
pp = pc->u.sbpp.p;
pc = NEXTOP(pc,sbpp);
pp = pc->u.Osbpp.p;
pc = NEXTOP(pc,Osbpp);
break;
/* instructions type sbpp, but for disjunctions */
/* instructions type Osbpp, but for disjunctions */
case _either:
case _or_else:
clause_code = TRUE;
pp = pc->u.sblp.p0;
pc = NEXTOP(pc,sblp);
pp = pc->u.Osblp.p0;
pc = NEXTOP(pc,Osblp);
break;
case _call_cpred:
case _call_usercpred:
clause_code = TRUE;
pp = pc->u.sbpp.p0;
pc = NEXTOP(pc,sbpp);
pp = pc->u.Osbpp.p0;
pc = NEXTOP(pc,Osbpp);
break;
/* instructions type xx */
case _get_x_var:
@ -4278,14 +4280,14 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
pp = pc->u.sdlp.p;
pc = NEXTOP(pc,sdlp);
break;
/* instructions type apFs */
/* instructions type OtapFs */
case _try_c:
case _try_userc:
case _retry_c:
case _retry_userc:
clause_code = TRUE;
pp = pc->u.apFs.p;
pc = NEXTOP(pc,apFs);
pp = pc->u.OtapFs.p;
pc = NEXTOP(pc,OtapFs);
break;
#ifdef CUT_C
case _cut_c:
@ -4938,7 +4940,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,apl), cp_ptr);
cl = Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredLogUpdClause->CodeOfPred,Otapl), cp_ptr);
th = Terms[0];
tb = Terms[1];
tr = Terms[2];
@ -5079,7 +5081,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,apl), cp_ptr);
cl = Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredLogUpdClauseErase->CodeOfPred,Otapl), cp_ptr);
th = Terms[0];
tb = Terms[1];
tr = Terms[2];
@ -5223,7 +5225,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,apl), cp_ptr);
cl = Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredLogUpdClause0->CodeOfPred,Otapl), cp_ptr);
th = Terms[0];
tb = Terms[1];
/* don't do this!! I might have stored a choice-point and changed ASP
@ -5372,9 +5374,9 @@ void /* $hidden_predicate(P) */
Yap_UpdateTimestamps(PredEntry *ap)
{
choiceptr bptr = B;
yamop *cl0 = NEXTOP(PredLogUpdClause0->CodeOfPred,apl);
yamop *cl = NEXTOP(PredLogUpdClause->CodeOfPred,apl);
yamop *cle = NEXTOP(PredLogUpdClauseErase->CodeOfPred,apl);
yamop *cl0 = NEXTOP(PredLogUpdClause0->CodeOfPred,Otapl);
yamop *cl = NEXTOP(PredLogUpdClause->CodeOfPred,Otapl);
yamop *cle = NEXTOP(PredLogUpdClauseErase->CodeOfPred,Otapl);
UInt ar = ap->ArityOfPE;
UInt *arp, *top, *base;
LogUpdClause *lcl;
@ -5398,7 +5400,7 @@ Yap_UpdateTimestamps(PredEntry *ap)
case _trust_logical:
case _count_trust_logical:
case _profiled_trust_logical:
if (bptr->cp_ap->u.aLl.d->ClPred == ap) {
if (bptr->cp_ap->u.OtaLl.d->ClPred == ap) {
UInt ts = IntegerOfTerm(bptr->cp_args[ar]);
if (ts != arp[0]) {
if (arp-H < 1024) {
@ -5462,7 +5464,7 @@ Yap_UpdateTimestamps(PredEntry *ap)
case _trust_logical:
case _count_trust_logical:
case _profiled_trust_logical:
if (bptr->cp_ap->u.aLl.d->ClPred == ap) {
if (bptr->cp_ap->u.OtaLl.d->ClPred == ap) {
UInt ts = IntegerOfTerm(bptr->cp_args[ar]);
while (ts != arp[0])
arp--;
@ -5504,7 +5506,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,apl), cp_ptr);
cl = (StaticClause *)Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredStaticClause->CodeOfPred,Otapl), cp_ptr);
UNLOCK(pe->PELock);
th = Terms[0];
tb = Terms[1];
@ -6026,7 +6028,7 @@ p_env_info(void)
env_b = MkIntegerTerm((Int)(LCL0-(CELL *)env[E_CB]));
env_cp = (yamop *)env[E_CP];
pe = PREVOP(env_cp,sbpp)->u.sbpp.p0;
pe = PREVOP(env_cp,Osbpp)->u.Osbpp.p0;
taddr = MkIntegerTerm((Int)env);
return Yap_unify(ARG3,MkIntegerTerm((Int)env_cp)) &&
Yap_unify(ARG2, taddr) &&
@ -6039,7 +6041,7 @@ p_cpc_info(void)
PredEntry *pe;
yamop *ipc = (yamop *)IntegerOfTerm(Deref(ARG1));
pe = PREVOP(ipc,sbpp)->u.sbpp.p0;
pe = PREVOP(ipc,Osbpp)->u.Osbpp.p0;
return UnifyPredInfo(pe, 2) &&
Yap_unify(ARG5,MkIntegerTerm(ClauseId(ipc,pe)));
}
@ -6119,12 +6121,12 @@ p_choicepoint_info(void)
case _count_trust_logical:
case _profiled_retry_logical:
case _profiled_trust_logical:
ncl = ipc->u.aLl.d->ClCode;
pe = ipc->u.aLl.d->ClPred;
ncl = ipc->u.OtaLl.d->ClCode;
pe = ipc->u.OtaLl.d->ClPred;
t = BuildActivePred(pe, cptr->cp_args);
break;
case _or_else:
pe = ipc->u.sblp.p0;
pe = ipc->u.Osblp.p0;
ncl = ipc;
t = Yap_MkNewApplTerm(FunctorOr, 2);
break;
@ -6140,7 +6142,7 @@ p_choicepoint_info(void)
t = TermNil;
ipc = NEXTOP(ipc,l);
if (!ncl)
ncl = ipc->u.apl.d;
ncl = ipc->u.Otapl.d;
go_on = TRUE;
break;
case _jump:
@ -6151,15 +6153,15 @@ p_choicepoint_info(void)
break;
case _retry_c:
case _retry_userc:
ncl = NEXTOP(ipc,apFs);
pe = ipc->u.apFs.p;
ncl = NEXTOP(ipc,OtapFs);
pe = ipc->u.OtapFs.p;
t = BuildActivePred(pe, cptr->cp_args);
break;
case _retry_profiled:
case _count_retry:
pe = NULL;
t = TermNil;
ncl = ipc->u.apl.d;
ncl = ipc->u.Otapl.d;
ipc = NEXTOP(ipc,p);
go_on = TRUE;
break;
@ -6174,8 +6176,8 @@ p_choicepoint_info(void)
case _retry:
case _trust:
if (!ncl)
ncl = ipc->u.apl.d;
pe = ipc->u.apl.p;
ncl = ipc->u.Otapl.d;
pe = ipc->u.Otapl.p;
t = BuildActivePred(pe, cptr->cp_args);
break;
case _Nstop:

View File

@ -3700,12 +3700,12 @@ index_sz(LogUpdIndex *x)
endop = Yap_opcode(_trust_logical);
start = start->u.Ills.l1;
do {
sz += (UInt)NEXTOP((yamop*)NULL,aLl);
sz += (UInt)NEXTOP((yamop*)NULL,OtaLl);
op1 = start->opc;
count++;
if (start->u.aLl.d->ClFlags & ErasedMask)
if (start->u.OtaLl.d->ClFlags & ErasedMask)
dead++;
start = start->u.aLl.n;
start = start->u.OtaLl.n;
} while (op1 != endop);
}
x = x->ChildIndex;
@ -3991,7 +3991,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,sbpp)))->u.sbpp.bmap);
DBRef ref = (DBRef)(((yamop *)((CODEADDR)P-(CELL)NEXTOP((yamop *)NULL,Osbpp)))->u.Osbpp.bmap);
yamop *newp = find_next_clause(ref);
if (newp == NULL) {
@ -4000,7 +4000,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,apl);
P = NEXTOP(newp,Otapl);
/* and return like if nothing had happened. */
return TRUE;
}
@ -4147,20 +4147,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,apl)->u.sbpp.bmap;
ref = (DBRef) NEXTOP(clau->ClCode,Otapl)->u.Osbpp.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.apl.d = find_next_clause((DBRef)(NEXTOP(P,apl)->u.sbpp.bmap));
if (np->u.apl.d == NULL)
np->u.Otapl.d = find_next_clause((DBRef)(NEXTOP(P,Otapl)->u.Osbpp.bmap));
if (np->u.Otapl.d == NULL)
P = (yamop *)FAILCODE;
else {
/* with same arity as before */
np->u.apl.s = P->u.apl.s;
np->u.apl.p = P->u.apl.p;
np->u.Otapl.s = P->u.Otapl.s;
np->u.Otapl.p = P->u.Otapl.p;
/* go ahead and try this code */
P = np;
}
@ -4210,7 +4210,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.apl.d = code_p->u.apl.d;
prev_code_p->u.Otapl.d = code_p->u.Otapl.d;
/* are we the last? */
if (p->cs.p_code.LastClause == cl)
p->cs.p_code.LastClause = prev_code_p;
@ -4219,7 +4219,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.apl.d;
p->cs.p_code.FirstClause = code_p->u.Otapl.d;
p->cs.p_code.FirstClause->opc =
Yap_opcode(_try_me);
}
@ -4234,8 +4234,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.apl.d = p->cs.p_code.FirstClause;
p->cs.p_code.TrueCodeOfPred = NEXTOP(code_p, apl);
code_p->u.Otapl.d = p->cs.p_code.FirstClause;
p->cs.p_code.TrueCodeOfPred = NEXTOP(code_p, Otapl);
if (p->PredFlags & SpiedPredFlag) {
p->OpcodeOfPred = Yap_opcode(_spy_pred);
p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred));
@ -5447,9 +5447,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,apFs);
RETRY_C_RECORDED_K_CODE = NEXTOP(PredRecordedWithKey->cs.p_code.FirstClause,OtapFs);
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,apFs);
RETRY_C_RECORDEDP_CODE = NEXTOP(RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom("$recordedp"), 3),0))->cs.p_code.FirstClause,OtapFs);
Yap_InitCPredBack("$current_immediate_key", 2, 4, init_current_key, cont_current_key,
SyncPredFlag|HiddenPredFlag);
}

View File

@ -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.sbpp.p->cs.f_code);
printf("Aqui está um call_cpred(%p) \n",y->u.Osbpp.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,sbpp)->opc);
op_numbers oop = Yap_op_from_opcode(PREVOP(P,Osbpp)->opc);
if (oop == _call_cpred || oop == _call_usercpred) {
/* doing C-code */
current_p = PREVOP(P,sbpp)->u.sbpp.p->CodeOfPred;
current_p = PREVOP(P,Osbpp)->u.Osbpp.p->CodeOfPred;
} else {
current_p = P;
}

View File

@ -1861,10 +1861,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,apl),
*lu_cl = NEXTOP(PredLogUpdClause->CodeOfPred,apl),
*lu_cle = NEXTOP(PredLogUpdClauseErase->CodeOfPred,apl),
*su_cl = NEXTOP(PredStaticClause->CodeOfPred,apl);
yamop *lu_cl0 = NEXTOP(PredLogUpdClause0->CodeOfPred,Otapl),
*lu_cl = NEXTOP(PredLogUpdClause->CodeOfPred,Otapl),
*lu_cle = NEXTOP(PredLogUpdClauseErase->CodeOfPred,Otapl),
*su_cl = NEXTOP(PredStaticClause->CodeOfPred,Otapl);
#ifdef TABLING
dep_fr_ptr depfr = LOCAL_top_dep_fr;
#endif /* TABLING */
@ -1933,8 +1933,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),
-gc_B->cp_cp->u.sblp.s / ((OPREG)sizeof(CELL)),
gc_B->cp_cp->u.sblp.bmap
-gc_B->cp_cp->u.Osblp.s / ((OPREG)sizeof(CELL)),
gc_B->cp_cp->u.Osblp.bmap
);
} else {
/* choicepoint with arguments */
@ -1982,7 +1982,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose)
}
B = old_b;
}
nargs = rtp->u.apFs.s+rtp->u.apFs.extra;
nargs = rtp->u.OtapFs.s+rtp->u.OtapFs.extra;
break;
case _jump:
rtp = rtp->u.l.l;
@ -2019,7 +2019,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.apl.s;
nargs = rtp->u.Otapl.s;
while (nargs--) {
mark_external_reference(vars_ptr);
vars_ptr++;
@ -2135,20 +2135,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.aLl.n;
yamop *end = rtp->u.OtaLl.n;
while (end->opc != trust_lu)
end = end->u.aLl.n;
mark_ref_in_use((DBRef)end->u.ILl.block);
end = end->u.OtaLl.n;
mark_ref_in_use((DBRef)end->u.OtILl.block);
}
/* mark timestamp */
nargs = rtp->u.aLl.s+1;
nargs = rtp->u.OtaLl.s+1;
break;
case _trust_logical:
case _count_trust_logical:
case _profiled_trust_logical:
/* mark timestamp */
mark_ref_in_use((DBRef)rtp->u.ILl.block);
nargs = rtp->u.ILl.d->ClPred->ArityOfPE+1;
mark_ref_in_use((DBRef)rtp->u.OtILl.block);
nargs = rtp->u.OtILl.d->ClPred->ArityOfPE+1;
break;
#ifdef DEBUG
case _retry_me:
@ -2159,14 +2159,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.apl.s;
nargs = rtp->u.Otapl.s;
break;
default:
fprintf(Yap_stderr, "OOps in GC: Unexpected opcode: %d\n", opnum);
nargs = 0;
#else
default:
nargs = rtp->u.apl.s;
nargs = rtp->u.Otapl.s;
#endif
}
@ -2180,8 +2180,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.aLl.n;
mark_ref_in_use((DBRef)pt->u.ILl.block);
pt = pt->u.OtaLl.n;
mark_ref_in_use((DBRef)pt->u.OtILl.block);
}
}
/* for each saved register */
@ -2791,8 +2791,8 @@ sweep_choicepoints(choiceptr gc_B)
case _or_last:
sweep_environments((CELL_PTR)(gc_B->cp_a1),
-gc_B->cp_cp->u.sblp.s / ((OPREG)sizeof(CELL)),
gc_B->cp_cp->u.sblp.bmap
-gc_B->cp_cp->u.Osblp.s / ((OPREG)sizeof(CELL)),
gc_B->cp_cp->u.Osblp.bmap
);
break;
case _retry_profiled:
@ -2835,7 +2835,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.apl.s;
nargs = rtp->u.Otapl.s;
while(nargs--) {
CELL cp_cell = *vars_ptr;
if (MARKED_PTR(vars_ptr)) {
@ -2981,12 +2981,12 @@ sweep_choicepoints(choiceptr gc_B)
case _count_retry_logical:
case _profiled_retry_logical:
/* sweep timestamp */
sweep_b(gc_B, rtp->u.aLl.s+1);
sweep_b(gc_B, rtp->u.OtaLl.s+1);
break;
case _trust_logical:
case _count_trust_logical:
case _profiled_trust_logical:
sweep_b(gc_B, rtp->u.ILl.d->ClPred->ArityOfPE+1);
sweep_b(gc_B, rtp->u.OtILl.d->ClPred->ArityOfPE+1);
break;
case _retry2:
sweep_b(gc_B, 2);
@ -3003,8 +3003,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.apFs.s;
saved_reg < &(gc_B->cp_a1)+rtp->u.apFs.s+rtp->u.apFs.extra;
for (saved_reg = &(gc_B->cp_a1)+rtp->u.OtapFs.s;
saved_reg < &(gc_B->cp_a1)+rtp->u.OtapFs.s+rtp->u.OtapFs.extra;
saved_reg++) {
CELL cp_cell = *saved_reg;
if (MARKED_PTR(saved_reg)) {
@ -3017,7 +3017,7 @@ sweep_choicepoints(choiceptr gc_B)
}
/* continue to clean environments and arguments */
default:
sweep_b(gc_B,rtp->u.apl.s);
sweep_b(gc_B,rtp->u.Otapl.s);
}
/* link to prev choicepoint */

232
C/index.c
View File

@ -936,7 +936,7 @@ has_cut(yamop *pc)
case _table_answer_resolution:
case _table_completion:
#endif /* TABLING */
pc = NEXTOP(pc,apl);
pc = NEXTOP(pc,Otapl);
break;
/* instructions type Ills */
case _enter_lu_pred:
@ -1319,17 +1319,17 @@ has_cut(yamop *pc)
case _try_userc:
pc = NEXTOP(pc,lds);
break;
/* instructions type aLl,ILl */
/* instructions type OtaLl,OtILl */
case _try_logical:
case _retry_logical:
case _count_retry_logical:
case _profiled_retry_logical:
pc = pc->u.aLl.n;
pc = pc->u.OtaLl.n;
break;
case _trust_logical:
case _count_trust_logical:
case _profiled_trust_logical:
pc = pc->u.ILl.n;
pc = pc->u.OtILl.n;
break;
case _retry_c:
case _retry_userc:
@ -2455,7 +2455,7 @@ add_info(ClauseDef *clause, UInt regno)
#endif /* YAPOR */
#ifdef TABLING
case _table_try_single:
cl = NEXTOP(cl,apl);
cl = NEXTOP(cl,Otapl);
break;
case _table_load_answer:
case _table_try_answer:
@ -3438,7 +3438,7 @@ emit_trust(ClauseDef *cl, struct intermediates *cint, UInt nxtlbl, int clauses)
yamop *clcode = cl->Code;
if (ap->PredFlags & TabledPredFlag)
clcode = NEXTOP(clcode,apl);
clcode = NEXTOP(clcode,Otapl);
if (!(ap->PredFlags & LogUpdatePredFlag)) {
/* this should not be generated for logical update predicates!! */
if (ap->PredFlags & ProfiledPredFlag) {
@ -3463,7 +3463,7 @@ emit_retry(ClauseDef *cl, struct intermediates *cint, int clauses)
yamop *clcode = cl->Code;
if (ap->PredFlags & TabledPredFlag)
clcode = NEXTOP(clcode,apl);
clcode = NEXTOP(clcode,Otapl);
if (!(ap->PredFlags & LogUpdatePredFlag)) {
/* this should not be generated for logical update predicates!! */
if (ap->PredFlags & ProfiledPredFlag) {
@ -3516,7 +3516,7 @@ emit_try(ClauseDef *cl, struct intermediates *cint, int var_group, int first, in
if (ap->PredFlags & LogUpdatePredFlag) {
clcode = cl->Code;
} else if (ap->PredFlags & TabledPredFlag) {
clcode = NEXTOP(cl->Code,apl);
clcode = NEXTOP(cl->Code,Otapl);
} else {
clcode = cl->CurrentCode;
}
@ -3851,7 +3851,7 @@ emit_single_switch_case(ClauseDef *min, struct intermediates *cint, int first, i
if we still have clauses left, means we already created a CP,
so I should avoid creating again
*/
return (UInt)NEXTOP(min->CurrentCode,apl);
return (UInt)NEXTOP(min->CurrentCode,Otapl);
}
}
#endif /* TABLING */
@ -5299,23 +5299,23 @@ expand_index(struct intermediates *cint) {
case _retry:
/* this clause had no indexing */
if (ap->PredFlags & LogUpdatePredFlag) {
first = ClauseCodeToLogUpdClause(ipc->u.apl.d)->ClNext->ClCode;
first = ClauseCodeToLogUpdClause(ipc->u.Otapl.d)->ClNext->ClCode;
} else if (ap->PredFlags & MegaClausePredFlag) {
MegaClause *mcl = ClauseCodeToMegaClause(ap->cs.p_code.FirstClause);
first = (yamop *)((char *)ipc->u.apl.d)+mcl->ClItemSize;
first = (yamop *)((char *)ipc->u.Otapl.d)+mcl->ClItemSize;
} else {
first = ClauseCodeToStaticClause(ipc->u.apl.d)->ClNext->ClCode;
first = ClauseCodeToStaticClause(ipc->u.Otapl.d)->ClNext->ClCode;
}
isfirstcl = FALSE;
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
#if TABLING
case _table_try:
case _table_retry:
/* this clause had no indexing */
first = ClauseCodeToStaticClause(PREVOP(ipc->u.apl.d,apl))->ClNext->ClCode;
first = ClauseCodeToStaticClause(PREVOP(ipc->u.Otapl.d,Otapl))->ClNext->ClCode;
isfirstcl = FALSE;
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
#endif /* TABLING */
case _try_clause2:
@ -5329,7 +5329,7 @@ expand_index(struct intermediates *cint) {
first = ClauseCodeToLogUpdClause(ipc->u.l.l)->ClNext->ClCode;
} else if (ap->PredFlags & MegaClausePredFlag) {
MegaClause *mcl = ClauseCodeToMegaClause(ap->cs.p_code.FirstClause);
first = (yamop *)((char *)ipc->u.apl.d)+mcl->ClItemSize;
first = (yamop *)((char *)ipc->u.Otapl.d)+mcl->ClItemSize;
} else {
first = ClauseCodeToStaticClause(ipc->u.l.l)->ClNext->ClCode;
}
@ -5348,8 +5348,8 @@ expand_index(struct intermediates *cint) {
/* ok, we found the start for an indexing block,
but we don't if we are going to operate here or not */
/* if we are to commit here, alt will tell us where */
alt = ipc->u.apl.d;
ipc = NEXTOP(ipc,apl);
alt = ipc->u.Otapl.d;
ipc = NEXTOP(ipc,Otapl);
/* start of a group, reset stack */
sp = stack;
stack[0].pos = 0;
@ -5361,7 +5361,7 @@ expand_index(struct intermediates *cint) {
case _table_trust_me:
#endif /* TABLING */
/* we will commit to this group for sure */
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
alt = NULL;
/* start of a group, reset stack */
sp = stack;
@ -5378,12 +5378,12 @@ expand_index(struct intermediates *cint) {
case _retry_logical:
case _count_retry_logical:
case _profiled_retry_logical:
ipc = ipc->u.aLl.n;
ipc = ipc->u.OtaLl.n;
break;
case _trust_logical:
case _count_trust_logical:
case _profiled_trust_logical:
ipc = ipc->u.ILl.n;
ipc = ipc->u.OtILl.n;
break;
case _enter_lu_pred:
/* no useful info */
@ -5626,7 +5626,7 @@ expand_index(struct intermediates *cint) {
ipc = NULL;
} else {
/* backtrack */
first = alt->u.apl.d;
first = alt->u.Otapl.d;
ipc = alt;
alt = NULL;
}
@ -5660,15 +5660,15 @@ expand_index(struct intermediates *cint) {
if (op >= _retry2 && op <= _retry4) {
last = alt->u.l.l;
} else {
last = alt->u.apl.d;
last = alt->u.Otapl.d;
}
} else {
op_numbers op = Yap_op_from_opcode(alt->opc);
if (op == _retry || op == _trust) {
last = alt->u.apl.d;
last = alt->u.Otapl.d;
#ifdef TABLING
} else if (op == _table_retry || op == _table_trust) {
last = PREVOP(alt->u.apl.d,apl);
last = PREVOP(alt->u.Otapl.d,Otapl);
#endif /* TABLING */
} else if (op >= _retry2 && op <= _retry4) {
last = alt->u.l.l;
@ -6338,10 +6338,10 @@ kill_block(path_stack_entry *sp, PredEntry *ap)
static LogUpdClause *
find_last_clause(yamop *start)
{
while (start->u.aLl.d->ClFlags & ErasedMask)
start = start->u.aLl.n;
while (start->u.OtaLl.d->ClFlags & ErasedMask)
start = start->u.OtaLl.n;
/* this should be the available clause */
return start->u.aLl.d;
return start->u.OtaLl.d;
}
static void
@ -6350,31 +6350,31 @@ remove_clause_from_index(yamop *header, LogUpdClause *cl)
yamop **prevp = &(header->u.Ills.l1);
yamop *curp = header->u.Ills.l1;
if (curp->u.aLl.d == cl) {
yamop *newp = curp->u.aLl.n;
if (curp->u.OtaLl.d == cl) {
yamop *newp = curp->u.OtaLl.n;
newp->opc = curp->opc;
*prevp = newp;
} else {
yamop *ocurp = NULL, *ocurp0 = curp;
while (curp->u.aLl.d != cl) {
while (curp->u.OtaLl.d != cl) {
ocurp = curp;
curp = curp->u.aLl.n;
curp = curp->u.OtaLl.n;
}
/* in case we were the last */
if (curp == header->u.Ills.l2)
header->u.Ills.l2 = ocurp;
if (ocurp != ocurp0)
ocurp->opc = curp->opc;
ocurp->u.ILl.n = curp->u.aLl.n;
ocurp->u.ILl.block = curp->u.ILl.block;
ocurp->u.OtILl.n = curp->u.OtaLl.n;
ocurp->u.OtILl.block = curp->u.OtILl.block;
}
#ifdef DEBUG
Yap_DirtyCps--;
Yap_FreedCps++;
#endif
clean_ref_to_clause(cl);
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop*)NULL,ILl);
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop*)NULL,OtILl);
Yap_FreeCodeSpace((ADDR)curp);
}
@ -6386,13 +6386,13 @@ remove_dirty_clauses_from_index(yamop *header)
OPCODE endop = Yap_opcode(_trust_logical);
yamop **prevp= &(header->u.Ills.l1), *curp = header->u.Ills.l1;
OPCODE startopc = curp->opc;
PredEntry *ap = curp->u.aLl.d->ClPred;
PredEntry *ap = curp->u.OtaLl.d->ClPred;
if (ap->PredFlags & CountPredFlag)
endop = Yap_opcode(_count_trust_logical);
else if (ap->PredFlags & ProfiledPredFlag)
endop = Yap_opcode(_profiled_trust_logical);
while ((cl = curp->u.aLl.d)->ClFlags & ErasedMask) {
while ((cl = curp->u.OtaLl.d)->ClFlags & ErasedMask) {
yamop *ocurp = curp;
#ifdef DEBUG
@ -6400,7 +6400,7 @@ remove_dirty_clauses_from_index(yamop *header)
Yap_FreedCps++;
#endif
clean_ref_to_clause(cl);
curp = curp->u.aLl.n;
curp = curp->u.OtaLl.n;
Yap_FreeCodeSpace((ADDR)ocurp);
}
*prevp = curp;
@ -6408,9 +6408,9 @@ remove_dirty_clauses_from_index(yamop *header)
if (curp->opc == endop)
return;
previouscurp = curp;
curp = curp->u.aLl.n;
curp = curp->u.OtaLl.n;
while (TRUE) {
if ((cl = curp->u.aLl.d)->ClFlags & ErasedMask) {
if ((cl = curp->u.OtaLl.d)->ClFlags & ErasedMask) {
yamop *ocurp = curp;
#ifdef DEBUG
@ -6420,24 +6420,24 @@ remove_dirty_clauses_from_index(yamop *header)
clean_ref_to_clause(cl);
if (curp->opc == endop) {
previouscurp->opc = endop;
previouscurp->u.ILl.block = curp->u.ILl.block;
previouscurp->u.ILl.n = NULL;
previouscurp->u.OtILl.block = curp->u.OtILl.block;
previouscurp->u.OtILl.n = NULL;
header->u.Ills.l2 = previouscurp;
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop*)NULL,ILl);
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop*)NULL,OtILl);
Yap_FreeCodeSpace((ADDR)curp);
return;
}
previouscurp->u.aLl.n = curp->u.aLl.n;
curp = curp->u.aLl.n;
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop*)NULL,aLl);
previouscurp->u.OtaLl.n = curp->u.OtaLl.n;
curp = curp->u.OtaLl.n;
Yap_LUIndexSpace_CP -= (UInt)NEXTOP((yamop*)NULL,OtaLl);
Yap_FreeCodeSpace((ADDR)ocurp);
} else {
previouscurp = curp;
if (curp->opc == endop) {
curp->u.ILl.n = NULL;
curp->u.OtILl.n = NULL;
return;
}
curp = curp->u.aLl.n;
curp = curp->u.OtaLl.n;
}
}
}
@ -6551,7 +6551,7 @@ static_clause(yamop *ipc, PredEntry *ap, int trust)
if (ap->PredFlags & MegaClausePredFlag)
return (StaticClause *)ipc;
if (ap->PredFlags & TabledPredFlag)
ipc = PREVOP(ipc,apl);
ipc = PREVOP(ipc,Otapl);
p = (CELL *)ipc;
if (trust) {
return ClauseCodeToStaticClause(p);
@ -6769,7 +6769,7 @@ static yamop *
add_try(PredEntry *ap, ClauseDef *cls, yamop *next, struct intermediates *cint)
{
yamop *newcp;
UInt size = (UInt)NEXTOP((yamop *)NULL,aLl);
UInt size = (UInt)NEXTOP((yamop *)NULL,OtaLl);
LogUpdClause *lcl = ClauseCodeToLogUpdClause(cls->Code);
if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) {
@ -6783,9 +6783,9 @@ add_try(PredEntry *ap, ClauseDef *cls, yamop *next, struct intermediates *cint)
Yap_LiveCps++;
#endif
newcp->opc = Yap_opcode(_try_logical);
newcp->u.aLl.s = ap->ArityOfPE;
newcp->u.aLl.n = next;
newcp->u.aLl.d = lcl;
newcp->u.OtaLl.s = ap->ArityOfPE;
newcp->u.OtaLl.n = next;
newcp->u.OtaLl.d = lcl;
lcl->ClRefCount++;
return newcp;
}
@ -6794,7 +6794,7 @@ static yamop *
add_trust(LogUpdIndex *icl, ClauseDef *cls, struct intermediates *cint)
{
yamop *newcp;
UInt size = (UInt)NEXTOP((yamop *)NULL,ILl);
UInt size = (UInt)NEXTOP((yamop *)NULL,OtILl);
LogUpdClause *lcl = ClauseCodeToLogUpdClause(cls->Code);
PredEntry *ap = lcl->ClPred;
@ -6814,9 +6814,9 @@ add_trust(LogUpdIndex *icl, ClauseDef *cls, struct intermediates *cint)
newcp->opc = Yap_opcode(_profiled_trust_logical);
else
newcp->opc = Yap_opcode(_trust_logical);
newcp->u.ILl.block = icl;
newcp->u.ILl.n = NULL;
newcp->u.ILl.d = lcl;
newcp->u.OtILl.block = icl;
newcp->u.OtILl.n = NULL;
newcp->u.OtILl.d = lcl;
lcl->ClRefCount++;
return newcp;
}
@ -6870,8 +6870,8 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
old->opc = Yap_opcode(_profiled_retry_logical);
else
old->opc = Yap_opcode(_retry_logical);
old->u.aLl.n = end;
old->u.aLl.s = ap->ArityOfPE;
old->u.OtaLl.n = end;
old->u.OtaLl.s = ap->ArityOfPE;
ipc->u.Ills.l2 = end;
}
ipc = pop_path(&sp, cls, ap);
@ -6885,7 +6885,7 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
ipc = pop_path(&sp, cls, ap);
} else {
/* just go to next instruction */
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
}
break;
case _try_clause2:
@ -6904,7 +6904,7 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
break;
case _retry:
/* this clause had no indexing */
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
case _retry2:
case _retry3:
@ -6916,26 +6916,26 @@ add_to_index(struct intermediates *cint, int first, path_stack_entry *sp, Clause
case _retry_me:
/* should never be reached both for asserta */
group1 = FALSE;
ipc = ipc->u.apl.d;
ipc = ipc->u.Otapl.d;
break;
case _try_me:
if (first) {
ipc = NEXTOP(ipc,apl);
alt = ipc->u.apl.d;
ipc = NEXTOP(ipc,Otapl);
alt = ipc->u.Otapl.d;
} else {
ipc = ipc->u.apl.d;
ipc = ipc->u.Otapl.d;
group1 = FALSE;
}
break;
case _retry_profiled:
case _count_retry:
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
case _profiled_trust_me:
case _trust_me:
case _count_trust_me:
group1 = FALSE;
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
case _trust:
sp = expandz_block(sp, ap, cls, group1, alt, cint);
@ -7436,12 +7436,12 @@ remove_from_index(PredEntry *ap, path_stack_entry *sp, ClauseDef *cls, yamop *bg
/* I cannot expand a predicate that starts on a variable,
have to expand the index.
*/
if (IN_BETWEEN(bg,ipc->u.apl.d,lt)) {
if (IN_BETWEEN(bg,ipc->u.Otapl.d,lt)) {
sp = kill_clause(ipc, bg, lt, sp, ap);
ipc = pop_path(&sp, cls, ap);
} else {
/* just go to next instruction */
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
}
break;
case _try_clause2:
@ -7462,7 +7462,7 @@ remove_from_index(PredEntry *ap, path_stack_entry *sp, ClauseDef *cls, yamop *bg
}
break;
case _trust:
if (IN_BETWEEN(bg,ipc->u.apl.d,lt)) {
if (IN_BETWEEN(bg,ipc->u.Otapl.d,lt)) {
sp = kill_clause(ipc, bg, lt, sp, ap);
}
ipc = pop_path(&sp, cls, ap);
@ -7479,13 +7479,13 @@ remove_from_index(PredEntry *ap, path_stack_entry *sp, ClauseDef *cls, yamop *bg
/* instructions type l */
case _try_me:
case _retry_me:
sp = push_path(sp, &(ipc->u.apl.d), cls, cint);
ipc = NEXTOP(ipc,apl);
sp = push_path(sp, &(ipc->u.Otapl.d), cls, cint);
ipc = NEXTOP(ipc,Otapl);
break;
case _profiled_trust_me:
case _trust_me:
case _count_trust_me:
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
case _jump:
sp = cross_block(sp, &ipc->u.l.l, ap);
@ -7952,16 +7952,16 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
case _table_try:
#endif
if (b0 == NULL)
store_clause_choice_point(Terms[0], Terms[1], Terms[2], NEXTOP(ipc,apl), ap, ap_pc, cp_pc);
store_clause_choice_point(Terms[0], Terms[1], Terms[2], NEXTOP(ipc,Otapl), ap, ap_pc, cp_pc);
else {
B = b0;
b0 = NULL;
update_clause_choice_point(NEXTOP(ipc,apl), ap_pc);
update_clause_choice_point(NEXTOP(ipc,Otapl), ap_pc);
}
if (lu_pred)
return lu_clause(ipc->u.apl.d, ap);
return lu_clause(ipc->u.Otapl.d, ap);
else
return (LogUpdClause *)static_clause(ipc->u.apl.d, ap, unbounded);
return (LogUpdClause *)static_clause(ipc->u.Otapl.d, ap, unbounded);
case _try_clause2:
case _try_clause3:
case _try_clause4:
@ -7981,13 +7981,13 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
case _table_try_me:
#endif
if (b0 == NULL)
store_clause_choice_point(Terms[0], Terms[1], Terms[2], ipc->u.apl.d, ap, ap_pc, cp_pc);
store_clause_choice_point(Terms[0], Terms[1], Terms[2], ipc->u.Otapl.d, ap, ap_pc, cp_pc);
else {
B = b0;
b0 = NULL;
update_clause_choice_point(ipc->u.apl.d, ap_pc);
update_clause_choice_point(ipc->u.Otapl.d, ap_pc);
}
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
case _retry_profiled:
case _count_retry:
@ -7997,11 +7997,11 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
#if TABLING
case _table_retry:
#endif
update_clause_choice_point(NEXTOP(ipc,apl),ap_pc);
update_clause_choice_point(NEXTOP(ipc,Otapl),ap_pc);
if (lu_pred)
return lu_clause(ipc->u.apl.d, ap);
return lu_clause(ipc->u.Otapl.d, ap);
else
return (LogUpdClause *)static_clause(ipc->u.apl.d, ap, TRUE);
return (LogUpdClause *)static_clause(ipc->u.Otapl.d, ap, TRUE);
case _retry2:
case _retry3:
case _retry4:
@ -8011,8 +8011,8 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
else
return (LogUpdClause *)static_clause(ipc->u.l.l, ap, TRUE);
case _retry_me:
update_clause_choice_point(ipc->u.apl.d,ap_pc);
ipc = NEXTOP(ipc,apl);
update_clause_choice_point(ipc->u.Otapl.d,ap_pc);
ipc = NEXTOP(ipc,Otapl);
break;
case _trust:
#if TABLING
@ -8038,9 +8038,9 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
#endif /* YAPOR */
b0 = B;
if (lu_pred)
return lu_clause(ipc->u.apl.d, ap);
return lu_clause(ipc->u.Otapl.d, ap);
else
return (LogUpdClause *)static_clause(ipc->u.apl.d, ap, TRUE);
return (LogUpdClause *)static_clause(ipc->u.Otapl.d, ap, TRUE);
case _profiled_trust_me:
case _trust_me:
case _count_trust_me:
@ -8066,7 +8066,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
#else
B = B->cp_b;
#endif /* YAPOR */
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
case _enter_lu_pred:
{
@ -8101,48 +8101,48 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
break;
case _try_logical:
if (b0 == NULL)
store_clause_choice_point(Terms[0], Terms[1], Terms[2], ipc->u.aLl.n, ap, ap_pc, cp_pc);
store_clause_choice_point(Terms[0], Terms[1], Terms[2], ipc->u.OtaLl.n, ap, ap_pc, cp_pc);
else {
B = b0;
b0 = NULL;
update_clause_choice_point(ipc->u.aLl.n, ap_pc);
update_clause_choice_point(ipc->u.OtaLl.n, ap_pc);
}
{
UInt timestamp = IntegerOfTerm(((CELL *)(B+1))[5]);
if (!VALID_TIMESTAMP(timestamp, ipc->u.aLl.d)) {
if (!VALID_TIMESTAMP(timestamp, ipc->u.OtaLl.d)) {
/* jump to next instruction */
ipc = ipc->u.aLl.n;
ipc = ipc->u.OtaLl.n;
break;
}
}
return ipc->u.aLl.d;
return ipc->u.OtaLl.d;
case _retry_logical:
case _profiled_retry_logical:
case _count_retry_logical:
{
UInt timestamp = IntegerOfTerm(((CELL *)(B+1))[5]);
if (!VALID_TIMESTAMP(timestamp, ipc->u.aLl.d)) {
if (!VALID_TIMESTAMP(timestamp, ipc->u.OtaLl.d)) {
/* jump to next instruction */
ipc = ipc->u.aLl.n;
ipc = ipc->u.OtaLl.n;
break;
}
}
update_clause_choice_point(ipc->u.ILl.n,ap_pc);
return ipc->u.ILl.d;
update_clause_choice_point(ipc->u.OtILl.n,ap_pc);
return ipc->u.OtILl.d;
case _trust_logical:
case _count_trust_logical:
case _profiled_trust_logical:
{
UInt timestamp = ((CELL *)(B+1))[5];
LogUpdIndex *cl = ipc->u.ILl.block;
LogUpdIndex *cl = ipc->u.OtILl.block;
LogUpdClause *newpc;
if (!VALID_TIMESTAMP(timestamp, ipc->u.ILl.d)) {
if (!VALID_TIMESTAMP(timestamp, ipc->u.OtILl.d)) {
/* jump to next instruction */
newpc = NULL;
} else {
newpc = ipc->u.ILl.d;
newpc = ipc->u.OtILl.d;
}
#if defined(YAPOR) || defined(THREADS)
B->cp_tr--;
@ -8168,7 +8168,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
cl->ClFlags &= ~InUseMask;
/* next, recover space for the indexing code if it was erased */
if (cl->ClFlags & (ErasedMask|DirtyMask)) {
LogUpdClause *lcl = ipc->u.ILl.d;
LogUpdClause *lcl = ipc->u.OtILl.d;
/* make sure we don't erase the clause we are jumping to */
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & (DirtyMask|InUseMask))) {
lcl->ClFlags |= InUseMask;
@ -8522,26 +8522,26 @@ Yap_NthClause(PredEntry *ap, Int ncls)
case _try_clause:
case _retry:
if (ncls == 1)
return to_clause(ipc->u.apl.d, ap);
return to_clause(ipc->u.Otapl.d, ap);
else if (alt == NULL) {
ncls --;
/* get there in a fell swoop */
if (ap->PredFlags & ProfiledPredFlag) {
if (ap->PredFlags & CountPredFlag) {
ipc = (yamop *)((char *)ipc+ncls*(UInt)NEXTOP(NEXTOP(NEXTOP((yamop *)NULL,apl),p),p));
ipc = (yamop *)((char *)ipc+ncls*(UInt)NEXTOP(NEXTOP(NEXTOP((yamop *)NULL,Otapl),p),p));
} else {
ipc = (yamop *)((char *)ipc+ncls*(UInt)NEXTOP(NEXTOP((yamop *)NULL,apl),p));
ipc = (yamop *)((char *)ipc+ncls*(UInt)NEXTOP(NEXTOP((yamop *)NULL,Otapl),p));
}
} else if (ap->PredFlags & CountPredFlag) {
ipc = (yamop *)((char *)ipc+ncls*(UInt)NEXTOP(NEXTOP((yamop *)NULL,apl),p));
ipc = (yamop *)((char *)ipc+ncls*(UInt)NEXTOP(NEXTOP((yamop *)NULL,Otapl),p));
} else {
ipc = (yamop *)((char *)ipc+ncls*(UInt)NEXTOP((yamop *)NULL,apl));
ipc = (yamop *)((char *)ipc+ncls*(UInt)NEXTOP((yamop *)NULL,Otapl));
}
return to_clause(ipc->u.apl.d, ap);
return to_clause(ipc->u.Otapl.d, ap);
} else {
ncls--;
}
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
case _try_clause2:
case _try_clause3:
@ -8579,32 +8579,32 @@ Yap_NthClause(PredEntry *ap, Int ncls)
break;
case _try_me:
case _retry_me:
alt = ipc->u.apl.d;
ipc = NEXTOP(ipc,apl);
alt = ipc->u.Otapl.d;
ipc = NEXTOP(ipc,Otapl);
break;
case _profiled_trust_me:
case _trust_me:
case _count_trust_me:
alt = NULL;
ipc = NEXTOP(ipc,apl);
ipc = NEXTOP(ipc,Otapl);
break;
case _try_logical:
case _retry_logical:
case _count_retry_logical:
case _profiled_retry_logical:
if (VALID_TIMESTAMP(ap->TimeStampOfPred, ipc->u.aLl.d)) {
if (VALID_TIMESTAMP(ap->TimeStampOfPred, ipc->u.OtaLl.d)) {
if (ncls == 1)
return ipc->u.aLl.d;
return ipc->u.OtaLl.d;
ncls--;
}
ipc = ipc->u.aLl.n;
ipc = ipc->u.OtaLl.n;
break;
case _trust_logical:
case _count_trust_logical:
case _profiled_trust_logical:
if (VALID_TIMESTAMP(ap->TimeStampOfPred, ipc->u.ILl.d)) {
if (VALID_TIMESTAMP(ap->TimeStampOfPred, ipc->u.OtILl.d)) {
if (ncls == 1)
return ipc->u.ILl.d;
return ipc->u.OtILl.d;
}
return NULL;
case _enter_lu_pred:

View File

@ -505,9 +505,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,sbpp),p),l);
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(p_code,Osbpp),p),l);
} else {
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(NEXTOP(p_code,e),sbpp),p),p),l);
sz = (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(NEXTOP(p_code,e),Osbpp),p),p),l);
}
cl = (StaticClause *)Yap_AllocCodeSpace(sz);
if (!cl) {
@ -536,12 +536,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.sbpp.bmap = NULL;
p_code->u.sbpp.s = -Signed(RealEnvSize);
p_code->u.sbpp.p =
p_code->u.sbpp.p0 =
p_code->u.Osbpp.bmap = NULL;
p_code->u.Osbpp.s = -Signed(RealEnvSize);
p_code->u.Osbpp.p =
p_code->u.Osbpp.p0 =
pe;
p_code = NEXTOP(p_code,sbpp);
p_code = NEXTOP(p_code,Osbpp);
if (!(flags & SafePredFlag)) {
p_code->opc = Yap_opcode(_deallocate);
p_code->u.p.p = pe;
@ -627,26 +627,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),sbpp),p),l));
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),Osbpp),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),sbpp),p),l);
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),Osbpp),p),l);
} else {
cl = ClauseCodeToStaticClause(pe->CodeOfPred);
}
cl->ClFlags = StaticMask;
cl->ClNext = NULL;
cl->ClSize = (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),sbpp),e),e);
cl->ClSize = (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),Osbpp),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.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->u.Osbpp.bmap = NULL;
p_code->u.Osbpp.s = -Signed(RealEnvSize);
p_code->u.Osbpp.p = p_code->u.Osbpp.p0 = pe;
p_code = NEXTOP(p_code,Osbpp);
p_code->opc = Yap_opcode(_procceed);
p_code->u.p.p = pe;
p_code = NEXTOP(p_code,p);
@ -683,8 +683,8 @@ CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont)
INIT_YAMOP_LTT(code, 2);
PUT_YAMOP_SEQ(code);
#endif /* YAPOR */
code->u.apFs.f = Start;
code = NEXTOP(code,apFs);
code->u.OtapFs.f = Start;
code = NEXTOP(code,OtapFs);
if (pe->PredFlags & UserCPredFlag)
code->opc = Yap_opcode(_retry_userc);
else
@ -693,14 +693,14 @@ CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont)
INIT_YAMOP_LTT(code, 1);
PUT_YAMOP_SEQ(code);
#endif /* YAPOR */
code->u.apFs.f = Cont;
code->u.OtapFs.f = Cont;
#ifdef CUT_C
code = NEXTOP(code,apFs);
code = NEXTOP(code,OtapFs);
if (pe->PredFlags & UserCPredFlag)
code->opc = Yap_opcode(_cut_c);
else
code->opc = Yap_opcode(_cut_userc);
code->u.apFs.f = Cut;
code->u.OtapFs.f = Cut;
#endif
}
@ -760,9 +760,9 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
#endif /* YAPOR */
#ifdef CUT_C
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),apFs),l));
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),OtapFs),l));
#else
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),l));
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),l));
#endif
if (cl == NULL) {
@ -772,13 +772,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,apFs),apFs),apFs),l);
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),OtapFs),l);
cl->ClSize =
(CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),apFs),e);
(CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),OtapFs),e);
#else
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),l);
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),l);
cl->ClSize =
(CELL)NEXTOP(NEXTOP(NEXTOP(code,apFs),apFs),e);
(CELL)NEXTOP(NEXTOP(NEXTOP(code,OtapFs),OtapFs),e);
#endif
cl->usc.ClPred = pe;
@ -789,38 +789,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.apFs.f = Start;
code->u.apFs.p = pe;
code->u.apFs.s = Arity;
code->u.apFs.extra = Extra;
code->u.OtapFs.f = Start;
code->u.OtapFs.p = pe;
code->u.OtapFs.s = Arity;
code->u.OtapFs.extra = Extra;
#ifdef YAPOR
INIT_YAMOP_LTT(code, 2);
PUT_YAMOP_SEQ(code);
#endif /* YAPOR */
code = NEXTOP(code,apFs);
code = NEXTOP(code,OtapFs);
if (flags & UserCPredFlag)
code->opc = Yap_opcode(_retry_userc);
else
code->opc = Yap_opcode(_retry_c);
code->u.apFs.f = Cont;
code->u.apFs.p = pe;
code->u.apFs.s = Arity;
code->u.apFs.extra = Extra;
code->u.OtapFs.f = Cont;
code->u.OtapFs.p = pe;
code->u.OtapFs.s = Arity;
code->u.OtapFs.extra = Extra;
#ifdef YAPOR
INIT_YAMOP_LTT(code, 1);
PUT_YAMOP_SEQ(code);
#endif /* YAPOR */
code = NEXTOP(code,apFs);
code = NEXTOP(code,OtapFs);
#ifdef CUT_C
if (flags & UserCPredFlag)
code->opc = Yap_opcode(_cut_userc);
else
code->opc = Yap_opcode(_cut_c);
code->u.apFs.f = Cut;
code->u.apFs.p = pe;
code->u.apFs.s = Arity;
code->u.apFs.extra = Extra;
code = NEXTOP(code,apFs);
code->u.OtapFs.f = Cut;
code->u.OtapFs.p = pe;
code->u.OtapFs.s = Arity;
code->u.OtapFs.extra = Extra;
code = NEXTOP(code,OtapFs);
#endif /* CUT_C */
code->opc = Yap_opcode(_Ystop);
code->u.l.l = cl->ClCode;
@ -961,8 +961,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.apl.s = 0;
Yap_heap_regs->rtrycode.u.apl.d = NIL;
Yap_heap_regs->rtrycode.u.Otapl.s = 0;
Yap_heap_regs->rtrycode.u.Otapl.d = NIL;
#ifdef YAPOR
INIT_YAMOP_LTT(&(Yap_heap_regs->rtrycode), 1);
#endif /* YAPOR */
@ -1312,8 +1312,8 @@ InitCodes(void)
modp->PredFlags |= MetaPredFlag;
}
#ifdef YAPOR
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));
Yap_heap_regs->getwork_code.u.Otapl.p = RepPredProp(PredPropByAtom(Yap_FullLookupAtom("$getwork"), PROLOG_MODULE));
Yap_heap_regs->getwork_seq_code.u.Otapl.p = RepPredProp(PredPropByAtom(Yap_FullLookupAtom("$getwork_seq"), PROLOG_MODULE));
#endif /* YAPOR */
Yap_heap_regs->db_erased_marker =
(DBRef)Yap_AllocCodeSpace(sizeof(DBStruct));

View File

@ -4,33 +4,33 @@
OPCODE(Ystop ,l),
OPCODE(Nstop ,e),
OPCODE(try_me ,apl),
OPCODE(retry_me ,apl),
OPCODE(trust_me ,apl),
OPCODE(try_me ,Otapl),
OPCODE(retry_me ,Otapl),
OPCODE(trust_me ,Otapl),
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(profiled_retry_me ,Otapl),
OPCODE(profiled_trust_me ,Otapl),
OPCODE(profiled_retry_logical ,OtaLl),
OPCODE(profiled_trust_logical ,OtILl),
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(count_retry_me ,Otapl),
OPCODE(count_trust_me ,Otapl),
OPCODE(count_retry_logical ,OtaLl),
OPCODE(count_trust_logical ,OtILl),
OPCODE(lock_lu ,p),
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(spy_or_trymark ,Otapl),
OPCODE(try_and_mark ,Otapl),
OPCODE(count_retry_and_mark ,Otapl),
OPCODE(profiled_retry_and_mark ,Otapl),
OPCODE(retry_and_mark ,Otapl),
OPCODE(trust_fail ,e),
OPCODE(op_fail ,e),
OPCODE(cut ,e),
@ -42,8 +42,8 @@
OPCODE(commit_b_y ,yp),
OPCODE(execute ,pp),
OPCODE(dexecute ,pp),
OPCODE(fcall ,sbpp),
OPCODE(call ,sbpp),
OPCODE(fcall ,Osbpp),
OPCODE(call ,Osbpp),
OPCODE(procceed ,p),
OPCODE(allocate ,e),
OPCODE(deallocate ,p),
@ -175,23 +175,23 @@
OPCODE(jump ,l),
OPCODE(move_back ,l),
OPCODE(skip ,l),
OPCODE(either ,sblp),
OPCODE(or_else ,sblp),
OPCODE(either ,Osblp),
OPCODE(or_else ,Osblp),
OPCODE(pop_n ,s),
OPCODE(pop ,e),
OPCODE(call_cpred ,sbpp),
OPCODE(call_cpred ,Osbpp),
OPCODE(execute_cpred ,pp),
OPCODE(call_usercpred ,sbpp),
OPCODE(call_usercpred ,Osbpp),
OPCODE(call_c_wfail ,sdlp),
OPCODE(try_c ,apFs),
OPCODE(retry_c ,apFs),
OPCODE(try_c ,OtapFs),
OPCODE(retry_c ,OtapFs),
#ifdef CUT_C
OPCODE(cut_c ,apFs),
OPCODE(cut_c ,OtapFs),
#endif
OPCODE(try_userc ,apFs),
OPCODE(retry_userc ,apFs),
OPCODE(try_userc ,OtapFs),
OPCODE(retry_userc ,OtapFs),
#ifdef CUT_C
OPCODE(cut_userc ,apFs),
OPCODE(cut_userc ,OtapFs),
#endif
OPCODE(lock_pred ,e),
OPCODE(index_pred ,e),
@ -202,20 +202,20 @@
OPCODE(expand_clauses ,sssllp),
OPCODE(undef_p ,e),
OPCODE(spy_pred ,e),
OPCODE(try_clause ,apl),
OPCODE(try_clause ,Otapl),
OPCODE(try_clause2 ,l),
OPCODE(try_clause3 ,l),
OPCODE(try_clause4 ,l),
OPCODE(retry ,apl),
OPCODE(retry ,Otapl),
OPCODE(retry2 ,l),
OPCODE(retry3 ,l),
OPCODE(retry4 ,l),
OPCODE(trust ,apl),
OPCODE(trust ,Otapl),
OPCODE(try_in ,l),
OPCODE(enter_lu_pred ,Ills),
OPCODE(try_logical ,aLl),
OPCODE(retry_logical ,aLl),
OPCODE(trust_logical ,ILl),
OPCODE(try_logical ,OtaLl),
OPCODE(retry_logical ,OtaLl),
OPCODE(trust_logical ,OtILl),
OPCODE(switch_on_type ,llll),
OPCODE(switch_list_nl ,ollll),
OPCODE(switch_on_arg_type ,xllll),
@ -313,31 +313,31 @@
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),
OPCODE(p_execute2 ,Osbpp),
OPCODE(p_execute ,Osbmp),
OPCODE(p_execute_tail ,Osbpp),
#ifdef YAPOR
OPCODE(getwork_first_time ,e),
OPCODE(getwork ,apl),
OPCODE(getwork_seq ,apl),
OPCODE(sync ,apl),
OPCODE(getwork ,Otapl),
OPCODE(getwork_seq ,Otapl),
OPCODE(sync ,Otapl),
#endif
#ifdef TABLING
#ifdef TABLING_INNER_CUTS
OPCODE(clause_with_cut ,e),
#endif
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_load_answer ,Otapl),
OPCODE(table_try_answer ,Otapl),
OPCODE(table_try_single ,Otapl),
OPCODE(table_try_me ,Otapl),
OPCODE(table_try ,Otapl),
OPCODE(table_retry_me ,Otapl),
OPCODE(table_retry ,Otapl),
OPCODE(table_trust_me ,Otapl),
OPCODE(table_trust ,Otapl),
OPCODE(table_new_answer ,s),
OPCODE(table_answer_resolution ,apl),
OPCODE(table_completion ,apl),
OPCODE(table_answer_resolution ,Otapl),
OPCODE(table_completion ,Otapl),
OPCODE(trie_do_null ,e),
OPCODE(trie_try_null ,e),
OPCODE(trie_retry_null ,e),

View File

@ -176,8 +176,10 @@ typedef enum {
m: module, Term
n: number, Integer
o: opcode, OPCODE
O: OR-parallel information, used by YAPOR, unsigned int
p: predicate, struct pred_entry *
s: small integer, COUNT
t: pointer to table entry, used by yaptab, struct table_entry *
x: wam register, wamreg
y: environment slot
@ -185,7 +187,7 @@ typedef enum {
/* This declaration is going to be parsed by a Prolog program, so:
comments are welcome, but they should take a whole line,
every field declaration should also take a single line,
please check the Prolog program if you come up with a compilcated C-type that does not start by unsigned or struct.
please check the Prolog program if you come up with a complicated C-type that does not start by unsigned or struct.
*/
typedef struct yami {
OPCODE opc;
@ -278,7 +280,7 @@ typedef struct yami {
struct pred_entry *p;
struct yami *d;
CELL next;
} apl;
} Otapl;
/* 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. */
@ -297,7 +299,7 @@ typedef struct yami {
struct logic_upd_clause *d;
struct yami *n;
CELL next;
} aLl;
} OtaLl;
struct {
#ifdef YAPOR
unsigned int or_arg;
@ -311,7 +313,7 @@ typedef struct yami {
struct logic_upd_clause *d;
struct yami *n;
CELL next;
} ILl;
} OtILl;
struct {
#ifdef YAPOR
unsigned int or_arg;
@ -325,7 +327,7 @@ typedef struct yami {
CPredicate f;
COUNT extra;
CELL next;
} apFs;
} OtapFs;
struct {
struct yami *l1;
struct yami *l2;
@ -476,6 +478,7 @@ typedef struct yami {
} 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 */
/* last, Osblp is known to the buildops script */
struct {
#ifdef YAPOR
unsigned int or_arg;
@ -485,7 +488,7 @@ typedef struct yami {
struct yami *l;
struct pred_entry *p0;
CELL next;
} sblp;
} Osblp;
struct {
#ifdef YAPOR
unsigned int or_arg;
@ -495,7 +498,7 @@ typedef struct yami {
struct pred_entry *p;
struct pred_entry *p0;
CELL next;
} sbpp;
} Osbpp;
struct {
#ifdef YAPOR
unsigned int or_arg;
@ -505,7 +508,7 @@ typedef struct yami {
Term mod;
struct pred_entry *p0;
CELL next;
} sbmp;
} Osbmp;
struct {
/* size of table */
COUNT s;
@ -793,19 +796,19 @@ CELL *ENV_Parent(CELL *env)
static inline
UInt ENV_Size(yamop *cp)
{
return (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->u.sbpp.s);
return (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,Osbpp)))->u.Osbpp.s);
}
static inline
struct pred_entry *ENV_ToP(yamop *cp)
{
return (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->u.sbpp.p);
return (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,Osbpp)))->u.Osbpp.p);
}
static inline
OPCODE ENV_ToOp(yamop *cp)
{
return (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->opc);
return (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,Osbpp)))->opc);
}
static inline
@ -817,13 +820,13 @@ UInt EnvSize(yamop *cp)
static inline
CELL *EnvBMap(yamop *p)
{
return (((yamop *)((CODEADDR)(p) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->u.sbpp.bmap);
return (((yamop *)((CODEADDR)(p) - (CELL)NEXTOP((yamop *)NULL,Osbpp)))->u.Osbpp.bmap);
}
static inline
struct pred_entry *EnvPreg(yamop *p)
{
return (((yamop *)((CODEADDR)(p) - (CELL)NEXTOP((yamop *)NULL,sbpp)))->u.sbpp.p0);
return (((yamop *)((CODEADDR)(p) - (CELL)NEXTOP((yamop *)NULL,Osbpp)))->u.Osbpp.p0);
}
/* access to instructions */

View File

@ -33,7 +33,7 @@ typedef union CONSULT_OBJ {
#define ASSEMBLING_INDEX 1
#define ASSEMBLING_EINDEX 2
#define NextDynamicClause(X) (((yamop *)X)->u.apl.d)
#define NextDynamicClause(X) (((yamop *)X)->u.Otapl.d)
#define PredFirstClause 0
#define PredMiddleClause 1

View File

@ -13,15 +13,6 @@ restore_opcodes(yamop *pc)
fprintf(stderr, "%s ", Yap_op_names[op]);
#endif
switch (op) {
/* instructions type ILl */
case _count_trust_logical:
case _profiled_trust_logical:
case _trust_logical:
pc->u.ILl.block = PtoLUIndexAdjust(pc->u.ILl.block);
pc->u.ILl.d = PtoLUClauseAdjust(pc->u.ILl.d);
pc->u.ILl.n = PtoOpAdjust(pc->u.ILl.n);
pc = NEXTOP(pc,ILl);
break;
/* instructions type Ills */
case _enter_lu_pred:
pc->u.Ills.I = PtoLUIndexAdjust(pc->u.Ills.I);
@ -35,17 +26,63 @@ restore_opcodes(yamop *pc)
pc->u.L.ClBase = PtoLUClauseAdjust(pc->u.L.ClBase);
pc = NEXTOP(pc,L);
break;
/* instructions type aLl */
/* instructions type Osblp */
case _either:
case _or_else:
OrArgAdjust(pc->u.Osblp.or_arg);
pc->u.Osblp.s = ConstantAdjust(pc->u.Osblp.s);
pc->u.Osblp.bmap = CellPtoHeapAdjust(pc->u.Osblp.bmap);
pc->u.Osblp.l = PtoOpAdjust(pc->u.Osblp.l);
pc->u.Osblp.p0 = PtoPredAdjust(pc->u.Osblp.p0);
pc = NEXTOP(pc,Osblp);
break;
/* instructions type Osbmp */
case _p_execute:
OrArgAdjust(pc->u.Osbmp.or_arg);
pc->u.Osbmp.s = ConstantAdjust(pc->u.Osbmp.s);
pc->u.Osbmp.bmap = CellPtoHeapAdjust(pc->u.Osbmp.bmap);
pc->u.Osbmp.mod = ModuleAdjust(pc->u.Osbmp.mod);
pc->u.Osbmp.p0 = PtoPredAdjust(pc->u.Osbmp.p0);
pc = NEXTOP(pc,Osbmp);
break;
/* instructions type Osbpp */
case _call:
case _call_cpred:
case _call_usercpred:
case _fcall:
case _p_execute2:
case _p_execute_tail:
OrArgAdjust(pc->u.Osbpp.or_arg);
pc->u.Osbpp.s = ConstantAdjust(pc->u.Osbpp.s);
pc->u.Osbpp.bmap = CellPtoHeapAdjust(pc->u.Osbpp.bmap);
pc->u.Osbpp.p = PtoPredAdjust(pc->u.Osbpp.p);
pc->u.Osbpp.p0 = PtoPredAdjust(pc->u.Osbpp.p0);
pc = NEXTOP(pc,Osbpp);
break;
/* instructions type OtILl */
case _count_trust_logical:
case _profiled_trust_logical:
case _trust_logical:
OrArgAdjust(pc->u.OtILl.or_arg);
TabEntryAdjust(pc->u.OtILl.te);
pc->u.OtILl.block = PtoLUIndexAdjust(pc->u.OtILl.block);
pc->u.OtILl.d = PtoLUClauseAdjust(pc->u.OtILl.d);
pc->u.OtILl.n = PtoOpAdjust(pc->u.OtILl.n);
pc = NEXTOP(pc,OtILl);
break;
/* instructions type OtaLl */
case _count_retry_logical:
case _profiled_retry_logical:
case _retry_logical:
case _try_logical:
pc->u.aLl.s = ArityAdjust(pc->u.aLl.s);
pc->u.aLl.d = PtoLUClauseAdjust(pc->u.aLl.d);
pc->u.aLl.n = PtoOpAdjust(pc->u.aLl.n);
pc = NEXTOP(pc,aLl);
OrArgAdjust(pc->u.OtaLl.or_arg);
TabEntryAdjust(pc->u.OtaLl.te);
pc->u.OtaLl.s = ArityAdjust(pc->u.OtaLl.s);
pc->u.OtaLl.d = PtoLUClauseAdjust(pc->u.OtaLl.d);
pc->u.OtaLl.n = PtoOpAdjust(pc->u.OtaLl.n);
pc = NEXTOP(pc,OtaLl);
break;
/* instructions type apFs */
/* instructions type OtapFs */
#ifdef CUT_C
case _cut_c:
#endif
@ -56,13 +93,15 @@ restore_opcodes(yamop *pc)
case _retry_userc:
case _try_c:
case _try_userc:
pc->u.apFs.s = ArityAdjust(pc->u.apFs.s);
pc->u.apFs.p = PtoPredAdjust(pc->u.apFs.p);
pc->u.apFs.f = ExternalFunctionAdjust(pc->u.apFs.f);
pc->u.apFs.extra = ConstantAdjust(pc->u.apFs.extra);
pc = NEXTOP(pc,apFs);
OrArgAdjust(pc->u.OtapFs.or_arg);
TabEntryAdjust(pc->u.OtapFs.te);
pc->u.OtapFs.s = ArityAdjust(pc->u.OtapFs.s);
pc->u.OtapFs.p = PtoPredAdjust(pc->u.OtapFs.p);
pc->u.OtapFs.f = ExternalFunctionAdjust(pc->u.OtapFs.f);
pc->u.OtapFs.extra = ConstantAdjust(pc->u.OtapFs.extra);
pc = NEXTOP(pc,OtapFs);
break;
/* instructions type apl */
/* instructions type Otapl */
case _count_retry_and_mark:
case _count_retry_me:
case _count_trust_me:
@ -78,10 +117,12 @@ restore_opcodes(yamop *pc)
case _try_and_mark:
case _try_clause:
case _try_me:
pc->u.apl.s = ArityAdjust(pc->u.apl.s);
pc->u.apl.p = PtoPredAdjust(pc->u.apl.p);
pc->u.apl.d = PtoOpAdjust(pc->u.apl.d);
pc = NEXTOP(pc,apl);
OrArgAdjust(pc->u.Otapl.or_arg);
TabEntryAdjust(pc->u.Otapl.te);
pc->u.Otapl.s = ArityAdjust(pc->u.Otapl.s);
pc->u.Otapl.p = PtoPredAdjust(pc->u.Otapl.p);
pc->u.Otapl.d = PtoOpAdjust(pc->u.Otapl.d);
pc = NEXTOP(pc,Otapl);
break;
/* instructions type c */
case _write_atom:
@ -402,36 +443,6 @@ restore_opcodes(yamop *pc)
pc->u.s.s = ConstantAdjust(pc->u.s.s);
pc = NEXTOP(pc,s);
break;
/* instructions type sblp */
case _either:
case _or_else:
pc->u.sblp.s = ConstantAdjust(pc->u.sblp.s);
pc->u.sblp.bmap = CellPtoHeapAdjust(pc->u.sblp.bmap);
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 sbmp */
case _p_execute:
pc->u.sbmp.s = ConstantAdjust(pc->u.sbmp.s);
pc->u.sbmp.bmap = CellPtoHeapAdjust(pc->u.sbmp.bmap);
pc->u.sbmp.mod = ModuleAdjust(pc->u.sbmp.mod);
pc->u.sbmp.p0 = PtoPredAdjust(pc->u.sbmp.p0);
pc = NEXTOP(pc,sbmp);
break;
/* instructions type sbpp */
case _call:
case _call_cpred:
case _call_usercpred:
case _fcall:
case _p_execute2:
case _p_execute_tail:
pc->u.sbpp.s = ConstantAdjust(pc->u.sbpp.s);
pc->u.sbpp.bmap = CellPtoHeapAdjust(pc->u.sbpp.bmap);
pc->u.sbpp.p = PtoPredAdjust(pc->u.sbpp.p);
pc->u.sbpp.p0 = PtoPredAdjust(pc->u.sbpp.p0);
pc = NEXTOP(pc,sbpp);
break;
/* instructions type sc */
case _write_n_atoms:
pc->u.sc.s = ConstantAdjust(pc->u.sc.s);
@ -715,14 +726,16 @@ restore_opcodes(yamop *pc)
pc = NEXTOP(pc,yyx);
break;
#ifdef YAPOR
/* instructions type apl */
/* instructions type Otapl */
case _getwork:
case _getwork_seq:
case _sync:
pc->u.apl.s = ArityAdjust(pc->u.apl.s);
pc->u.apl.p = PtoPredAdjust(pc->u.apl.p);
pc->u.apl.d = PtoOpAdjust(pc->u.apl.d);
pc = NEXTOP(pc,apl);
OrArgAdjust(pc->u.Otapl.or_arg);
TabEntryAdjust(pc->u.Otapl.te);
pc->u.Otapl.s = ArityAdjust(pc->u.Otapl.s);
pc->u.Otapl.p = PtoPredAdjust(pc->u.Otapl.p);
pc->u.Otapl.d = PtoOpAdjust(pc->u.Otapl.d);
pc = NEXTOP(pc,Otapl);
break;
/* instructions type e */
case _getwork_first_time:
@ -731,7 +744,7 @@ restore_opcodes(yamop *pc)
break;
#endif
#ifdef TABLING
/* instructions type apl */
/* instructions type Otapl */
case _table_answer_resolution:
case _table_completion:
case _table_load_answer:
@ -743,10 +756,12 @@ restore_opcodes(yamop *pc)
case _table_try_answer:
case _table_try_me:
case _table_try_single:
pc->u.apl.s = ArityAdjust(pc->u.apl.s);
pc->u.apl.p = PtoPredAdjust(pc->u.apl.p);
pc->u.apl.d = PtoOpAdjust(pc->u.apl.d);
pc = NEXTOP(pc,apl);
OrArgAdjust(pc->u.Otapl.or_arg);
TabEntryAdjust(pc->u.Otapl.te);
pc->u.Otapl.s = ArityAdjust(pc->u.Otapl.s);
pc->u.Otapl.p = PtoPredAdjust(pc->u.Otapl.p);
pc->u.Otapl.d = PtoOpAdjust(pc->u.Otapl.d);
pc = NEXTOP(pc,Otapl);
break;
/* instructions type e */
#ifdef TABLING_INNER_CUTS
@ -760,27 +775,7 @@ restore_opcodes(yamop *pc)
pc->u.s.s = ConstantAdjust(pc->u.s.s);
pc = NEXTOP(pc,s);
break;
/* instructions type apl */
case _table_answer_resolution:
case _table_completion:
case _table_load_answer:
case _table_retry:
case _table_retry_me:
case _table_trust:
case _table_trust_me:
case _table_try:
case _table_try_answer:
case _table_try_me:
case _table_try_single:
pc->u.apl.s = ArityAdjust(pc->u.apl.s);
pc->u.apl.p = PtoPredAdjust(pc->u.apl.p);
pc->u.apl.d = PtoOpAdjust(pc->u.apl.d);
pc = NEXTOP(pc,apl);
break;
/* instructions type e */
#ifdef TABLING_INNER_CUTS
case _clause_with_cut:
#endif
case _trie_do_atom:
case _trie_do_extension:
case _trie_do_float:
@ -820,20 +815,16 @@ restore_opcodes(yamop *pc)
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return;
pc = NEXTOP(pc,e);
break;
/* instructions type s */
case _table_new_answer:
pc->u.s.s = ConstantAdjust(pc->u.s.s);
pc = NEXTOP(pc,s);
break;
#endif
/* this instruction is hardwired */
case _or_last:
#ifdef YAPOR
pc->u.sblp.s = ConstantAdjust(pc->u.sblp.s);
pc->u.sblp.bmap = CellPtoHeapAdjust(pc->u.sblp.bmap);
pc->u.sblp.l = PtoOpAdjust(pc->u.sblp.l);
pc->u.sblp.p0 = PtoPredAdjust(pc->u.sblp.p0);
pc = NEXTOP(pc,sblp);
OrArgAdjust(pc->u.Osblp.or_arg);
pc->u.Osblp.s = ConstantAdjust(pc->u.Osblp.s);
pc->u.Osblp.bmap = CellPtoHeapAdjust(pc->u.Osblp.bmap);
pc->u.Osblp.l = PtoOpAdjust(pc->u.Osblp.l);
pc->u.Osblp.p0 = PtoPredAdjust(pc->u.Osblp.p0);
pc = NEXTOP(pc,Osblp);
break;
#else
pc->u.p.p = PtoPredAdjust(pc->u.p.p);

View File

@ -659,9 +659,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.apl.d != NIL)
((yamop *)(&Yap_heap_regs->rtrycode))->u.apl.d =
PtoOpAdjust(((yamop *)(&Yap_heap_regs->rtrycode))->u.apl.d);
if (((yamop *)(&Yap_heap_regs->rtrycode))->u.Otapl.d != NIL)
((yamop *)(&Yap_heap_regs->rtrycode))->u.Otapl.d =
PtoOpAdjust(((yamop *)(&Yap_heap_regs->rtrycode))->u.Otapl.d);
{
int arity;
arity = Yap_heap_regs->clausecode->arity;

View File

@ -38,7 +38,8 @@ IsHeapP (CELL * ptr)
#endif
}
#define OrArgAdjust(P)
#define TabEntryAdjust(P)
/* Adjusting cells and pointers to cells */
@ -847,3 +848,4 @@ IsGlobal (CELL reg)
void STD_PROTO (Yap_AdjustStacksAndTrail, (void));
void STD_PROTO (Yap_AdjustRegs, (int));

View File

@ -41,7 +41,7 @@
PBOp(getwork,apl)
PBOp(getwork,Otapl)
#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,apl)
PBOp(getwork_seq,Otapl)
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,apl)
PBOp(sync,Otapl)
CUT_wait_leftmost();
PREG = NEXTOP(PREG, apl);
PREG = NEXTOP(PREG, Otapl);
PREFETCH_OP(PREG);
GONext();
ENDPBOp();

View File

@ -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.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 YAMOP_OR_ARG(INST) ((INST)->u.Otapl.or_arg)
#define YAMOP_LTT(INST) (((INST)->u.Otapl.or_arg) & YAMOP_LTT_BITS)
#define YAMOP_SEQ(INST) (((INST)->u.Otapl.or_arg) & YAMOP_SEQ_FLAG)
#define YAMOP_CUT(INST) (((INST)->u.Otapl.or_arg) & YAMOP_CUT_FLAG)
#define YAMOP_FLAGS(INST) (((INST)->u.Otapl.or_arg) & YAMOP_FLAGS_BITS)
#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 INIT_YAMOP_LTT(INST, LTT) (INST)->u.Otapl.or_arg = LTT
#define PUT_YAMOP_LTT(INST, LTT) (INST)->u.Otapl.or_arg = YAMOP_FLAGS(INST) | (LTT)
#define PUT_YAMOP_SEQ(INST) (INST)->u.Otapl.or_arg |= YAMOP_SEQ_FLAG
#define PUT_YAMOP_CUT(INST) (INST)->u.Otapl.or_arg |= YAMOP_CUT_FLAG
#define BRANCH(WORKER, DEPTH) GLOBAL_branch(WORKER, DEPTH)
#define BRANCH_LTT(WORKER, DEPTH) (BRANCH(WORKER, DEPTH) & YAMOP_LTT_BITS)

View File

@ -272,7 +272,7 @@
PBOp(table_load_answer, apl)
PBOp(table_load_answer, Otapl)
CELL *subs_ptr;
ans_node_ptr ans_node;
@ -299,7 +299,7 @@
PBOp(table_try_answer, apl)
PBOp(table_try_answer, Otapl)
#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,apl);
PREG = PREG->u.apl.d;
code_ap = NEXTOP(PREG,Otapl);
PREG = PREG->u.Otapl.d;
} else if (PREG->opc == Yap_opcode(_table_try_single)) {
/* table_try_single */
code_ap = COMPLETION;
PREG = PREG->u.apl.d;
PREG = PREG->u.Otapl.d;
} else {
/* table_try_me */
code_ap = PREG->u.apl.d;
PREG = NEXTOP(PREG,apl);
code_ap = PREG->u.Otapl.d;
PREG = NEXTOP(PREG,Otapl);
}
PREFETCH_OP(PREG);
restore_generator_node(SgFr_arity(sg_fr), code_ap);
@ -350,7 +350,7 @@
GONext();
}
#else
PREG = PREG->u.apl.d;
PREG = PREG->u.Otapl.d;
PREFETCH_OP(PREG);
GONext();
#endif /* INCOMPLETE_TABLING */
@ -358,12 +358,12 @@
PBOp(table_try_single, apl)
PBOp(table_try_single, Otapl)
tab_ent_ptr tab_ent;
sg_fr_ptr sg_fr;
check_trail(TR);
tab_ent = PREG->u.apl.te;
tab_ent = PREG->u.Otapl.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.apl.s, COMPLETION);
PREG = PREG->u.apl.d; /* should work also with PREG = NEXTOP(PREG,apl); */
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, COMPLETION);
PREG = PREG->u.Otapl.d; /* should work also with PREG = NEXTOP(PREG,Otapl); */
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.apl.s, TRY_ANSWER);
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
PREG = (yamop *) CPREG;
PREFETCH_OP(PREG);
load_answer_trie(ans_node, subs_ptr);
@ -467,12 +467,12 @@
PBOp(table_try_me, apl)
PBOp(table_try_me, Otapl)
tab_ent_ptr tab_ent;
sg_fr_ptr sg_fr;
check_trail(TR);
tab_ent = PREG->u.apl.te;
tab_ent = PREG->u.Otapl.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.apl.s, PREG->u.apl.d);
PREG = NEXTOP(PREG, apl);
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, PREG->u.Otapl.d);
PREG = NEXTOP(PREG, Otapl);
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.apl.s, TRY_ANSWER);
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
PREG = (yamop *) CPREG;
PREFETCH_OP(PREG);
load_answer_trie(ans_node, subs_ptr);
@ -576,12 +576,12 @@
PBOp(table_try, apl)
PBOp(table_try, Otapl)
tab_ent_ptr tab_ent;
sg_fr_ptr sg_fr;
check_trail(TR);
tab_ent = PREG->u.apl.te;
tab_ent = PREG->u.Otapl.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.apl.s, NEXTOP(PREG,apl));
PREG = PREG->u.apl.d;
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, NEXTOP(PREG,Otapl));
PREG = PREG->u.Otapl.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.apl.s, TRY_ANSWER);
store_generator_node(tab_ent, sg_fr, PREG->u.Otapl.s, TRY_ANSWER);
PREG = (yamop *) CPREG;
PREFETCH_OP(PREG);
load_answer_trie(ans_node, subs_ptr);
@ -685,49 +685,49 @@
Op(table_retry_me, apl)
restore_generator_node(PREG->u.apl.s, PREG->u.apl.d);
Op(table_retry_me, Otapl)
restore_generator_node(PREG->u.Otapl.s, PREG->u.Otapl.d);
YENV = (CELL *) PROTECT_FROZEN_B(B);
set_cut(YENV, B->cp_b);
SET_BB(NORM_CP(YENV));
allocate_environment();
PREG = NEXTOP(PREG,apl);
PREG = NEXTOP(PREG,Otapl);
GONext();
ENDOp();
Op(table_retry, apl)
restore_generator_node(PREG->u.apl.s, NEXTOP(PREG,apl));
Op(table_retry, Otapl)
restore_generator_node(PREG->u.Otapl.s, NEXTOP(PREG,Otapl));
YENV = (CELL *) PROTECT_FROZEN_B(B);
set_cut(YENV, B->cp_b);
SET_BB(NORM_CP(YENV));
allocate_environment();
PREG = PREG->u.apl.d;
PREG = PREG->u.Otapl.d;
GONext();
ENDOp();
Op(table_trust_me, apl)
restore_generator_node(PREG->u.apl.s, COMPLETION);
Op(table_trust_me, Otapl)
restore_generator_node(PREG->u.Otapl.s, COMPLETION);
YENV = (CELL *) PROTECT_FROZEN_B(B);
set_cut(YENV, B->cp_b);
SET_BB(NORM_CP(YENV));
allocate_environment();
PREG = NEXTOP(PREG,apl);
PREG = NEXTOP(PREG,Otapl);
GONext();
ENDOp();
Op(table_trust, apl)
restore_generator_node(PREG->u.apl.s, COMPLETION);
Op(table_trust, Otapl)
restore_generator_node(PREG->u.Otapl.s, COMPLETION);
YENV = (CELL *) PROTECT_FROZEN_B(B);
set_cut(YENV, B->cp_b);
SET_BB(NORM_CP(YENV));
allocate_environment();
PREG = PREG->u.apl.d;
PREG = PREG->u.Otapl.d;
GONext();
ENDOp();
@ -973,7 +973,7 @@
BOp(table_answer_resolution, apl)
BOp(table_answer_resolution, Otapl)
#ifdef YAPOR
if (SCH_top_shared_cp(B)) {
UNLOCK_OR_FRAME(LOCAL_top_or_fr);
@ -1259,7 +1259,7 @@
BOp(table_completion, apl)
BOp(table_completion, Otapl)
#ifdef YAPOR
if (SCH_top_shared_cp(B)) {
if (IS_BATCHED_GEN_CP(B)) {

View File

@ -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.apl.or_arg */
int or_arg; /* u.Otapl.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.apl.te)
#define SgFr_arity(X) (((X)->code_of_subgoal)->u.apl.s)
#define SgFr_tab_ent(X) (((X)->code_of_subgoal)->u.Otapl.te)
#define SgFr_arity(X) (((X)->code_of_subgoal)->u.Otapl.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)

View File

@ -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.apl.s;
tab_ent = preg->u.apl.te;
arity = preg->u.Otapl.s;
tab_ent = preg->u.Otapl.te;
count_vars = 0;
stack_vars = *Yaddr;
stack_terms_limit = (CELL *)TR;

View File

@ -69,6 +69,9 @@ AC_ARG_ENABLE(use-malloc,
AC_ARG_ENABLE(condor,
[ --enable-condor allow Yap to be used from condor ],
use_condor="$enableval", use_condor=no)
AC_ARG_ENABLE(chr,
[ --enable-chr install chr library ],
use_chr="$enableval", use_chr=yes)
AC_ARG_ENABLE(april,
[ --enable-april compile Yap to support April ILP system],

View File

@ -32,8 +32,8 @@ main :-
file('OPTYap/or.insts.i',W,C),
end_ifdef(W,C),
start_ifdef("TABLING",W,C),
retractall(op(_,_)),
file('OPTYap/tab.insts.i',W,C),
retractall(op(_,_)),
file('OPTYap/tab.tries.insts.i',W,C),
end_ifdef(W,C),
footer(W),
@ -139,20 +139,25 @@ special_formats(_,_).
dump_fields(_,[],"e",_).
dump_fields(_,[],[],_).
dump_fields(C,[I-"none"|Info],[O|Ops],T) :- !,
dump_fields(C,[I-_|Info],[O|Ops],T) :- !,
dump_field(C,I,O,T),
dump_fields(C,Info,Ops,T).
dump_fields(C,[_|Info],Ops,T) :-
dump_fields(C,Info,Ops,T).
dump_field(C,I,O,T) :-
O \= 0'd,
O \= 0'i, !,
get_op(O,A),
format(C,' pc->u.~s.~s = ~sAdjust(pc->u.~s.~s);~n',[T,I,A,T,I]).
dump_field(C,I,O,T) :-
rewritable_field(O), !,
get_op(O,A),
format(C,' ~sAdjust(pc->u.~s.~s);~n',[A,T,I]).
dump_field(C,I,O,T) :-
get_op(O,A),
format(C,' pc->u.~s.~s = ~sAdjust(pc->u.~s.~s);~n',[T,I,A,T,I]).
rewritable_field(0'd).
rewritable_field(0'i).
rewritable_field(0'O).
rewritable_field(0't).
get_op(0'a,"Arity").
get_op(0'b,"CellPtoHeap").
@ -167,8 +172,10 @@ get_op(0'L,"PtoLUClause").
get_op(0'm,"Module").
get_op(0'n,"Integer").
get_op(0'o,"Opcode").
get_op(0'O,"OrArg").
get_op(0'p,"PtoPred").
get_op(0's,"Constant").
get_op(0't,"TabEntry").
get_op(0'x,"X").
get_op(0'y,"Y").
% '
@ -194,7 +201,7 @@ footer_rclause(W) :-
format(W,' /* this instruction is hardwired */~n',[]),
dump_ops(W,["or_last"]),
format(W,'#ifdef YAPOR~n',[]),
output_typeinfo(W,"sblp"),
output_typeinfo(W,"Osblp"),
format(W,'#else~n',[]),
output_typeinfo(W,"p"),
format(W,'#endif~n',[]),