From cf148cd0cb66a4a06e307d5637a049750e438862 Mon Sep 17 00:00:00 2001 From: vsc Date: Thu, 2 Oct 2003 18:20:11 +0000 Subject: [PATCH] Fix asserta_static git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@882 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/cdmgr.c | 9 +++++++-- C/index.c | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index 9e9998c04..1b443fa8a 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -818,8 +818,13 @@ asserta_stat_clause(PredEntry *p, yamop *cp, int spy_flag) } } p->cs.p_code.FirstClause = cp; - if (!(p->PredFlags & IndexedPredFlag)) { - p->cs.p_code.TrueCodeOfPred = cp; + p->cs.p_code.TrueCodeOfPred = cp; + if (p->PredFlags & SpiedPredFlag) { + p->OpcodeOfPred = Yap_opcode(_spy_pred); + p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred)); + } else if (!(p->PredFlags & IndexedPredFlag)) { + p->OpcodeOfPred = INDEX_OPCODE; + p->CodeOfPred = (yamop *)(&(p->OpcodeOfPred)); } p->cs.p_code.LastClause->u.ld.d = cp; } diff --git a/C/index.c b/C/index.c index cdbdbf2d1..4c40f423c 100644 --- a/C/index.c +++ b/C/index.c @@ -3314,16 +3314,28 @@ yamop * Yap_PredIsIndexable(PredEntry *ap) { yamop *indx_out; + int setjres; Yap_Error_Size = 0; - if (setjmp(Yap_CompilerBotch) == 3) { + if ((setjres = setjmp(Yap_CompilerBotch)) == 3) { restore_machine_regs(); Yap_gcl(Yap_Error_Size, ap->ArityOfPE, ENV, CP); + } else if (setjres == 2) { + restore_machine_regs(); + if (!Yap_growheap(FALSE, Yap_Error_Size)) { + Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); + return FAILCODE; + } + } else if (setjres != 0) { + if (!Yap_growheap(FALSE, Yap_Error_Size)) { + Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); + return FAILCODE; + } } restart_index: Yap_ErrorMessage = NULL; if (compile_index(ap) == (UInt)FAILCODE) { - return NULL; + return FAILCODE; } #ifdef DEBUG if (Yap_Option['i' - 'a' + 1]) {