From 3c84466d0532d046c695845c54d27467b09d8d64 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 21 Apr 2009 18:51:01 -0500 Subject: [PATCH] asserting on a spied predicate might make it loop for ever :( --- C/cdmgr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index cdb4fea34..34ea8e6bc 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -1830,10 +1830,7 @@ assertz_stat_clause(PredEntry *p, yamop *cp, int spy_flag) clp->ClPrev = clq; clp->ClNext = NULL; p->cs.p_code.LastClause = cp; - if (p->PredFlags & SpiedPredFlag) { - p->OpcodeOfPred = Yap_opcode(_spy_pred); - p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred)); - } else if (!(p->PredFlags & IndexedPredFlag)) { + if (!(p->PredFlags & IndexedPredFlag)) { p->OpcodeOfPred = INDEX_OPCODE; p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred)); } @@ -1843,6 +1840,10 @@ assertz_stat_clause(PredEntry *p, yamop *cp, int spy_flag) p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred)); } #endif + if (p->PredFlags & SpiedPredFlag) { + p->OpcodeOfPred = Yap_opcode(_spy_pred); + p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred)); + } return; } else { StaticClause *cl = ClauseCodeToStaticClause(pt);