checking for frozen segments in the trail stack in now done using the

macro IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)
This commit is contained in:
Ricardo Rocha
2010-03-12 20:02:32 +00:00
parent df6b9a8511
commit ee0022bb47
8 changed files with 35 additions and 36 deletions

View File

@@ -492,7 +492,7 @@ void unbind_variables(tr_fr_ptr unbind_tr, tr_fr_ptr end_tr) {
RESET_VARIABLE(ref);
} else if (IsPairTerm(ref)) {
ref = (CELL) RepPair(ref);
if ((ADDR)ref >= Yap_TrailBase) {
if (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
/* avoid frozen segments */
unbind_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
@@ -531,7 +531,7 @@ void rebind_variables(tr_fr_ptr rebind_tr, tr_fr_ptr end_tr) {
*((CELL *)ref) = TrailVal(rebind_tr);
} else if (IsPairTerm(ref)) {
ref = (CELL) RepPair(ref);
if ((ADDR)ref >= Yap_TrailBase) {
if (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
/* avoid frozen segments */
rebind_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
@@ -575,7 +575,8 @@ void restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr) {
RESET_VARIABLE(ref);
} else if (IsPairTerm(ref)) {
ref = (CELL) RepPair(ref);
if ((ADDR)ref >= Yap_TrailBase) {
if (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
/* avoid frozen segments */
unbind_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
if (unbind_tr > (tr_fr_ptr) Yap_TrailTop)
@@ -601,7 +602,8 @@ void restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr) {
ref = (CELL) TrailTerm(--end_tr);
if (IsPairTerm(ref)) {
ref = (CELL) RepPair(ref);
if ((ADDR)ref >= Yap_TrailBase) {
if (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
/* avoid frozen segments */
end_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
if (end_tr > (tr_fr_ptr) Yap_TrailTop)
@@ -618,7 +620,8 @@ void restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr) {
*((CELL *)ref) = TrailVal(rebind_tr);
} else if (IsPairTerm(ref)) {
ref = (CELL) RepPair(ref);
if ((ADDR)ref >= Yap_TrailBase) {
if (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
/* avoid frozen segments */
rebind_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
if (rebind_tr > (tr_fr_ptr) Yap_TrailTop)
@@ -818,9 +821,9 @@ void resume_frozen_cp(choiceptr frozen_cp) {
static inline
void abolish_all_frozen_cps(void) {
B_FZ = B_BASE;
H_FZ = H_BASE;
TR_FZ = TR_BASE;
B_FZ = (choiceptr) Yap_LocalBase;
H_FZ = (CELL *) Yap_GlobalBase;
TR_FZ = (tr_fr_ptr) Yap_TrailBase;
return;
}