- separate user_try and user_retry
- make sure we have slots inited in retrying user C code.
This commit is contained in:
parent
d6ed058157
commit
95f28228f6
44
C/absmi.c
44
C/absmi.c
@ -7635,14 +7635,14 @@ Yap_absmi(int inp)
|
|||||||
CPredicate f = (CPredicate)(PREG->u.OtapFs.f);
|
CPredicate f = (CPredicate)(PREG->u.OtapFs.f);
|
||||||
saveregs();
|
saveregs();
|
||||||
SREG = (CELL *) ((f) ());
|
SREG = (CELL *) ((f) ());
|
||||||
/* This last instruction changes B B*/
|
/* This last instruction changes B B*/
|
||||||
#ifdef CUT_C
|
#ifdef CUT_C
|
||||||
while (POP_CHOICE_POINT(B)){
|
while (POP_CHOICE_POINT(B)){
|
||||||
cut_c_pop();
|
cut_c_pop();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
setregs();
|
||||||
}
|
}
|
||||||
setregs();
|
|
||||||
if (!SREG) {
|
if (!SREG) {
|
||||||
#ifdef CUT_C
|
#ifdef CUT_C
|
||||||
/* Removes the cut functions from the stack
|
/* Removes the cut functions from the stack
|
||||||
@ -7712,13 +7712,13 @@ Yap_absmi(int inp)
|
|||||||
#endif
|
#endif
|
||||||
SET_BB(B_YREG);
|
SET_BB(B_YREG);
|
||||||
ENDCACHE_Y();
|
ENDCACHE_Y();
|
||||||
|
|
||||||
TRYUSERCC:
|
|
||||||
Yap_PrologMode = UserCCallMode;
|
Yap_PrologMode = UserCCallMode;
|
||||||
ASP = YENV;
|
ASP = YENV;
|
||||||
|
/* for slots to work */
|
||||||
|
Yap_StartSlots();
|
||||||
saveregs();
|
saveregs();
|
||||||
save_machine_regs();
|
save_machine_regs();
|
||||||
SREG = (CELL *) YAP_Execute(PREG->u.OtapFs.p, (CPredicate)(PREG->u.OtapFs.f));
|
SREG = (CELL *) YAP_ExecuteFirst(PREG->u.OtapFs.p, (CPredicate)(PREG->u.OtapFs.f));
|
||||||
EX = 0L;
|
EX = 0L;
|
||||||
restore_machine_regs();
|
restore_machine_regs();
|
||||||
setregs();
|
setregs();
|
||||||
@ -7760,7 +7760,39 @@ Yap_absmi(int inp)
|
|||||||
HBREG = H;
|
HBREG = H;
|
||||||
restore_args(PREG->u.OtapFs.s);
|
restore_args(PREG->u.OtapFs.s);
|
||||||
ENDCACHE_Y();
|
ENDCACHE_Y();
|
||||||
goto TRYUSERCC;
|
|
||||||
|
Yap_PrologMode = UserCCallMode;
|
||||||
|
ASP = YENV;
|
||||||
|
/* for slots to work */
|
||||||
|
Yap_StartSlots();
|
||||||
|
saveregs();
|
||||||
|
save_machine_regs();
|
||||||
|
SREG = (CELL *) YAP_ExecuteNext(PREG->u.OtapFs.p, (CPredicate)(PREG->u.OtapFs.f));
|
||||||
|
EX = 0L;
|
||||||
|
restore_machine_regs();
|
||||||
|
setregs();
|
||||||
|
Yap_PrologMode = UserMode;
|
||||||
|
if (!SREG) {
|
||||||
|
#ifdef CUT_C
|
||||||
|
/* Removes the cut functions from the stack
|
||||||
|
without executing them because we have fail
|
||||||
|
and not cuted the predicate*/
|
||||||
|
while(POP_CHOICE_POINT(B))
|
||||||
|
cut_c_pop();
|
||||||
|
#endif
|
||||||
|
FAIL();
|
||||||
|
}
|
||||||
|
if ((CELL *) B == YREG && ASP != (CELL *) B) {
|
||||||
|
/* as Luis says, the predicate that did the try C might
|
||||||
|
* have left some data on the stack. We should preserve
|
||||||
|
* it, unless the builtin also did cut */
|
||||||
|
YREG = ASP;
|
||||||
|
HBREG = PROTECT_FROZEN_H(B);
|
||||||
|
}
|
||||||
|
PREG = CPREG;
|
||||||
|
YREG = ENV;
|
||||||
|
CACHE_A1();
|
||||||
|
JMPNext();
|
||||||
ENDBOp();
|
ENDBOp();
|
||||||
|
|
||||||
#ifdef CUT_C
|
#ifdef CUT_C
|
||||||
|
Reference in New Issue
Block a user