This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/C/fli_absmi_insts.h

641 lines
16 KiB
C
Raw Normal View History

2015-01-18 03:00:19 +00:00
/************************************************************************\
* Call C predicates instructions *
\************************************************************************/
#ifdef INDENT_CODE
{
{
{
#endif /* INDENT_CODE */
BOp(call_cpred, Osbpp);
2015-03-16 17:25:09 +00:00
#if __ANDROID__ && STRONG_DEBUG
2016-03-29 01:55:12 +01:00
char *s;
Atom name;
2015-03-11 22:18:00 +00:00
if (PREG->y_u.Osbpp.p->ArityOfPE) {
2016-03-29 01:55:12 +01:00
Functor f = PREG->y_u.Osbpp.p->FunctorOfPred;
name = f->NameOfFE;
2015-03-11 22:18:00 +00:00
} else {
2016-03-29 01:55:12 +01:00
name = (Atom)(PREG->y_u.Osbpp.p->FunctorOfPred);
2015-03-11 22:18:00 +00:00
}
s = name->StrOfAE;
2015-04-13 13:28:17 +01:00
2016-03-29 01:55:12 +01:00
LOG(" %s ", s);
2015-03-11 22:18:00 +00:00
#endif
2015-01-18 03:00:19 +00:00
check_trail(TR);
2016-03-29 01:55:12 +01:00
if (!(PREG->y_u.Osbpp.p->PredFlags &
(SafePredFlag | NoTracePredFlag | HiddenPredFlag))) {
2015-01-18 03:00:19 +00:00
CACHE_Y_AS_ENV(YREG);
check_stack(NoStackCCall, HR);
ENDCACHE_Y_AS_ENV();
}
2016-03-29 01:55:12 +01:00
do_c_call :
2015-01-18 03:00:19 +00:00
#ifdef FROZEN_STACKS
2016-03-29 01:55:12 +01:00
{
choiceptr top_b = PROTECT_FROZEN_B(B);
2015-01-18 03:00:19 +00:00
#ifdef YAPOR_SBA
2016-03-29 01:55:12 +01:00
if (YREG > (CELL *)top_b || YREG < HR)
ASP = (CELL *)top_b;
2015-01-18 03:00:19 +00:00
#else
2016-03-29 01:55:12 +01:00
if (YREG > (CELL *)top_b)
ASP = (CELL *)top_b;
2015-01-18 03:00:19 +00:00
#endif /* YAPOR_SBA */
2016-03-29 01:55:12 +01:00
else
ASP = (CELL *)(((char *)YREG) + PREG->y_u.Osbpp.s);
}
2015-01-18 03:00:19 +00:00
#else
SET_ASP(YREG, PREG->y_u.Osbpp.s);
2016-03-29 01:55:12 +01:00
/* for slots to work */
2015-01-18 03:00:19 +00:00
#endif /* FROZEN_STACKS */
#ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace)
2016-03-29 01:55:12 +01:00
low_level_trace(enter_pred, PREG->y_u.Osbpp.p, XREGS + 1);
#endif /* LOW_LEVEL_TRACE */
2015-01-18 03:00:19 +00:00
BEGD(d0);
CPredicate f = PREG->y_u.Osbpp.p->cs.f_code;
PREG = NEXTOP(PREG, Osbpp);
saveregs();
d0 = (f)(PASS_REGS1);
setregs();
#ifdef SHADOW_S
SREG = Yap_REGS.S_;
#endif
if (!d0) {
FAIL();
}
CACHE_A1();
ENDD(d0);
JMPNext();
NoStackCCall:
PROCESS_INT(interrupt_call, do_c_call);
ENDBOp();
/* execute Label */
BOp(execute_cpred, pp);
check_trail(TR);
{
PredEntry *pt0;
BEGD(d0);
CACHE_Y_AS_ENV(YREG);
#ifndef NO_CHECKING
check_stack(NoStackExecuteC, HR);
2016-03-29 01:55:12 +01:00
do_executec :
2015-01-18 03:00:19 +00:00
#endif
#ifdef FROZEN_STACKS
2016-03-29 01:55:12 +01:00
{
choiceptr top_b = PROTECT_FROZEN_B(B);
2015-01-18 03:00:19 +00:00
#ifdef YAPOR_SBA
2016-03-29 01:55:12 +01:00
if (YREG > (CELL *)top_b || YREG < HR)
ASP = (CELL *)top_b;
2015-01-18 03:00:19 +00:00
#else
2016-03-29 01:55:12 +01:00
if (YREG > (CELL *)top_b)
ASP = (CELL *)top_b;
2015-01-18 03:00:19 +00:00
#endif /* YAPOR_SBA */
2016-03-29 01:55:12 +01:00
else
ASP = YREG + E_CB;
}
2015-01-18 03:00:19 +00:00
#else
2016-03-29 01:55:12 +01:00
SET_ASP(YREG, E_CB * sizeof(CELL));
/* for slots to work */
2015-01-18 03:00:19 +00:00
#endif /* FROZEN_STACKS */
pt0 = PREG->y_u.pp.p;
#ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) {
2016-03-29 01:55:12 +01:00
low_level_trace(enter_pred, pt0, XREGS + 1);
2015-01-18 03:00:19 +00:00
}
2016-03-29 01:55:12 +01:00
#endif /* LOW_LEVEL_TRACE */
2015-01-18 03:00:19 +00:00
CACHE_A1();
BEGD(d0);
d0 = (CELL)B;
/* for profiler */
save_pc();
ENV_YREG[E_CB] = d0;
ENDD(d0);
#ifdef DEPTH_LIMIT
2016-03-29 01:55:12 +01:00
if (DEPTH <= MkIntTerm(1)) { /* I assume Module==0 is prolog */
2015-01-18 03:00:19 +00:00
if (pt0->ModuleOfPred) {
2015-01-20 03:00:42 +00:00
if (DEPTH == MkIntTerm(0)) {
2015-01-18 03:00:19 +00:00
FAIL();
2016-03-29 01:55:12 +01:00
} else {
DEPTH = RESET_DEPTH();
}
2015-01-18 03:00:19 +00:00
}
} else if (pt0->ModuleOfPred) {
DEPTH -= MkIntConstant(2);
}
2016-03-29 01:55:12 +01:00
#endif /* DEPTH_LIMIT */
2015-01-18 03:00:19 +00:00
/* now call C-Code */
{
CPredicate f = PREG->y_u.pp.p->cs.f_code;
yamop *oldPREG = PREG;
saveregs();
2016-09-21 20:30:52 +01:00
d0 = f(PASS_REGS1);
2015-01-18 03:00:19 +00:00
setregs();
#ifdef SHADOW_S
SREG = Yap_REGS.S_;
#endif
if (!d0) {
FAIL();
}
if (oldPREG == PREG) {
/* we did not update PREG */
/* we can proceed */
PREG = CPREG;
ENV_YREG = ENV;
#ifdef DEPTH_LIMIT
DEPTH = ENV_YREG[E_DEPTH];
#endif
WRITEBACK_Y_AS_ENV();
} else {
/* call the new code */
CACHE_A1();
}
}
JMPNext();
ENDCACHE_Y_AS_ENV();
ENDD(d0);
}
NoStackExecuteC:
PROCESS_INT(interrupt_execute, do_executec);
ENDBOp();
/* Like previous, the only difference is that we do not */
/* trust the C-function we are calling and hence we must */
/* guarantee that *all* machine registers are saved and */
/* restored */
BOp(call_usercpred, Osbpp);
CACHE_Y_AS_ENV(YREG);
check_stack(NoStackUserCall, HR);
ENDCACHE_Y_AS_ENV();
do_user_call:
#ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) {
2016-03-29 01:55:12 +01:00
low_level_trace(enter_pred, PREG->y_u.Osbpp.p, XREGS + 1);
2015-01-18 03:00:19 +00:00
}
2016-03-29 01:55:12 +01:00
#endif /* LOW_LEVEL_TRACE */
2015-01-18 03:00:19 +00:00
#ifdef FROZEN_STACKS
{
choiceptr top_b = PROTECT_FROZEN_B(B);
#ifdef YAPOR_SBA
2016-03-29 01:55:12 +01:00
if (YREG > (CELL *)top_b || YREG < HR)
ASP = (CELL *)top_b;
2015-01-18 03:00:19 +00:00
#else
2016-03-29 01:55:12 +01:00
if (YREG > (CELL *)top_b)
ASP = (CELL *)top_b;
2015-01-18 03:00:19 +00:00
#endif /* YAPOR_SBA */
2016-03-29 01:55:12 +01:00
else
ASP = (CELL *)(((char *)YREG) + PREG->y_u.Osbpp.s);
2015-01-18 03:00:19 +00:00
}
#else
SET_ASP(YREG, PREG->y_u.Osbpp.s);
2016-03-29 01:55:12 +01:00
/* for slots to work */
2015-01-18 03:00:19 +00:00
#endif /* FROZEN_STACKS */
{
2016-03-29 01:55:12 +01:00
/* make sure that we can still have access to our old PREG after calling
* user defined goals and backtracking or failing */
2015-01-18 03:00:19 +00:00
yamop *savedP;
LOCAL_PrologMode |= UserCCallMode;
{
PredEntry *p = PREG->y_u.Osbpp.p;
PREG = NEXTOP(PREG, Osbpp);
savedP = PREG;
saveregs();
save_machine_regs();
2016-03-29 01:55:12 +01:00
SREG = (CELL *)YAP_Execute(p, p->cs.f_code);
2015-01-18 03:00:19 +00:00
}
setregs();
LOCAL_PrologMode &= ~UserCCallMode;
restore_machine_regs();
PREG = savedP;
}
2016-03-29 01:55:12 +01:00
if (Yap_HasException()) {
Yap_RaiseException();
2015-01-18 03:00:19 +00:00
SREG = NULL;
}
if (!SREG) {
FAIL();
}
/* in case we call Execute */
YENV = ENV;
YREG = ENV;
JMPNext();
NoStackUserCall:
PROCESS_INT(interrupt_call, do_user_call);
ENDBOp();
2015-09-29 23:04:01 +01:00
BOp(call_c_wfail, slpp);
2015-01-18 03:00:19 +00:00
#ifdef LOW_LEVEL_TRACER
if (Yap_do_low_level_trace) {
2016-03-29 01:55:12 +01:00
low_level_trace(enter_pred, PREG->y_u.slpp.p, XREGS + 1);
2015-01-18 03:00:19 +00:00
}
2016-03-29 01:55:12 +01:00
#endif /* LOW_LEVEL_TRACE */
2015-01-18 03:00:19 +00:00
#ifdef FROZEN_STACKS
{
choiceptr top_b = PROTECT_FROZEN_B(B);
#ifdef YAPOR_SBA
2016-03-29 01:55:12 +01:00
if (YREG > (CELL *)top_b || YREG < HR)
ASP = (CELL *)top_b;
2015-01-18 03:00:19 +00:00
#else
2016-03-29 01:55:12 +01:00
if (YREG > (CELL *)top_b)
ASP = (CELL *)top_b;
2015-01-18 03:00:19 +00:00
#endif /* YAPOR_SBA */
else {
BEGD(d0);
2015-09-29 23:04:01 +01:00
d0 = PREG->y_u.slpp.s;
2015-01-18 03:00:19 +00:00
ASP = ((CELL *)YREG) + d0;
ENDD(d0);
}
}
#else
2016-03-29 01:55:12 +01:00
if (YREG > (CELL *)B)
ASP = (CELL *)B;
2015-01-18 03:00:19 +00:00
else {
BEGD(d0);
2015-09-29 23:04:01 +01:00
d0 = PREG->y_u.slpp.s;
2016-03-29 01:55:12 +01:00
ASP = ((CELL *)YREG) + d0;
2015-01-18 03:00:19 +00:00
ENDD(d0);
}
#endif /* FROZEN_STACKS */
{
2015-09-29 23:04:01 +01:00
CPredicate f = PREG->y_u.slpp.p->cs.f_code;
2015-01-18 03:00:19 +00:00
saveregs();
SREG = (CELL *)((f)(PASS_REGS1));
setregs();
}
if (!SREG) {
/* be careful about error handling */
if (PREG != FAILCODE)
2015-09-29 23:04:01 +01:00
PREG = PREG->y_u.slpp.l;
2015-01-18 03:00:19 +00:00
} else {
2015-09-29 23:04:01 +01:00
PREG = NEXTOP(PREG, slpp);
2015-01-18 03:00:19 +00:00
}
CACHE_A1();
JMPNext();
ENDBOp();
BOp(try_c, OtapFs);
#ifdef YAPOR
CUT_wait_leftmost();
#endif /* YAPOR */
CACHE_Y(YREG);
/* Alocate space for the cut_c structure*/
2016-03-29 01:55:12 +01:00
CUT_C_PUSH(NEXTOP(NEXTOP(PREG, OtapFs), OtapFs), S_YREG);
2015-01-18 03:00:19 +00:00
S_YREG = S_YREG - PREG->y_u.OtapFs.extra;
store_args(PREG->y_u.OtapFs.s);
2016-03-29 01:55:12 +01:00
store_yaam_regs(NEXTOP(P, OtapFs), 0);
2015-01-18 03:00:19 +00:00
B = B_YREG;
#ifdef YAPOR
SCH_set_load(B_YREG);
2016-03-29 01:55:12 +01:00
#endif /* YAPOR */
2015-01-18 03:00:19 +00:00
SET_BB(B_YREG);
ENDCACHE_Y();
TRYCC:
ASP = (CELL *)B;
{
CPredicate f = (CPredicate)(PREG->y_u.OtapFs.f);
saveregs();
2016-03-29 01:55:12 +01:00
SREG = (CELL *)((f)(PASS_REGS1));
2015-01-18 03:00:19 +00:00
/* This last instruction changes B B*/
2016-03-29 01:55:12 +01:00
while (POP_CHOICE_POINT(B)) {
2015-01-18 03:00:19 +00:00
cut_c_pop();
}
setregs();
}
if (!SREG) {
/* Removes the cut functions from the stack
without executing them because we have fail
and not cuted the predicate*/
2016-03-29 01:55:12 +01:00
while (POP_CHOICE_POINT(B))
2015-01-18 03:00:19 +00:00
cut_c_pop();
FAIL();
}
2016-03-29 01:55:12 +01:00
if ((CELL *)B == YREG && ASP != (CELL *)B) {
2015-01-18 03:00:19 +00:00
/* 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);
SET_BB(B);
}
PREG = CPREG;
YREG = ENV;
JMPNext();
ENDBOp();
BOp(retry_c, OtapFs);
#ifdef YAPOR
CUT_wait_leftmost();
#endif /* YAPOR */
CACHE_Y(B);
CPREG = B_YREG->cp_cp;
ENV = B_YREG->cp_env;
HR = PROTECT_FROZEN_H(B);
#ifdef DEPTH_LIMIT
2016-03-29 01:55:12 +01:00
DEPTH = B->cp_depth;
2015-01-18 03:00:19 +00:00
#endif
HBREG = HR;
restore_args(PREG->y_u.OtapFs.s);
ENDCACHE_Y();
goto TRYCC;
ENDBOp();
BOp(cut_c, OtapFs);
2016-03-29 01:55:12 +01:00
/*This is a phantom instruction. This is not executed by the WAM*/
2015-01-18 03:00:19 +00:00
#ifdef DEBUG
/*If WAM executes this instruction, probably there's an error
when we put this instruction, cut_c, after retry_c*/
2016-03-29 01:55:12 +01:00
printf("ERROR: Should not print this message FILE: absmi.c %d\n",
__LINE__);
2015-01-18 03:00:19 +00:00
#endif /*DEBUG*/
ENDBOp();
BOp(try_userc, OtapFs);
#ifdef YAPOR
CUT_wait_leftmost();
#endif /* YAPOR */
CACHE_Y(YREG);
/* Alocate space for the cut_c structure*/
2016-03-29 01:55:12 +01:00
CUT_C_PUSH(NEXTOP(NEXTOP(PREG, OtapFs), OtapFs), S_YREG);
2015-01-18 03:00:19 +00:00
S_YREG = S_YREG - PREG->y_u.OtapFs.extra;
store_args(PREG->y_u.OtapFs.s);
store_yaam_regs(NEXTOP(PREG, OtapFs), 0);
B = B_YREG;
#ifdef YAPOR
SCH_set_load(B_YREG);
#endif
SET_BB(B_YREG);
ENDCACHE_Y();
2015-01-20 03:00:42 +00:00
LOCAL_PrologMode = UserCCallMode;
2015-01-18 03:00:19 +00:00
ASP = YREG;
saveregs();
save_machine_regs();
2016-03-29 01:55:12 +01:00
SREG = (CELL *)YAP_ExecuteFirst(PREG->y_u.OtapFs.p,
(CPredicate)(PREG->y_u.OtapFs.f));
Yap_ResetException( worker_id );
2015-01-18 03:00:19 +00:00
restore_machine_regs();
setregs();
2015-01-20 03:00:42 +00:00
LOCAL_PrologMode &= UserMode;
2015-01-18 03:00:19 +00:00
if (!SREG) {
FAIL();
}
2016-03-29 01:55:12 +01:00
if ((CELL *)B == YREG && ASP != (CELL *)B) {
2015-01-18 03:00:19 +00:00
/* 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();
BOp(retry_userc, OtapFs);
#ifdef YAPOR
CUT_wait_leftmost();
#endif /* YAPOR */
CACHE_Y(B);
CPREG = B_YREG->cp_cp;
ENV = B_YREG->cp_env;
HR = PROTECT_FROZEN_H(B);
#ifdef DEPTH_LIMIT
2016-03-29 01:55:12 +01:00
DEPTH = B->cp_depth;
2015-01-18 03:00:19 +00:00
#endif
HBREG = HR;
restore_args(PREG->y_u.OtapFs.s);
ENDCACHE_Y();
LOCAL_PrologMode |= UserCCallMode;
2016-03-29 01:55:12 +01:00
SET_ASP(YREG, E_CB * sizeof(CELL));
2015-01-18 03:00:19 +00:00
saveregs();
save_machine_regs();
2016-03-29 01:55:12 +01:00
SREG = (CELL *)YAP_ExecuteNext(PREG->y_u.OtapFs.p,
(CPredicate)(PREG->y_u.OtapFs.f));
Yap_ResetException( worker_id);
2015-01-18 03:00:19 +00:00
restore_machine_regs();
setregs();
LOCAL_PrologMode &= ~UserCCallMode;
if (!SREG) {
/* Removes the cut functions from the stack
without executing them because we have fail
and not cuted the predicate*/
2016-03-29 01:55:12 +01:00
while (POP_CHOICE_POINT(B))
2015-01-18 03:00:19 +00:00
cut_c_pop();
FAIL();
}
2016-03-29 01:55:12 +01:00
if ((CELL *)B == YREG && ASP != (CELL *)B) {
2015-01-18 03:00:19 +00:00
/* 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();
BOp(cut_userc, OtapFs);
2016-03-29 01:55:12 +01:00
/*This is a phantom instruction. This is not executed by the WAM*/
2015-01-18 03:00:19 +00:00
#ifdef DEBUG
/*If WAM executes this instruction, probably there's an error
when we put this instruction, cut_userc, after retry_userc*/
2016-03-29 01:55:12 +01:00
printf("ERROR: Should not print this message FILE: absmi.c %d\n",
__LINE__);
2015-01-18 03:00:19 +00:00
#endif /*DEBUG*/
CACHE_A1();
JMPNext();
ENDBOp();
/************************************************************************\
* support instructions *
\************************************************************************/
BOp(lock_pred, e);
{
PredEntry *ap = PredFromDefCode(PREG);
2016-03-29 01:55:12 +01:00
PELOCK(10, ap);
2015-01-18 03:00:19 +00:00
PP = ap;
if (!ap->cs.p_code.NOfClauses) {
2016-03-29 01:55:12 +01:00
UNLOCKPE(11, ap);
2015-01-18 03:00:19 +00:00
FAIL();
}
/*
we do not lock access to the predicate,
we must take extra care here
*/
if (ap->cs.p_code.NOfClauses > 1 &&
!(ap->PredFlags & IndexedPredFlag)) {
/* update ASP before calling IPred */
2016-03-29 01:55:12 +01:00
SET_ASP(YREG, E_CB * sizeof(CELL));
2015-01-18 03:00:19 +00:00
saveregs();
Yap_IPred(ap, 0, CP);
2016-03-29 01:55:12 +01:00
/* IPred can generate errors, it thus must get rid of the lock itself
*/
2015-01-18 03:00:19 +00:00
setregs();
CACHE_A1();
/* for profiler */
save_pc();
}
PREG = ap->cs.p_code.TrueCodeOfPred;
}
JMPNext();
ENDBOp();
BOp(index_pred, e);
{
PredEntry *ap = PredFromDefCode(PREG);
#if defined(YAPOR) || defined(THREADS)
/*
we do not lock access to the predicate,
we must take extra care here
*/
if (!PP) {
2016-03-29 01:55:12 +01:00
PELOCK(11, ap);
2015-01-18 03:00:19 +00:00
}
if (ap->OpcodeOfPred != INDEX_OPCODE) {
/* someone was here before we were */
if (!PP) {
2016-03-29 01:55:12 +01:00
UNLOCKPE(11, ap);
2015-01-18 03:00:19 +00:00
}
PREG = ap->CodeOfPred;
/* for profiler */
save_pc();
JMPNext();
}
#endif
/* update ASP before calling IPred */
2016-03-29 01:55:12 +01:00
SET_ASP(YREG, E_CB * sizeof(CELL));
2015-01-18 03:00:19 +00:00
saveregs();
Yap_IPred(ap, 0, CP);
/* IPred can generate errors, it thus must get rid of the lock itself */
setregs();
CACHE_A1();
PREG = ap->CodeOfPred;
/* for profiler */
save_pc();
#if defined(YAPOR) || defined(THREADS)
if (!PP)
#endif
2016-03-29 01:55:12 +01:00
UNLOCKPE(14, ap);
2015-01-18 03:00:19 +00:00
}
JMPNext();
ENDBOp();
#if THREADS
BOp(thread_local, e);
{
PredEntry *ap = PredFromDefCode(PREG);
ap = Yap_GetThreadPred(ap PASS_REGS);
PREG = ap->CodeOfPred;
/* for profiler */
save_pc();
}
JMPNext();
ENDBOp();
#endif
BOp(expand_index, e);
{
PredEntry *pe = PredFromExpandCode(PREG);
yamop *pt0;
/* update ASP before calling IPred */
2016-03-29 01:55:12 +01:00
SET_ASP(YREG, E_CB * sizeof(CELL));
2015-01-18 03:00:19 +00:00
#if defined(YAPOR) || defined(THREADS)
if (!PP) {
2016-03-29 01:55:12 +01:00
PELOCK(12, pe);
2015-01-18 03:00:19 +00:00
}
if (!same_lu_block(PREG_ADDR, PREG)) {
PREG = *PREG_ADDR;
if (!PP) {
2016-03-29 01:55:12 +01:00
UNLOCKPE(15, pe);
2015-01-18 03:00:19 +00:00
}
JMPNext();
}
#endif
#ifdef SHADOW_S
S = SREG;
#endif /* SHADOW_S */
saveregs();
pt0 = Yap_ExpandIndex(pe, 0);
/* restart index */
setregs();
#ifdef SHADOW_S
SREG = S;
#endif /* SHADOW_S */
PREG = pt0;
#if defined(YAPOR) || defined(THREADS)
if (!PP) {
2016-03-29 01:55:12 +01:00
UNLOCKPE(12, pe);
2015-01-18 03:00:19 +00:00
}
#endif
JMPNext();
}
ENDBOp();
BOp(expand_clauses, sssllp);
{
PredEntry *pe = PREG->y_u.sssllp.p;
yamop *pt0;
/* update ASP before calling IPred */
2016-03-29 01:55:12 +01:00
SET_ASP(YREG, E_CB * sizeof(CELL));
2015-01-18 03:00:19 +00:00
#if defined(YAPOR) || defined(THREADS)
if (PP == NULL) {
2016-03-29 01:55:12 +01:00
PELOCK(13, pe);
2015-01-18 03:00:19 +00:00
}
if (!same_lu_block(PREG_ADDR, PREG)) {
PREG = *PREG_ADDR;
if (!PP) {
2016-03-29 01:55:12 +01:00
UNLOCKPE(16, pe);
2015-01-18 03:00:19 +00:00
}
JMPNext();
2016-03-29 01:55:12 +01:00
}
2015-01-18 03:00:19 +00:00
#endif
2016-03-29 01:55:12 +01:00
saveregs();
pt0 = Yap_ExpandIndex(pe, 0);
/* restart index */
setregs();
PREG = pt0;
2015-01-18 03:00:19 +00:00
#if defined(YAPOR) || defined(THREADS)
2016-03-29 01:55:12 +01:00
if (!PP) {
UNLOCKPE(18, pe);
}
2015-01-18 03:00:19 +00:00
#endif
2016-03-29 01:55:12 +01:00
JMPNext();
2015-01-18 03:00:19 +00:00
}
ENDBOp();
BOp(undef_p, e);
/* save S for module name */
saveregs();
2016-03-29 01:55:12 +01:00
undef_goal(PASS_REGS1);
2015-01-18 03:00:19 +00:00
setregs();
/* for profiler */
CACHE_A1();
JMPNext();
ENDBOp();
BOp(spy_pred, e);
saveregs();
2016-03-29 01:55:12 +01:00
spy_goal(PASS_REGS1);
2015-01-18 03:00:19 +00:00
setregs();
CACHE_A1();
JMPNext();
ENDBOp();