From 5feb6a9dc5266f4d1c32c0023f1727ae0fd32a4f Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Thu, 30 Dec 2010 22:42:30 -0600 Subject: [PATCH] SWI emulation: it is unsafe to keep arguments in regs. --- C/c_interface.c | 7 ++++++- packages/jpl | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/C/c_interface.c b/C/c_interface.c index eef287b9f..8c5bdd1c7 100755 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -1413,8 +1413,13 @@ YAP_Execute(PredEntry *pe, CPredicate exec_code) if (pe->PredFlags & SWIEnvPredFlag) { CPredicateV codev = (CPredicateV)exec_code; struct foreign_context ctx; + UInt i; + Int sl = 0; ctx.engine = NULL; - return ((codev)((&ARG1)-LCL0,0,&ctx)); + for (i=pe->ArityOfPE; i > 0; i--) { + sl = Yap_InitSlot(XREGS[i]); + } + return ((codev)(sl,0,&ctx)); } if (pe->PredFlags & CArgsPredFlag) { Int out = execute_cargs(pe, exec_code); diff --git a/packages/jpl b/packages/jpl index 73e4e086d..29151b2fe 160000 --- a/packages/jpl +++ b/packages/jpl @@ -1 +1 @@ -Subproject commit 73e4e086d06c54210100f0faaeccbea276c707eb +Subproject commit 29151b2fe68f2dc727cdc07040e1fa1ad4fcca20