diff --git a/C/absmi.c b/C/absmi.c index 5ab978b21..666e73ca8 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -7814,7 +7814,7 @@ Yap_absmi(int inp) ASP = (CELL *) PROTECT_FROZEN_B(B); } saveregs(); - Yap_IPred(ap, 0); + Yap_IPred(ap, 0, CP); /* IPred can generate errors, it thus must get rid of the lock itself */ setregs(); CACHE_A1(); @@ -7852,7 +7852,7 @@ Yap_absmi(int inp) ASP = (CELL *) PROTECT_FROZEN_B(B); } saveregs(); - Yap_IPred(ap, 0); + Yap_IPred(ap, 0, CP); /* IPred can generate errors, it thus must get rid of the lock itself */ setregs(); CACHE_A1(); @@ -8041,7 +8041,7 @@ Yap_absmi(int inp) ASP = (CELL *) PROTECT_FROZEN_B(B); } saveregs(); - Yap_IPred(pe, 0); + Yap_IPred(pe, 0, CP); /* IPred can generate errors, it thus must get rid of the lock itself */ setregs(); } diff --git a/C/cdmgr.c b/C/cdmgr.c index 6b2305d69..f0ae6ccd2 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -931,7 +931,7 @@ split_megaclause(PredEntry *ap) /* Index a prolog pred, given its predicate entry */ /* ap is already locked. */ static void -IPred(PredEntry *ap, UInt NSlots) +IPred(PredEntry *ap, UInt NSlots, yamop *next_pc) { yamop *BaseAddr; @@ -976,7 +976,7 @@ IPred(PredEntry *ap, UInt NSlots) Yap_Error(SYSTEM_ERROR,TermNil,"trying to index a dynamic predicate"); return; } - if ((BaseAddr = Yap_PredIsIndexable(ap, NSlots)) != NULL) { + if ((BaseAddr = Yap_PredIsIndexable(ap, NSlots, next_pc)) != NULL) { ap->cs.p_code.TrueCodeOfPred = BaseAddr; ap->PredFlags |= IndexedPredFlag; } @@ -1000,9 +1000,9 @@ IPred(PredEntry *ap, UInt NSlots) } void -Yap_IPred(PredEntry *p, UInt NSlots) +Yap_IPred(PredEntry *p, UInt NSlots, yamop *next_pc) { - IPred(p, NSlots); + IPred(p, NSlots, next_pc); } #define GONEXT(TYPE) code_p = ((yamop *)(&(code_p->u.TYPE.next))) @@ -2763,7 +2763,7 @@ p_setspy(void) for (i = 0; i < pred->ArityOfPE; i++) { XREGS[i+1] = MkVarTerm(); } - IPred(pred, 0); + IPred(pred, 0, CP); goto restart_spy; } fg = pred->PredFlags; @@ -5026,7 +5026,7 @@ p_nth_clause(void) XREGS[2] = MkVarTerm(); } if(pe->OpcodeOfPred == INDEX_OPCODE) { - IPred(pe, 0); + IPred(pe, 0, CP); } cl = Yap_NthClause(pe, ncls); if (cl == NULL) { diff --git a/C/index.c b/C/index.c index 4e9916c19..0f9d6483d 100644 --- a/C/index.c +++ b/C/index.c @@ -3332,7 +3332,7 @@ compile_index(struct intermediates *cint) yamop * -Yap_PredIsIndexable(PredEntry *ap, UInt NSlots) +Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc) { yamop *indx_out; int setjres; @@ -3346,7 +3346,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots) if ((setjres = setjmp(cint.CompilerBotch)) == 3) { restore_machine_regs(); recover_from_failed_susp_on_cls(&cint, 0); - if (!Yap_gcl(Yap_Error_Size, ap->ArityOfPE+NSlots, ENV, CP)) { + if (!Yap_gcl(Yap_Error_Size, ap->ArityOfPE+NSlots, ENV, next_pc)) { Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); return FAILCODE; } @@ -4400,7 +4400,7 @@ expand_index(struct intermediates *cint) { static yamop * -ExpandIndex(PredEntry *ap, int ExtraArgs) { +ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) { yamop *indx_out, *expand_clauses; yamop **labp; int cb; @@ -4411,7 +4411,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs) { restore_machine_regs(); /* grow stack */ recover_from_failed_susp_on_cls(&cint, 0); - Yap_gcl(Yap_Error_Size, ap->ArityOfPE+ExtraArgs, ENV, CP); + Yap_gcl(Yap_Error_Size, ap->ArityOfPE+ExtraArgs, ENV, nextop); } else if (cb == 2) { restore_machine_regs(); Yap_Error_Size = recover_from_failed_susp_on_cls(&cint, Yap_Error_Size); @@ -4594,7 +4594,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs) { yamop * Yap_ExpandIndex(PredEntry *ap, UInt nargs) { - return ExpandIndex(ap, nargs); + return ExpandIndex(ap, nargs, CP); } static path_stack_entry * @@ -7031,7 +7031,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y break; } #endif - ipc = ExpandIndex(ap, 5); + ipc = ExpandIndex(ap, 5, cp_pc); s_reg = (CELL *)XREGS[ap->ArityOfPE+1]; t = XREGS[ap->ArityOfPE+2]; Terms[0] = XREGS[ap->ArityOfPE+3]; @@ -7062,7 +7062,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y XREGS[ap->ArityOfPE+3] = Terms[0]; XREGS[ap->ArityOfPE+4] = Terms[1]; XREGS[ap->ArityOfPE+5] = Terms[2]; - Yap_IPred(ap, 5); + Yap_IPred(ap, 5, cp_pc); start_pc = ipc = ap->cs.p_code.TrueCodeOfPred; s_reg = (CELL *)XREGS[ap->ArityOfPE+1]; t = XREGS[ap->ArityOfPE+2]; @@ -7306,7 +7306,7 @@ Yap_NthClause(PredEntry *ap, Int ncls) break; } #endif - ipc = ExpandIndex(ap, 0); + ipc = ExpandIndex(ap, 0, CP); break; case _op_fail: @@ -7315,7 +7315,7 @@ Yap_NthClause(PredEntry *ap, Int ncls) case _lock_pred: case _index_pred: case _spy_pred: - Yap_IPred(ap, 0); + Yap_IPred(ap, 0, CP); ipc = ap->cs.p_code.TrueCodeOfPred; break; case _undef_p: diff --git a/C/tracer.c b/C/tracer.c index 54e333105..f5d3b9aed 100644 --- a/C/tracer.c +++ b/C/tracer.c @@ -172,6 +172,10 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) LOCK(Yap_heap_regs->low_level_trace_lock); sc = Yap_heap_regs; vsc_count++; + if (vsc_count < 637746000LL) + return; + if (vsc_count == 637746933LL) + jmp_deb(1); #ifdef THREADS Yap_heap_regs->thread_handle[worker_id].thread_inst_count++; #endif diff --git a/H/clause.h b/H/clause.h index 92edcd7ef..484c4332d 100644 --- a/H/clause.h +++ b/H/clause.h @@ -201,7 +201,7 @@ COUNT STD_PROTO(Yap_compile_cmp_flags,(PredEntry *)); void STD_PROTO(Yap_InitComma,(void)); /* cdmgr.c */ -void STD_PROTO(Yap_IPred,(PredEntry *, UInt)); +void STD_PROTO(Yap_IPred,(PredEntry *, UInt, yamop *)); int STD_PROTO(Yap_addclause,(Term,yamop *,int,Term,Term*)); void STD_PROTO(Yap_add_logupd_clause,(PredEntry *,LogUpdClause *,int)); void STD_PROTO(Yap_kill_iblock,(ClauseUnion *,ClauseUnion *,PredEntry *)); @@ -219,7 +219,7 @@ Int STD_PROTO(Yap_Recordz,(Atom, Term)); Term STD_PROTO(Yap_cp_as_integer,(choiceptr)); /* index.c */ -yamop *STD_PROTO(Yap_PredIsIndexable,(PredEntry *, UInt)); +yamop *STD_PROTO(Yap_PredIsIndexable,(PredEntry *, UInt, yamop *)); yamop *STD_PROTO(Yap_ExpandIndex,(PredEntry *, UInt)); void STD_PROTO(Yap_CleanUpIndex,(struct logic_upd_index *)); void STD_PROTO(Yap_CleanKids,(struct logic_upd_index *)); diff --git a/packages/jpl b/packages/jpl index d661852f7..88983bfdf 160000 --- a/packages/jpl +++ b/packages/jpl @@ -1 +1 @@ -Subproject commit d661852f76fe24441d983ef6f4e60ba90cfe17c4 +Subproject commit 88983bfdf74cfd89cd509fa2dd8060f2f9761917