fox tracing/

This commit is contained in:
Vítor Santos Costa 2015-07-22 19:05:06 -05:00
parent 69344f26d1
commit 99948c5acc
1 changed files with 68 additions and 62 deletions

View File

@ -80,6 +80,8 @@ CallPredicate(PredEntry *pen, choiceptr cut_pt, yamop *code USES_REGS) {
inline static Int
CallMetaCall(Term t, Term mod USES_REGS) {
// we have a creep requesr waiting
ARG1 = t;
ARG2 = cp_as_integer(B PASS_REGS); /* p_current_choice_point */
ARG3 = t;
@ -88,8 +90,12 @@ CallMetaCall(Term t, Term mod USES_REGS) {
} else {
ARG4 = TermProlog;
}
if ( Yap_GetGlobal( AtomDebugMeta ) == TermOn ) {
return CallPredicate(PredTraceMetaCall, B, PredTraceMetaCall->CodeOfPred PASS_REGS);
} else {
return CallPredicate(PredMetaCall, B, PredMetaCall->CodeOfPred PASS_REGS);
}
}
Term
Yap_ExecuteCallMetaCall(Term mod) {
@ -99,6 +105,9 @@ Yap_ExecuteCallMetaCall(Term mod) {
ts[1] = cp_as_integer(B PASS_REGS); /* p_current_choice_point */
ts[2] = ARG1;
ts[3] = mod;
if ( Yap_GetGlobal( AtomDebugMeta ) == TermOn ) {
return Yap_MkApplTerm(PredTraceMetaCall->FunctorOfPred,3,ts);
}
return Yap_MkApplTerm(PredMetaCall->FunctorOfPred,4,ts);
}
@ -708,7 +717,7 @@ do_goal_expansion( USES_REGS1 )
if ( (pe = RepPredProp(Yap_GetPredPropByFunc(FunctorGoalExpansion2, SYSTEM_MODULE ) ) ) &&
pe->OpcodeOfPred != FAIL_OPCODE &&
pe->OpcodeOfPred != UNDEF_OPCODE &&
Yap_execute_pred(pe, NULL PASS_REGS, false) ) {
Yap_execute_pred(pe, NULL, false PASS_REGS) ) {
out = TRUE;
ARG3 = ARG2;
goto complete;
@ -1678,8 +1687,8 @@ Yap_Reset(yap_reset_t mode)
return res;
}
static int is_cleanup_cp(choiceptr cp_b)
static bool
is_cleanup_cp(choiceptr cp_b)
{
PredEntry *pe;
@ -1725,16 +1734,15 @@ JumpToEnv(Term t USES_REGS) {
while (handler &&
handler->cp_ap != pos) {
/* we are already doing a catch */
if (handler->cp_ap == catchpos) {
P = (yamop *)FAILCODE;
return TRUE;
if (handler->cp_ap == catchpos ||
handler->cp_ap == NOCODE) {
P = (yamop *)FAILCODE;
/* make sure failure will be seen at next port */
if (LOCAL_PrologMode & AsyncIntMode) {
Yap_signal(YAP_FAIL_SIGNAL);
}
HB = B->cp_h;
HB = handler->cp_h;
B = handler;
return TRUE;
}
/* make sure we prune C-choicepoints */
@ -2048,5 +2056,3 @@ Yap_InitExecFs(void)
Yap_InitCPred("$do_term_expansion", 2, do_term_expansion, 0);
Yap_InitCPred("$get_exception", 1, get_exception, 0);
}