diff --git a/C/c_interface.c b/C/c_interface.c index 8968a0295..a42294052 100755 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -1732,7 +1732,7 @@ X_API bool YAP_LeaveGoal(bool backtrack, YAP_dogoalinfo *dgi) { BACKUP_MACHINE_REGS(); myB = (choiceptr)(LCL0 - dgi->b); - if (B < myB) { + if (B > myB) { /* someone cut us */ return FALSE; } diff --git a/C/cdmgr.c b/C/cdmgr.c index 72ca6d06a..791998a3e 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -2534,6 +2534,24 @@ static Int // return (out); } +static Int + p_is_opaque_predicate(USES_REGS1) { /* '$is_multifile'(+S,+Mod) */ + PredEntry *pe; + Term t1 = Deref(ARG1); + bool out; + + // pe = Yap_get_pred(t1, Deref(ARG2), "system_predicate"); + // if (!pe) + pe = Yap_get_pred(t1, Deref(ARG2), "system_predicate"); + // if (!pe) pe = Yap_get_pred(t1, USER_MODULE, "system_predicate"); + if (EndOfPAEntr(pe)) + return FALSE; + return (pe->ModuleOfPred == 0 || + pe->PredFlags & (SystemPredFlags|ForeignPredFlags)); + UNLOCKPE(44, pe); + return (out); +} + static Int p_is_thread_local(USES_REGS1) { /* '$is_dynamic'(+P) */ PredEntry *pe; bool out; @@ -4724,6 +4742,8 @@ void Yap_InitCdMgr(void) { SafePredFlag | SyncPredFlag); Yap_InitCPred("$is_system_predicate", 2, p_is_system_predicate, TestPredFlag | SafePredFlag); + Yap_InitCPred("$is_opaque_predicate", 2, p_is_opaque_predicate, + TestPredFlag | SafePredFlag); Yap_InitCPred("$new_discontiguous", 3, p_new_discontiguous, SafePredFlag | SyncPredFlag); Yap_InitCPred("$is_discontiguous", 2, p_is_discontiguous, diff --git a/pl/debug.yap b/pl/debug.yap index dd6b96dc7..540a63770 100644 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -604,7 +604,7 @@ be lost. '$spycall_f'(G, M, CalledFromDebugger, InRedo). '$spycall_f'(G, M, _, _) :- - ( '$is_system_predicate'(G,M) ; '$tabled_predicate'(G,M) ), + ( '$is_opaque_predicate'(G,M) ; '$tabled_predicate'(G,M) ), !, '$continue_debugging_goal'(yes, '$execute_nonstop'(G,M)). '$spycall_f'(G, M, CalledFromDebugger, InRedo) :- diff --git a/pl/listing.yap b/pl/listing.yap index d8ac5c6d6..6d878fe31 100644 --- a/pl/listing.yap +++ b/pl/listing.yap @@ -109,6 +109,7 @@ listing(Stream, [MV|MVs]) :- !, '$do_listing'(Stream, M, Name/Arity) :- ( current_predicate(Name, M:Pred), + \+ '$is_opaque_predicate'(Pred,M), functor( Pred, Name, Arity), \+ '$undefined'(Pred, M), '$listing'(Name,Arity,M,Stream),