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; */
/* 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 (ActiveSignals & YAP_CREEP_SIGNAL && !Yap_InterruptsDisabled) {
Yap_signal(YAP_CREEP_SIGNAL);
}
return CallPredicate(RepPredProp(pe), B, RepPredProp(pe)->cs.p_code.TrueCodeOfPred);
} else if ((RepPredProp(pe)->PredFlags & (AsmPredFlag|CPredFlag)) &&
RepPredProp(pe)->OpcodeOfPred != Yap_opcode(_call_bfunc_xx)) {
/* USER C-Code may walk over registers */
if (RepPredProp(pe)->PredFlags & UserCPredFlag) {
save_machine_regs();
} else { if (ActiveSignals & YAP_CREEP_SIGNAL &&
!Yap_InterruptsDisabled &&
(!(RepPredProp(pe)->PredFlags & (AsmPredFlag|CPredFlag)) ||
RepPredProp(pe)->OpcodeOfPred == Yap_opcode(_call_bfunc_xx))) {
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);
}
}