system_preds

This commit is contained in:
Vitor Santos Costa 2017-06-16 11:53:21 +01:00
parent 97aad19cd0
commit 8ac3d980c2
4 changed files with 23 additions and 2 deletions

View File

@ -1732,7 +1732,7 @@ X_API bool YAP_LeaveGoal(bool backtrack, YAP_dogoalinfo *dgi) {
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
myB = (choiceptr)(LCL0 - dgi->b); myB = (choiceptr)(LCL0 - dgi->b);
if (B < myB) { if (B > myB) {
/* someone cut us */ /* someone cut us */
return FALSE; return FALSE;
} }

View File

@ -2534,6 +2534,24 @@ static Int
// return (out); // 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) */ static Int p_is_thread_local(USES_REGS1) { /* '$is_dynamic'(+P) */
PredEntry *pe; PredEntry *pe;
bool out; bool out;
@ -4724,6 +4742,8 @@ void Yap_InitCdMgr(void) {
SafePredFlag | SyncPredFlag); SafePredFlag | SyncPredFlag);
Yap_InitCPred("$is_system_predicate", 2, p_is_system_predicate, Yap_InitCPred("$is_system_predicate", 2, p_is_system_predicate,
TestPredFlag | SafePredFlag); TestPredFlag | SafePredFlag);
Yap_InitCPred("$is_opaque_predicate", 2, p_is_opaque_predicate,
TestPredFlag | SafePredFlag);
Yap_InitCPred("$new_discontiguous", 3, p_new_discontiguous, Yap_InitCPred("$new_discontiguous", 3, p_new_discontiguous,
SafePredFlag | SyncPredFlag); SafePredFlag | SyncPredFlag);
Yap_InitCPred("$is_discontiguous", 2, p_is_discontiguous, Yap_InitCPred("$is_discontiguous", 2, p_is_discontiguous,

View File

@ -604,7 +604,7 @@ be lost.
'$spycall_f'(G, M, CalledFromDebugger, InRedo). '$spycall_f'(G, M, CalledFromDebugger, InRedo).
'$spycall_f'(G, M, _, _) :- '$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)). '$continue_debugging_goal'(yes, '$execute_nonstop'(G,M)).
'$spycall_f'(G, M, CalledFromDebugger, InRedo) :- '$spycall_f'(G, M, CalledFromDebugger, InRedo) :-

View File

@ -109,6 +109,7 @@ listing(Stream, [MV|MVs]) :- !,
'$do_listing'(Stream, M, Name/Arity) :- '$do_listing'(Stream, M, Name/Arity) :-
( current_predicate(Name, M:Pred), ( current_predicate(Name, M:Pred),
\+ '$is_opaque_predicate'(Pred,M),
functor( Pred, Name, Arity), functor( Pred, Name, Arity),
\+ '$undefined'(Pred, M), \+ '$undefined'(Pred, M),
'$listing'(Name,Arity,M,Stream), '$listing'(Name,Arity,M,Stream),