C-code may mess up with environment: we cannot afford to just jump

there from anywhere (obs from Stefano Ferili).
This commit is contained in:
Vitor Santos Costa 2010-02-21 00:45:49 +00:00
parent 12672a77e1
commit 7b89916c43

View File

@ -782,25 +782,17 @@ p_execute_nonstop(void)
} }
/* N = arity; */ /* N = arity; */
/* call may not define new system predicates!! */ /* call may not define new system predicates!! */
if (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) {
Yap_signal(YAP_CREEP_SIGNAL);
}
if (RepPredProp(pe)->PredFlags & SpiedPredFlag) { if (RepPredProp(pe)->PredFlags & SpiedPredFlag) {
if (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) {
Yap_signal(YAP_CREEP_SIGNAL);
}
return CallPredicate(RepPredProp(pe), B, RepPredProp(pe)->cs.p_code.TrueCodeOfPred); return CallPredicate(RepPredProp(pe), B, RepPredProp(pe)->cs.p_code.TrueCodeOfPred);
} else if ((RepPredProp(pe)->PredFlags & (AsmPredFlag|CPredFlag)) && } else { if (ActiveSignals & YAP_CREEP_SIGNAL &&
RepPredProp(pe)->OpcodeOfPred != Yap_opcode(_call_bfunc_xx)) { !Yap_InterruptsDisabled &&
/* USER C-Code may walk over registers */ (!(RepPredProp(pe)->PredFlags & (AsmPredFlag|CPredFlag)) ||
if (RepPredProp(pe)->PredFlags & UserCPredFlag) { RepPredProp(pe)->OpcodeOfPred == Yap_opcode(_call_bfunc_xx))) {
save_machine_regs(); Yap_signal(YAP_CREEP_SIGNAL);
} }
if (RepPredProp(pe)->PredFlags & UserCPredFlag) {
Int out = RepPredProp(pe)->cs.f_code();
restore_machine_regs();
return out;
} else {
return RepPredProp(pe)->cs.f_code();
}
} else {
return CallPredicate(RepPredProp(pe), B, RepPredProp(pe)->CodeOfPred); return CallPredicate(RepPredProp(pe), B, RepPredProp(pe)->CodeOfPred);
} }
} }