more fixes for expand_index

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@873 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-09-23 12:41:31 +00:00
parent 3e17f53c28
commit 0af6d3f1c4

View File

@ -3771,6 +3771,9 @@ expand_index(PredEntry *ap) {
/* if we are to commit here, alt will tell us where */
alt = ipc->u.ld.d;
ipc = NEXTOP(ipc,ld);
/* start of a group, reset stack */
sp = stack;
stack[0].pos = 0;
break;
case _profiled_trust_me:
case _trust_me:
@ -3781,6 +3784,9 @@ expand_index(PredEntry *ap) {
case _trust_me4:
/* we will commit to this group for sure */
ipc = NEXTOP(ipc,ld);
/* start of a group, reset stack */
sp = stack;
stack[0].pos = 0;
break;
case _trust:
case _trust_killed:
@ -3951,10 +3957,6 @@ expand_index(PredEntry *ap) {
/* we found it */
labp = (yamop **)(&(fe->Label));
ipc = NULL;
} else if (newpc == FAILCODE) {
/* oops, things went wrong */
labp = NULL;
ipc = NULL;
} else {
ipc = newpc;
}
@ -3976,10 +3978,6 @@ expand_index(PredEntry *ap) {
/* we found it */
labp = (yamop **)(&(ae->Label));
ipc = NULL;
} else if (ae->Label == (UInt)FAILCODE) {
/* oops, things went wrong */
labp = NULL;
ipc = NULL;
} else {
ipc = (yamop *)(ae->Label);
}
@ -3995,6 +3993,10 @@ expand_index(PredEntry *ap) {
}
ipc = NULL;
break;
case _op_fail:
ipc = alt;
alt = NULL;
break;
default:
if (alt == NULL) {
Yap_Error(SYSTEM_ERROR,t,"Bug in Indexing Code");
@ -4016,13 +4018,18 @@ expand_index(PredEntry *ap) {
last = ap->cs.p_code.LastClause;
} else {
if (ap->PredFlags & LogUpdatePredFlag) {
if (Yap_op_from_opcode(alt->opc) == _trust_logical_pred) {
op_numbers op = Yap_op_from_opcode(alt->opc);
if (op == _trust_logical_pred) {
last = NEXTOP(alt,l)->u.ld.d;
} else {
last = alt->u.ld.d;
}
} else {
last = PREVOP(alt->u.ld.d,ld);
op_numbers op = Yap_op_from_opcode(alt->opc);
if (op == _retry ||
op == _trust) {
last = PREVOP(alt->u.ld.d,ld);
}
}
fail_l = (UInt)alt;
clleft = count_clauses_left(last,ap);