From 85f82a22d40942a8a8cfe3a1b0e8432a66fc5e89 Mon Sep 17 00:00:00 2001 From: vsc Date: Mon, 4 Jun 2007 12:11:47 +0000 Subject: [PATCH] fix interface bug with external c-code. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1893 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/exec.c | 12 +++++++++++- changes-5.1.html | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/C/exec.c b/C/exec.c index 4335f927f..f75ed3e9f 100644 --- a/C/exec.c +++ b/C/exec.c @@ -747,7 +747,17 @@ p_execute_nonstop(void) 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)) { - return RepPredProp(pe)->cs.f_code(); + /* USER C-Code may walk over registers */ + if (RepPredProp(pe)->PredFlags & UserCPredFlag) { + save_machine_regs(); + } + 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); } diff --git a/changes-5.1.html b/changes-5.1.html index cbee20276..46e767127 100644 --- a/changes-5.1.html +++ b/changes-5.1.html @@ -16,6 +16,7 @@

Yap-5.1.2: