Some global variables(Yap_thread_gl) in C/init.c are now declared in misc/LOCALS

This commit is contained in:
Joao
2011-05-23 16:19:47 +01:00
parent 2f964c9f51
commit 8170f6d3cb
81 changed files with 1982 additions and 1794 deletions

View File

@@ -435,13 +435,13 @@ static inline Int freeze_current_cp(void) {
TR_FZ = freeze_cp->cp_tr;
B = B->cp_b;
HB = B->cp_h;
return (Yap_LocalBase - (ADDR)freeze_cp);
return (LOCAL_LocalBase - (ADDR)freeze_cp);
}
static inline void wake_frozen_cp(Int frozen_offset) {
CACHE_REGS
choiceptr frozen_cp = (choiceptr)(Yap_LocalBase - frozen_offset);
choiceptr frozen_cp = (choiceptr)(LOCAL_LocalBase - frozen_offset);
restore_bindings(TR, frozen_cp->cp_tr);
B = frozen_cp;
@@ -453,7 +453,7 @@ static inline void wake_frozen_cp(Int frozen_offset) {
static inline void abolish_frozen_cps_until(Int frozen_offset) {
CACHE_REGS
choiceptr frozen_cp = (choiceptr)(Yap_LocalBase - frozen_offset);
choiceptr frozen_cp = (choiceptr)(LOCAL_LocalBase - frozen_offset);
B_FZ = frozen_cp;
H_FZ = frozen_cp->cp_h;
@@ -464,9 +464,9 @@ static inline void abolish_frozen_cps_until(Int frozen_offset) {
static inline void abolish_frozen_cps_all(void) {
CACHE_REGS
B_FZ = (choiceptr) Yap_LocalBase;
H_FZ = (CELL *) Yap_GlobalBase;
TR_FZ = (tr_fr_ptr) Yap_TrailBase;
B_FZ = (choiceptr) LOCAL_LocalBase;
H_FZ = (CELL *) LOCAL_GlobalBase;
TR_FZ = (tr_fr_ptr) LOCAL_TrailBase;
return;
}
@@ -500,10 +500,10 @@ static inline 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 (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
if (IN_BETWEEN(LOCAL_TrailBase, ref, LOCAL_TrailTop)) {
/* avoid frozen segments */
unbind_tr = (tr_fr_ptr) ref;
TABLING_ERROR_CHECKING(unbind_variables, unbind_tr > (tr_fr_ptr) Yap_TrailTop);
TABLING_ERROR_CHECKING(unbind_variables, unbind_tr > (tr_fr_ptr) LOCAL_TrailTop);
TABLING_ERROR_CHECKING(unbind_variables, unbind_tr < end_tr);
}
#ifdef MULTI_ASSIGNMENT_VARIABLES
@@ -532,10 +532,10 @@ static inline 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 (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
if (IN_BETWEEN(LOCAL_TrailBase, ref, LOCAL_TrailTop)) {
/* avoid frozen segments */
rebind_tr = (tr_fr_ptr) ref;
TABLING_ERROR_CHECKING(rebind_variables, rebind_tr > (tr_fr_ptr) Yap_TrailTop);
TABLING_ERROR_CHECKING(rebind_variables, rebind_tr > (tr_fr_ptr) LOCAL_TrailTop);
TABLING_ERROR_CHECKING(rebind_variables, rebind_tr < end_tr);
}
#ifdef MULTI_ASSIGNMENT_VARIABLES
@@ -569,10 +569,10 @@ static inline 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 (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
if (IN_BETWEEN(LOCAL_TrailBase, ref, LOCAL_TrailTop)) {
/* avoid frozen segments */
unbind_tr = (tr_fr_ptr) ref;
TABLING_ERROR_CHECKING(restore_variables, unbind_tr > (tr_fr_ptr) Yap_TrailTop);
TABLING_ERROR_CHECKING(restore_variables, unbind_tr > (tr_fr_ptr) LOCAL_TrailTop);
}
#ifdef MULTI_ASSIGNMENT_VARIABLES
} else if (IsApplTerm(ref)) {
@@ -593,10 +593,10 @@ static inline 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 (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
if (IN_BETWEEN(LOCAL_TrailBase, ref, LOCAL_TrailTop)) {
/* avoid frozen segments */
end_tr = (tr_fr_ptr) ref;
TABLING_ERROR_CHECKING(restore_variables, end_tr > (tr_fr_ptr) Yap_TrailTop);
TABLING_ERROR_CHECKING(restore_variables, end_tr > (tr_fr_ptr) LOCAL_TrailTop);
}
}
}
@@ -608,10 +608,10 @@ static inline 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 (IN_BETWEEN(Yap_TrailBase, ref, Yap_TrailTop)) {
if (IN_BETWEEN(LOCAL_TrailBase, ref, LOCAL_TrailTop)) {
/* avoid frozen segments */
rebind_tr = (tr_fr_ptr) ref;
TABLING_ERROR_CHECKING(restore_variables, rebind_tr > (tr_fr_ptr) Yap_TrailTop);
TABLING_ERROR_CHECKING(restore_variables, rebind_tr > (tr_fr_ptr) LOCAL_TrailTop);
TABLING_ERROR_CHECKING(restore_variables, rebind_tr < end_tr);
}
#ifdef MULTI_ASSIGNMENT_VARIABLES
@@ -629,13 +629,13 @@ static inline void restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr) {
static inline CELL *expand_auxiliary_stack(CELL *stack) {
CACHE_REGS
void *old_top = Yap_TrailTop;
void *old_top = LOCAL_TrailTop;
INFORMATION_MESSAGE("Expanding trail in 64 Kbytes");
if (! Yap_growtrail(K64, TRUE)) { /* TRUE means 'contiguous_only' */
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "stack full (STACK_CHECK_EXPAND)");
return NULL;
} else {
UInt diff = (void *)Yap_TrailTop - old_top;
UInt diff = (void *)LOCAL_TrailTop - old_top;
CELL *new_stack = (CELL *)((void *)stack + diff);
memmove((void *)new_stack, (void *)stack, old_top - (void *)stack);
return new_stack;