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