2014-07-13 05:30:14 +01:00
|
|
|
#define COUNT_CALL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK((*_PREG)->u.p.p->StatisticsForPred->lock); \
|
|
|
|
(*_PREG)->u.p.p->StatisticsForPred->NOfEntries++; \
|
|
|
|
UNLOCK((*_PREG)->u.p.p->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
LOCAL_ReductionsCounter--;
|
|
|
|
|
|
|
|
#define COUNT_CALL_MIDDLE \
|
|
|
|
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(CALL_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
else { \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define COUNT_CALL_END \
|
|
|
|
(*_PREG) = NEXTOP((*_PREG), p); \
|
|
|
|
GONext();
|
|
|
|
|
|
|
|
#define COUNT_RETRY_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK((*_PREG)->u.p.p->StatisticsForPred->lock); \
|
|
|
|
(*_PREG)->u.p.p->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK((*_PREG)->u.p.p->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
LOCAL_RetriesCounter--;
|
|
|
|
|
|
|
|
#define COUNT_RETRY_MIDDLE \
|
|
|
|
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) { \
|
|
|
|
ENV = B->cp_env; \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
else { \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
|
|
|
|
ENV = B->cp_env; \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define COUNT_RETRY_END \
|
|
|
|
(*_PREG) = NEXTOP((*_PREG), p); \
|
|
|
|
GONext();
|
|
|
|
|
|
|
|
#define COUNT_RETRY_ME_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
CACHE_Y(B); \
|
2015-01-18 01:32:13 +00:00
|
|
|
restore_yaam_regs((*_PREG)->u.Otapl.d); \
|
|
|
|
restore_args((*_PREG)->u.Otapl.s);
|
2014-07-13 05:30:14 +01:00
|
|
|
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_RETRY_ME_MIDDLE \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->lock); \
|
|
|
|
((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_RETRY_ME_MIDDLE \
|
|
|
|
set_cut(S_YREG, B_YREG->cp_b); \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->lock); \
|
|
|
|
((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
|
|
|
|
#define COUNT_RETRY_ME_END \
|
|
|
|
(*_PREG) = NEXTOP((*_PREG), Otapl); \
|
|
|
|
GONext();
|
|
|
|
|
|
|
|
#define COUNT_TRUST_ME_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
CACHE_Y(B);
|
|
|
|
|
|
|
|
#ifdef YAPOR
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_TRUST_ME_MIDDLE \
|
|
|
|
if (SCH_top_shared_cp(B)) { \
|
|
|
|
SCH_last_alternative((*_PREG), B_YREG); \
|
2015-01-18 01:32:13 +00:00
|
|
|
restore_args((*_PREG)->u.Otapl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
2015-01-18 01:32:13 +00:00
|
|
|
pop_args((*_PREG)->u.Otapl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_TRUST_ME_MIDDLE \
|
|
|
|
if (SCH_top_shared_cp(B)) { \
|
|
|
|
SCH_last_alternative((*_PREG), B_YREG); \
|
2015-01-18 01:32:13 +00:00
|
|
|
restore_args((*_PREG)->u.Otapl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
2015-01-18 01:32:13 +00:00
|
|
|
pop_args((*_PREG)->u.Otapl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#else /* YAPOR */
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_TRUST_ME_MIDDLE \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
2015-01-18 01:32:13 +00:00
|
|
|
pop_args((*_PREG)->u.Otapl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_TRUST_ME_MIDDLE \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
2015-01-18 01:32:13 +00:00
|
|
|
pop_args((*_PREG)->u.Otapl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#endif /* YAPOR */
|
|
|
|
|
|
|
|
#define COUNT_TRUST_ME_END \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->lock); \
|
|
|
|
((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(((PredEntry *)((*_PREG)->u.Otapl.p))->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = NEXTOP((*_PREG), Otapl); \
|
|
|
|
GONext();
|
|
|
|
|
|
|
|
#ifdef THREADS
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_RETRY_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
YAAM_CHECK_TRAIL_TR; \
|
|
|
|
{ \
|
|
|
|
UInt timestamp; \
|
|
|
|
CACHE_Y(B); \
|
2015-01-18 01:32:13 +00:00
|
|
|
timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[(*_PREG)->u.OtaLl.s]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, (*_PREG)->u.OtaLl.d)) { \
|
|
|
|
(*_PREG)=(*_PREG)->u.OtaLl.n; \
|
2014-07-13 05:30:14 +01:00
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-01-18 01:32:13 +00:00
|
|
|
restore_yaam_regs((*_PREG)->u.OtaLl.n); \
|
|
|
|
restore_args((*_PREG)->u.OtaLl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \
|
|
|
|
(*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \
|
2015-01-18 01:32:13 +00:00
|
|
|
PP = (*_PREG)->u.OtaLl.d->ClPred; \
|
|
|
|
(*_PREG) = (*_PREG)->u.OtaLl.d->ClCode; \
|
2014-07-13 05:30:14 +01:00
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
} \
|
|
|
|
JMPNext();
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_RETRY_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
YAAM_CHECK_TRAIL_TR; \
|
|
|
|
{ \
|
|
|
|
UInt timestamp; \
|
|
|
|
CACHE_Y(B); \
|
2015-01-18 01:32:13 +00:00
|
|
|
timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[(*_PREG)->u.OtaLl.s]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, (*_PREG)->u.OtaLl.d)) { \
|
|
|
|
(*_PREG)=(*_PREG)->u.OtaLl.n; \
|
2014-07-13 05:30:14 +01:00
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-01-18 01:32:13 +00:00
|
|
|
restore_yaam_regs((*_PREG)->u.OtaLl.n); \
|
|
|
|
restore_args((*_PREG)->u.OtaLl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \
|
|
|
|
(*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \
|
2015-01-18 01:32:13 +00:00
|
|
|
PP = (*_PREG)->u.OtaLl.d->ClPred; \
|
|
|
|
(*_PREG) = (*_PREG)->u.OtaLl.d->ClCode; \
|
2014-07-13 05:30:14 +01:00
|
|
|
set_cut(S_YREG, B_YREG->cp_b); \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
} \
|
|
|
|
JMPNext();
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#else /* THREADS */
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_RETRY_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
YAAM_CHECK_TRAIL_TR; \
|
|
|
|
{ \
|
|
|
|
UInt timestamp; \
|
|
|
|
CACHE_Y(B); \
|
2015-01-18 01:32:13 +00:00
|
|
|
timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[(*_PREG)->u.OtaLl.s]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, (*_PREG)->u.OtaLl.d)) { \
|
|
|
|
(*_PREG)=(*_PREG)->u.OtaLl.n; \
|
2014-07-13 05:30:14 +01:00
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-01-18 01:32:13 +00:00
|
|
|
restore_yaam_regs((*_PREG)->u.OtaLl.n); \
|
|
|
|
restore_args((*_PREG)->u.OtaLl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \
|
|
|
|
(*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \
|
2015-01-18 01:32:13 +00:00
|
|
|
(*_PREG) = (*_PREG)->u.OtaLl.d->ClCode; \
|
2014-07-13 05:30:14 +01:00
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
} \
|
|
|
|
JMPNext();
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_RETRY_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
YAAM_CHECK_TRAIL_TR; \
|
|
|
|
{ \
|
|
|
|
UInt timestamp; \
|
|
|
|
CACHE_Y(B); \
|
2015-01-18 01:32:13 +00:00
|
|
|
timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[(*_PREG)->u.OtaLl.s]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, (*_PREG)->u.OtaLl.d)) { \
|
|
|
|
(*_PREG)=(*_PREG)->u.OtaLl.n; \
|
2014-07-13 05:30:14 +01:00
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-01-18 01:32:13 +00:00
|
|
|
restore_yaam_regs((*_PREG)->u.OtaLl.n); \
|
|
|
|
restore_args((*_PREG)->u.OtaLl.s); \
|
2014-07-13 05:30:14 +01:00
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \
|
|
|
|
(*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK((*_PREG)->u.OtaLl.d->ClPred->StatisticsForPred->lock); \
|
2015-01-18 01:32:13 +00:00
|
|
|
(*_PREG) = (*_PREG)->u.OtaLl.d->ClCode; \
|
2014-07-13 05:30:14 +01:00
|
|
|
set_cut(S_YREG, B_YREG->cp_b); \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
} \
|
|
|
|
JMPNext();
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#endif /* THREADS */
|
|
|
|
|
|
|
|
#define COUNT_RETRY_LOGICAL_END \
|
|
|
|
BLOCK = (CELL)COUNT_RETRY_LOGICAL_END;
|
|
|
|
|
|
|
|
#if MULTIPLE_STACKS
|
|
|
|
#ifdef YAPOR
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
PELOCK(2, ap); \
|
|
|
|
PP = ap; \
|
|
|
|
DEC_CLREF_COUNT(cl); \
|
|
|
|
--B->cp_tr; \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1) { \
|
|
|
|
INC_CLREF_COUNT(lcl); \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
if (SCH_top_shared_cp(B)) { \
|
|
|
|
SCH_last_alternative((*_PREG), B_YREG); \
|
|
|
|
restore_args(ap->ArityOfPE); \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
} else \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
PELOCK(2, ap); \
|
|
|
|
PP = ap; \
|
|
|
|
DEC_CLREF_COUNT(cl); \
|
|
|
|
--B->cp_tr; \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1) { \
|
|
|
|
INC_CLREF_COUNT(lcl); \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
if (SCH_top_shared_cp(B)) { \
|
|
|
|
SCH_last_alternative((*_PREG), B_YREG); \
|
|
|
|
restore_args(ap->ArityOfPE); \
|
|
|
|
S_YREG++; \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
} else \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#else /* YAPOR */
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
PELOCK(2, ap); \
|
|
|
|
PP = ap; \
|
|
|
|
DEC_CLREF_COUNT(cl); \
|
|
|
|
--B->cp_tr; \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1) { \
|
|
|
|
INC_CLREF_COUNT(lcl); \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
PELOCK(2, ap); \
|
|
|
|
PP = ap; \
|
|
|
|
DEC_CLREF_COUNT(cl); \
|
|
|
|
--B->cp_tr; \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1) { \
|
|
|
|
INC_CLREF_COUNT(lcl); \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#endif /* YAPOR */
|
|
|
|
#else /* MULTIPLE_STACKS */
|
|
|
|
#if FROZEN_STACKS
|
|
|
|
#ifdef YAPOR
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \
|
|
|
|
B->cp_tr != B->cp_b->cp_tr) { \
|
|
|
|
cl->ClFlags &= ~InUseMask; \
|
|
|
|
--B->cp_tr; \
|
|
|
|
if (B->cp_tr > TR_FZ) \
|
|
|
|
{ \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
} if (cl->ClFlags & (ErasedMask|DirtyMask)) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \
|
|
|
|
lcl->ClFlags |= InUseMask; \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (SCH_top_shared_cp(B)) { \
|
|
|
|
SCH_last_alternative((*_PREG), B_YREG); \
|
|
|
|
restore_args(ap->ArityOfPE); \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
} else \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \
|
|
|
|
B->cp_tr != B->cp_b->cp_tr) { \
|
|
|
|
cl->ClFlags &= ~InUseMask; \
|
|
|
|
--B->cp_tr; \
|
|
|
|
if (B->cp_tr > TR_FZ) \
|
|
|
|
{ \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
} if (cl->ClFlags & (ErasedMask|DirtyMask)) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \
|
|
|
|
lcl->ClFlags |= InUseMask; \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (SCH_top_shared_cp(B)) { \
|
|
|
|
SCH_last_alternative((*_PREG), B_YREG); \
|
|
|
|
restore_args(ap->ArityOfPE); \
|
|
|
|
S_YREG++; \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
} else \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#else /* YAPOR */
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \
|
|
|
|
B->cp_tr != B->cp_b->cp_tr) { \
|
|
|
|
cl->ClFlags &= ~InUseMask; \
|
|
|
|
--B->cp_tr; \
|
|
|
|
if (B->cp_tr > TR_FZ) \
|
|
|
|
{ \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
} if (cl->ClFlags & (ErasedMask|DirtyMask)) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \
|
|
|
|
lcl->ClFlags |= InUseMask; \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \
|
|
|
|
B->cp_tr != B->cp_b->cp_tr) { \
|
|
|
|
cl->ClFlags &= ~InUseMask; \
|
|
|
|
--B->cp_tr; \
|
|
|
|
if (B->cp_tr > TR_FZ) \
|
|
|
|
{ \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
} if (cl->ClFlags & (ErasedMask|DirtyMask)) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \
|
|
|
|
lcl->ClFlags |= InUseMask; \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#endif /* YAPOR */
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#ifdef YAPOR
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \
|
|
|
|
B->cp_tr != B->cp_b->cp_tr) { \
|
|
|
|
cl->ClFlags &= ~InUseMask; \
|
|
|
|
--B->cp_tr; \
|
|
|
|
{ \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
} if (cl->ClFlags & (ErasedMask|DirtyMask)) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \
|
|
|
|
lcl->ClFlags |= InUseMask; \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (SCH_top_shared_cp(B)) { \
|
|
|
|
SCH_last_alternative((*_PREG), B_YREG); \
|
|
|
|
restore_args(ap->ArityOfPE); \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
} else \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \
|
|
|
|
B->cp_tr != B->cp_b->cp_tr) { \
|
|
|
|
cl->ClFlags &= ~InUseMask; \
|
|
|
|
--B->cp_tr; \
|
|
|
|
{ \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
} if (cl->ClFlags & (ErasedMask|DirtyMask)) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \
|
|
|
|
lcl->ClFlags |= InUseMask; \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (SCH_top_shared_cp(B)) { \
|
|
|
|
SCH_last_alternative((*_PREG), B_YREG); \
|
|
|
|
restore_args(ap->ArityOfPE); \
|
|
|
|
S_YREG++; \
|
|
|
|
set_cut(S_YREG, B->cp_b); \
|
|
|
|
} else \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#else /* YAPOR */
|
|
|
|
#ifdef FROZEN_STACKS
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \
|
|
|
|
B->cp_tr != B->cp_b->cp_tr) { \
|
|
|
|
cl->ClFlags &= ~InUseMask; \
|
|
|
|
--B->cp_tr; \
|
|
|
|
{ \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
} if (cl->ClFlags & (ErasedMask|DirtyMask)) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \
|
|
|
|
lcl->ClFlags |= InUseMask; \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG); \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#else /* FROZEN_STACKS */
|
|
|
|
#define COUNT_TRUST_LOGICAL_INSTINIT \
|
|
|
|
print_instruction((*_PREG), ON_NATIVE); \
|
|
|
|
BLOCKADDRESS = (CELL)(*_PREG); \
|
|
|
|
CACHE_Y(B); \
|
|
|
|
{ \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdIndex *cl = (*_PREG)->u.OtILl.block; \
|
2014-07-13 05:30:14 +01:00
|
|
|
PredEntry *ap = cl->ClPred; \
|
2015-01-18 01:32:13 +00:00
|
|
|
LogUpdClause *lcl = (*_PREG)->u.OtILl.d; \
|
2014-07-13 05:30:14 +01:00
|
|
|
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); \
|
|
|
|
if (!VALID_TIMESTAMP(timestamp, lcl)) { \
|
|
|
|
(*_PREG) = FAILCODE; \
|
|
|
|
} else { \
|
|
|
|
LOCAL_RetriesCounter--; \
|
|
|
|
if (LOCAL_RetriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_NilError(RETRY_COUNTER_UNDERFLOW,""); \
|
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
|
|
|
LOCAL_PredEntriesCounter--; \
|
|
|
|
if (LOCAL_PredEntriesCounter == 0) { \
|
|
|
|
saveregs(); \
|
2015-09-25 10:57:26 +01:00
|
|
|
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
|
2014-07-13 05:30:14 +01:00
|
|
|
setregs(); \
|
|
|
|
JMPNext(); \
|
|
|
|
} \
|
2015-04-21 23:11:00 +01:00
|
|
|
LOCK(ap->StatisticsForPred->lock); \
|
|
|
|
ap->StatisticsForPred->NOfRetries++; \
|
|
|
|
UNLOCK(ap->StatisticsForPred->lock); \
|
2014-07-13 05:30:14 +01:00
|
|
|
(*_PREG) = lcl->ClCode; \
|
|
|
|
} \
|
|
|
|
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) && \
|
|
|
|
B->cp_tr != B->cp_b->cp_tr) { \
|
|
|
|
cl->ClFlags &= ~InUseMask; \
|
|
|
|
--B->cp_tr; \
|
|
|
|
{ \
|
|
|
|
TR = B->cp_tr; \
|
|
|
|
} if (cl->ClFlags & (ErasedMask|DirtyMask)) { \
|
|
|
|
if ((*_PREG) != FAILCODE) { \
|
|
|
|
if (lcl->ClRefCount == 1 && !(lcl->ClFlags & InUseMask)) { \
|
|
|
|
lcl->ClFlags |= InUseMask; \
|
|
|
|
TRAIL_CLREF(lcl); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (cl->ClFlags & ErasedMask) { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_ErLogUpdIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} else { \
|
|
|
|
saveregs(); \
|
|
|
|
Yap_CleanUpIndex(cl); \
|
|
|
|
setregs(); \
|
|
|
|
} \
|
|
|
|
save_pc(); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
{ \
|
|
|
|
pop_yaam_regs(); \
|
|
|
|
pop_args(ap->ArityOfPE); \
|
|
|
|
S_YREG--; \
|
|
|
|
set_cut(S_YREG, B); \
|
|
|
|
} \
|
|
|
|
SET_BB(B_YREG); \
|
|
|
|
ENDCACHE_Y(); \
|
|
|
|
JMPNext(); \
|
|
|
|
}
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#endif /* YAPOR */
|
|
|
|
#endif /* FROZEN_STACKS */
|
|
|
|
#endif /* MULTIPLE_STACKS */
|
|
|
|
|
|
|
|
#define COUNT_TRUST_LOGICAL_END \
|
|
|
|
BLOCK = (CELL)COUNT_TRUST_LOGICAL_END;
|
|
|
|
|