2014-07-13 05:30:14 +01:00
|
|
|
#if (defined(YAPOR_SBA) && defined(YAPOR)) || defined(TABLING)
|
|
|
|
#define check_stack_on_cut \
|
2015-01-18 01:32:13 +00:00
|
|
|
if (__builtin_expect( ((Int)(Unsigned(YOUNGEST_CP((choiceptr)ENV_YREG,B_FZ)) - Unsigned(YOUNGEST_H(H_FZ,H))) < CreepFlag), 0) ) return external_labels[1];
|
2014-07-13 05:30:14 +01:00
|
|
|
#else
|
|
|
|
#define check_stack_on_cut \
|
|
|
|
if (__builtin_expect(((Int)(Unsigned(ENV_YREG) - Unsigned(HR)) < CreepFlag ), 0) ) return external_labels[1];
|
|
|
|
#endif /* YAPOR_SBA && YAPOR */
|
|
|
|
|
|
|
|
#if (defined(YAPOR_SBA) && defined(YAPOR)) || defined(TABLING)
|
|
|
|
#define check_stack_on_cutt \
|
2015-01-18 01:32:13 +00:00
|
|
|
if (__builtin_expect( ((Int)(Unsigned(YOUNGEST_CP((choiceptr)ENV_YREG,B_FZ)) - Unsigned(YOUNGEST_H(H_FZ,H))) < CreepFlag), 0) ) return external_labels[3];
|
2014-07-13 05:30:14 +01:00
|
|
|
#else
|
|
|
|
#define check_stack_on_cutt \
|
|
|
|
if (__builtin_expect(((Int)(Unsigned(ENV_YREG) - Unsigned(HR)) < CreepFlag ), 0) ) return external_labels[3];
|
|
|
|
#endif /* YAPOR_SBA && YAPOR */
|
|
|
|
|
|
|
|
#if (defined(YAPOR_SBA) && defined(YAPOR)) || defined(TABLING)
|
|
|
|
#define check_stack_on_commitx \
|
2015-01-18 01:32:13 +00:00
|
|
|
if (__builtin_expect( ((Int)(Unsigned(YOUNGEST_CP((choiceptr)ENV_YREG,B_FZ)) - Unsigned(YOUNGEST_H(H_FZ,H))) < CreepFlag), 0) ) return external_labels[11];
|
2014-07-13 05:30:14 +01:00
|
|
|
#else
|
|
|
|
#define check_stack_on_commitx \
|
|
|
|
if (__builtin_expect(((Int)(Unsigned(ENV_YREG) - Unsigned(HR)) < CreepFlag ), 0) ) return external_labels[11];
|
|
|
|
#endif /* YAPOR_SBA && YAPOR */
|
|
|
|
|
|
|
|
#ifdef COROUTINING
|
|
|
|
#define _cut_instinit \
|
|
|
|
if (FALSE) { \
|
|
|
|
CACHE_Y_AS_ENV(YREG); \
|
|
|
|
check_stack_on_cut; \
|
|
|
|
ENDCACHE_Y_AS_ENV(); \
|
|
|
|
} \
|
|
|
|
do_cut: \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.s.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), s),Osbpp),l); \
|
|
|
|
saveregs(); \
|
|
|
|
prune((choiceptr)YREG[E_CB]); \
|
|
|
|
setregs(); \
|
|
|
|
GONEXT();
|
|
|
|
#else /* COROUTINING */
|
|
|
|
#define _cut_instinit \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.s.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), s),Osbpp),l); \
|
|
|
|
saveregs(); \
|
|
|
|
prune((choiceptr)YREG[E_CB]); \
|
|
|
|
setregs(); \
|
|
|
|
GONEXT();
|
|
|
|
#endif /* COROUTINING */
|
|
|
|
|
|
|
|
#ifdef COROUTINING
|
|
|
|
#define _cut_t_instinit \
|
|
|
|
if (FALSE) { \
|
|
|
|
CACHE_Y_AS_ENV(YREG); \
|
|
|
|
check_stack_on_cutt; \
|
|
|
|
ENDCACHE_Y_AS_ENV(); \
|
|
|
|
} \
|
|
|
|
do_cut_t: \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.s.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
saveregs(); \
|
|
|
|
prune((choiceptr)YREG[E_CB]); \
|
|
|
|
setregs(); \
|
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), s),Osbpp),l); \
|
|
|
|
GONEXT();
|
|
|
|
#else /* COROUTINING */
|
|
|
|
#define _cut_t_instinit \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.s.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
saveregs(); \
|
|
|
|
prune((choiceptr)YREG[E_CB]); \
|
|
|
|
setregs(); \
|
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), s),Osbpp),l); \
|
|
|
|
GONEXT();
|
|
|
|
#endif /* COROUTINING */
|
|
|
|
|
|
|
|
#define CUT_E_INSTINIT
|
|
|
|
|
|
|
|
#ifdef COROUTINING
|
|
|
|
#define CUT_E_COROUTINING \
|
|
|
|
CACHE_Y_AS_ENV(YREG); \
|
|
|
|
check_stack(NoStackCutE, HR); \
|
|
|
|
ENDCACHE_Y_AS_ENV();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CUT_E_NOCOROUTINING \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.s.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), s),Osbpp),l); \
|
|
|
|
saveregs(); \
|
|
|
|
prune((choiceptr)(*_SREG)[E_CB]); \
|
|
|
|
setregs(); \
|
|
|
|
GONext();
|
|
|
|
|
|
|
|
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
|
|
|
|
#define _save_b_x_instinit \
|
|
|
|
BEGD(d0); \
|
2015-01-18 01:32:13 +00:00
|
|
|
d0 = (*_PREG)->u.x.x; \
|
2014-07-13 05:30:14 +01:00
|
|
|
XREG(d0) = MkIntegerTerm((Int)B); \
|
|
|
|
(*_PREG) = NEXTOP((*_PREG), x); \
|
|
|
|
ENDD(d0); \
|
|
|
|
GONEXT();
|
|
|
|
#else /* defined(YAPOR_SBA) && defined(FROZEN_STACKS) */
|
|
|
|
#define _save_b_x_instinit \
|
|
|
|
BEGD(d0); \
|
2015-01-18 01:32:13 +00:00
|
|
|
d0 = (*_PREG)->u.x.x; \
|
2014-07-13 05:30:14 +01:00
|
|
|
XREG(d0) = MkIntegerTerm(LCL0-(CELL *) (B)); \
|
|
|
|
(*_PREG) = NEXTOP((*_PREG), x); \
|
|
|
|
ENDD(d0); \
|
|
|
|
GONEXT();
|
|
|
|
#endif /* defined(YAPOR_SBA) && defined(FROZEN_STACKS) */
|
|
|
|
|
|
|
|
#if defined(YAPOR_SBA)
|
|
|
|
#define _save_b_y_instinit \
|
2015-01-18 01:32:13 +00:00
|
|
|
INITIALIZE_PERMVAR(YREG+(*_PREG)->u.y.y,MkIntegerTerm((Int)B)); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP((*_PREG), y); \
|
|
|
|
GONEXT();
|
|
|
|
#else /* defined(YAPOR_SBA) */
|
|
|
|
#define _save_b_y_instinit \
|
2015-01-18 01:32:13 +00:00
|
|
|
INITIALIZE_PERMVAR(YREG+(*_PREG)->u.y.y,MkIntegerTerm(LCL0-(CELL *)(B))); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP((*_PREG), y); \
|
|
|
|
GONEXT();
|
|
|
|
#endif /* defined(YAPOR_SBA) */
|
|
|
|
|
|
|
|
#ifdef COROUTINING
|
|
|
|
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
|
|
|
|
#define _commit_b_x_instinit \
|
|
|
|
CACHE_Y_AS_ENV(YREG); \
|
|
|
|
check_stack_on_commitx; \
|
|
|
|
ENDCACHE_Y_AS_ENV(); \
|
|
|
|
do_commit_b_x: \
|
|
|
|
BEGD(d0); \
|
2015-01-18 01:32:13 +00:00
|
|
|
d0 = XREG((*_PREG)->u.xps.x); \
|
2014-07-13 05:30:14 +01:00
|
|
|
deref_head(d0, commit_b_x_unk); \
|
|
|
|
commit_b_x_nvar: \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.xps.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), xps),Osbpp),l); \
|
|
|
|
{ \
|
|
|
|
choiceptr pt0; \
|
|
|
|
pt0 = (choiceptr)IntegerOfTerm(d0); \
|
|
|
|
saveregs(); \
|
|
|
|
prune(pt0); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
GONEXT(); \
|
|
|
|
\
|
|
|
|
BEGP(pt1); \
|
|
|
|
deref_body(d0, pt1, commit_b_x_unk, commit_b_x_nvar); \
|
|
|
|
ENDP(pt1); \
|
|
|
|
FAIL(); \
|
|
|
|
ENDD(d0);
|
|
|
|
#else /* defined(YAPOR_SBA) && defined(FROZEN_STACKS) */
|
|
|
|
#define _commit_b_x_instinit \
|
|
|
|
CACHE_Y_AS_ENV(YREG); \
|
|
|
|
check_stack_on_commitx; \
|
|
|
|
ENDCACHE_Y_AS_ENV(); \
|
|
|
|
do_commit_b_x: \
|
|
|
|
BEGD(d0); \
|
2015-01-18 01:32:13 +00:00
|
|
|
d0 = XREG((*_PREG)->u.xps.x); \
|
2014-07-13 05:30:14 +01:00
|
|
|
deref_head(d0, commit_b_x_unk); \
|
|
|
|
commit_b_x_nvar: \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.xps.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), xps),Osbpp),l); \
|
|
|
|
{ \
|
|
|
|
choiceptr pt0; \
|
|
|
|
pt0 = (choiceptr)(LCL0-IntegerOfTerm(d0)); \
|
|
|
|
saveregs(); \
|
|
|
|
prune(pt0); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
GONEXT(); \
|
|
|
|
\
|
|
|
|
BEGP(pt1); \
|
|
|
|
deref_body(d0, pt1, commit_b_x_unk, commit_b_x_nvar); \
|
|
|
|
ENDP(pt1); \
|
|
|
|
FAIL(); \
|
|
|
|
ENDD(d0);
|
|
|
|
#endif /* defined(YAPOR_SBA) && defined(FROZEN_STACKS) */
|
|
|
|
#else /* COROUTINING */
|
|
|
|
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
|
|
|
|
#define _commit_b_x_instinit \
|
|
|
|
BEGD(d0); \
|
2015-01-18 01:32:13 +00:00
|
|
|
d0 = XREG((*_PREG)->u.xps.x); \
|
2014-07-13 05:30:14 +01:00
|
|
|
deref_head(d0, commit_b_x_unk); \
|
|
|
|
commit_b_x_nvar: \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.xps.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), xps),Osbpp),l); \
|
|
|
|
{ \
|
|
|
|
choiceptr pt0; \
|
|
|
|
pt0 = (choiceptr)IntegerOfTerm(d0); \
|
|
|
|
saveregs(); \
|
|
|
|
prune(pt0); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
GONEXT(); \
|
|
|
|
\
|
|
|
|
BEGP(pt1); \
|
|
|
|
deref_body(d0, pt1, commit_b_x_unk, commit_b_x_nvar); \
|
|
|
|
ENDP(pt1); \
|
|
|
|
FAIL(); \
|
|
|
|
ENDD(d0);
|
|
|
|
#else /* defined(YAPOR_SBA) && defined(FROZEN_STACKS) */
|
|
|
|
#define _commit_b_x_instinit \
|
|
|
|
BEGD(d0); \
|
2015-01-18 01:32:13 +00:00
|
|
|
d0 = XREG((*_PREG)->u.xps.x); \
|
2014-07-13 05:30:14 +01:00
|
|
|
deref_head(d0, commit_b_x_unk); \
|
|
|
|
commit_b_x_nvar: \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.xps.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), xps),Osbpp),l); \
|
|
|
|
{ \
|
|
|
|
choiceptr pt0; \
|
|
|
|
pt0 = (choiceptr)(LCL0-IntegerOfTerm(d0)); \
|
|
|
|
saveregs(); \
|
|
|
|
prune(pt0); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
GONEXT(); \
|
|
|
|
\
|
|
|
|
BEGP(pt1); \
|
|
|
|
deref_body(d0, pt1, commit_b_x_unk, commit_b_x_nvar); \
|
|
|
|
ENDP(pt1); \
|
|
|
|
FAIL(); \
|
|
|
|
ENDD(d0);
|
|
|
|
#endif /* defined(YAPOR_SBA) && defined(FROZEN_STACKS) */
|
|
|
|
#endif /* COROUTINING */
|
|
|
|
|
|
|
|
#define COMMIT_B_Y_INSTINIT \
|
|
|
|
register CELL d0; \
|
|
|
|
register CELL *pt1;
|
|
|
|
|
|
|
|
#define COMMIT_B_Y_DO_COMMIT_B_Y \
|
2015-01-18 01:32:13 +00:00
|
|
|
d0 = YREG[(*_PREG)->u.yps.y];
|
2014-07-13 05:30:14 +01:00
|
|
|
|
|
|
|
#define COMMIT_B_Y_COMMIT_B_Y_NVAR \
|
2015-01-18 01:32:13 +00:00
|
|
|
SET_ASP(YREG, (*_PREG)->u.yps.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP(NEXTOP(NEXTOP((*_PREG), yps),Osbpp),l); \
|
|
|
|
choiceptr pt0;
|
|
|
|
|
|
|
|
#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
|
|
|
|
#define COMMIT_B_Y_YSBA_FROZEN \
|
|
|
|
pt0 = (choiceptr)IntegerOfTerm(d0);
|
|
|
|
#else
|
|
|
|
#define COMMIT_B_Y_NOYSBA_NOFROZEN \
|
|
|
|
pt0 = (choiceptr)(LCL0-IntegerOfTerm(d0));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define COMMIT_B_Y_POST_YSBA_FROZEN \
|
|
|
|
saveregs(); \
|
|
|
|
prune(pt0); \
|
|
|
|
setregs(); \
|
|
|
|
GONext();
|
|
|
|
|