fix bad setup of goal (SWI emulatin for JPL, Sergio Castro)

This commit is contained in:
Vítor Santos Costa 2013-09-07 01:03:27 +01:00
parent d1ff57b178
commit 4c148cc0d3
2 changed files with 8 additions and 4 deletions

View File

@ -2187,6 +2187,8 @@ PL_open_foreign_frame(void)
new->p = P; new->p = P;
new->flags = 0; new->flags = 0;
new->b = (CELL)(LCL0-(CELL*)B); new->b = (CELL)(LCL0-(CELL*)B);
new->envp = (CELL)(LCL0-ENV);
new->asp = (CELL)(LCL0-ASP);
new->slots = CurSlot; new->slots = CurSlot;
LOCAL_execution = new; LOCAL_execution = new;
{ {
@ -2215,7 +2217,8 @@ PL_close_foreign_frame(fid_t f)
P = env->p; P = env->p;
CurSlot = env->slots; CurSlot = env->slots;
B = (choiceptr)(LCL0-env->b); B = (choiceptr)(LCL0-env->b);
ASP = (CELL *)(LCL0-CurSlot); ENV = (CELL *)(LCL0-env->envp);
ASP = (CELL *)(LCL0-env->asp);
EX = NULL; EX = NULL;
LOCAL_BallTerm = EX; LOCAL_BallTerm = EX;
LOCAL_execution = env->old; LOCAL_execution = env->old;
@ -2256,14 +2259,15 @@ PL_discard_foreign_frame(fid_t f)
if (!env0) if (!env0)
return; return;
} }
CurSlot = env->slots;
while (B->cp_b != (choiceptr)(LCL0-env->b)) while (B->cp_b != (choiceptr)(LCL0-env->b))
B = B->cp_b; B = B->cp_b;
backtrack(); backtrack();
CurSlot = env->slots;
ENV = (CELL *)(LCL0-env->envp);
CP = env->cp; CP = env->cp;
P = env->p; P = env->p;
LOCAL_execution = env->old; LOCAL_execution = env->old;
ASP = LCL0-CurSlot; ASP = LCL0-env->asp;
B = B->cp_b; B = B->cp_b;
//LOCAL_BallTerm = EX; //LOCAL_BallTerm = EX;
//EX = NULL; //EX = NULL;

View File

@ -48,7 +48,7 @@ typedef struct open_query_struct {
YAP_Term *g; YAP_Term *g;
PredEntry *pe; PredEntry *pe;
yamop *p, *cp; yamop *p, *cp;
Int slots, b; Int slots, b, envp, asp;
jmp_buf env; jmp_buf env;
int flags; int flags;
YAP_dogoalinfo h; YAP_dogoalinfo h;