Error handling: make PP or P available

This commit is contained in:
Vítor Santos Costa 2015-09-29 23:04:01 +01:00
parent 8208a181d3
commit 2ac59d36aa
2 changed files with 19 additions and 16 deletions

View File

@ -6133,11 +6133,12 @@
low_level_trace(enter_pred,PREG->y_u.Osbpp.p,XREGS+1); low_level_trace(enter_pred,PREG->y_u.Osbpp.p,XREGS+1);
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
BEGD(d0); BEGD(d0);
CPredicate f = PREG->y_u.Osbpp.p->cs.f_code; PP = PREG->Osbpp.p0;
PREG = NEXTOP(PREG, Osbpp); PREG = NEXTOP(PREG, Osbpp);
saveregs(); saveregs();
d0 = (f)(PASS_REGS1); d0 = (f)(PASS_REGS1);
setregs(); setregs();
CPredicate f = PREG->y_u.Osbpp.p->cs.f_code;
#ifdef SHADOW_S #ifdef SHADOW_S
SREG = Yap_REGS.S_; SREG = Yap_REGS.S_;
#endif #endif
@ -6207,6 +6208,7 @@
/* now call C-Code */ /* now call C-Code */
{ {
CPredicate f = PREG->y_u.pp.p->cs.f_code; CPredicate f = PREG->y_u.pp.p->cs.f_code;
PP = PREG->y_u.pp.p0;
yamop *oldPREG = PREG; yamop *oldPREG = PREG;
saveregs(); saveregs();
d0 = (f)(PASS_REGS1); d0 = (f)(PASS_REGS1);
@ -6307,10 +6309,10 @@
ENDBOp(); ENDBOp();
BOp(call_c_wfail, slp); BOp(call_c_wfail, slpp);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
low_level_trace(enter_pred,PREG->y_u.slp.p,XREGS+1); low_level_trace(enter_pred,PREG->y_u.slpp.p,XREGS+1);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
#ifdef FROZEN_STACKS #ifdef FROZEN_STACKS
@ -6323,7 +6325,7 @@
#endif /* YAPOR_SBA */ #endif /* YAPOR_SBA */
else { else {
BEGD(d0); BEGD(d0);
d0 = PREG->y_u.slp.s; d0 = PREG->y_u.slpp.s;
ASP = ((CELL *)YREG) + d0; ASP = ((CELL *)YREG) + d0;
ENDD(d0); ENDD(d0);
} }
@ -6333,13 +6335,14 @@
ASP = (CELL *) B; ASP = (CELL *) B;
else { else {
BEGD(d0); BEGD(d0);
d0 = PREG->y_u.slp.s; d0 = PREG->y_u.slpp.s;
ASP = ((CELL *) YREG) + d0; ASP = ((CELL *) YREG) + d0;
ENDD(d0); ENDD(d0);
} }
#endif /* FROZEN_STACKS */ #endif /* FROZEN_STACKS */
{ {
CPredicate f = PREG->y_u.slp.p->cs.f_code; CPredicate f = PREG->y_u.slpp.p->cs.f_code;
PP = PREG->y_u.slpp.p0;
saveregs(); saveregs();
SREG = (CELL *)((f)(PASS_REGS1)); SREG = (CELL *)((f)(PASS_REGS1));
setregs(); setregs();
@ -6347,9 +6350,9 @@
if (!SREG) { if (!SREG) {
/* be careful about error handling */ /* be careful about error handling */
if (PREG != FAILCODE) if (PREG != FAILCODE)
PREG = PREG->y_u.slp.l; PREG = PREG->y_u.slpp.l;
} else { } else {
PREG = NEXTOP(PREG, slp); PREG = NEXTOP(PREG, slpp);
} }
CACHE_A1(); CACHE_A1();
JMPNext(); JMPNext();
@ -6373,7 +6376,7 @@
ENDCACHE_Y(); ENDCACHE_Y();
TRYCC: TRYCC:
ASP = (CELL *)B; 1ASP = (CELL *)B;
{ {
CPredicate f = (CPredicate)(PREG->y_u.OtapFs.f); CPredicate f = (CPredicate)(PREG->y_u.OtapFs.f);
saveregs(); saveregs();

View File

@ -225,10 +225,10 @@
ENDBOp(); ENDBOp();
BOp(call_c_wfail, slp); BOp(call_c_wfail, slpp);
#ifdef LOW_LEVEL_TRACER #ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) { if (Yap_do_low_level_trace) {
low_level_trace(enter_pred,PREG->y_u.slp.p,XREGS+1); low_level_trace(enter_pred,PREG->y_u.slpp.p,XREGS+1);
} }
#endif /* LOW_LEVEL_TRACE */ #endif /* LOW_LEVEL_TRACE */
#ifdef FROZEN_STACKS #ifdef FROZEN_STACKS
@ -241,7 +241,7 @@
#endif /* YAPOR_SBA */ #endif /* YAPOR_SBA */
else { else {
BEGD(d0); BEGD(d0);
d0 = PREG->y_u.slp.s; d0 = PREG->y_u.slpp.s;
ASP = ((CELL *)YREG) + d0; ASP = ((CELL *)YREG) + d0;
ENDD(d0); ENDD(d0);
} }
@ -251,13 +251,13 @@
ASP = (CELL *) B; ASP = (CELL *) B;
else { else {
BEGD(d0); BEGD(d0);
d0 = PREG->y_u.slp.s; d0 = PREG->y_u.slpp.s;
ASP = ((CELL *) YREG) + d0; ASP = ((CELL *) YREG) + d0;
ENDD(d0); ENDD(d0);
} }
#endif /* FROZEN_STACKS */ #endif /* FROZEN_STACKS */
{ {
CPredicate f = PREG->y_u.slp.p->cs.f_code; CPredicate f = PREG->y_u.slpp.p->cs.f_code;
saveregs(); saveregs();
SREG = (CELL *)((f)(PASS_REGS1)); SREG = (CELL *)((f)(PASS_REGS1));
setregs(); setregs();
@ -265,9 +265,9 @@
if (!SREG) { if (!SREG) {
/* be careful about error handling */ /* be careful about error handling */
if (PREG != FAILCODE) if (PREG != FAILCODE)
PREG = PREG->y_u.slp.l; PREG = PREG->y_u.slpp.l;
} else { } else {
PREG = NEXTOP(PREG, slp); PREG = NEXTOP(PREG, slpp);
} }
CACHE_A1(); CACHE_A1();
JMPNext(); JMPNext();