Christian's patches for OPTYap.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@707 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-11-26 22:19:48 +00:00
parent 8264bfeb9e
commit e216aab2c6
9 changed files with 190 additions and 190 deletions

View File

@ -4,9 +4,9 @@
extern int PageSize;
#define H_BASE ((CELL *) GlobalBase)
#define B_BASE ((choiceptr) LocalBase)
#define TR_BASE ((tr_fr_ptr) TrailBase)
#define H_BASE ((CELL *) Yap_GlobalBase)
#define B_BASE ((choiceptr) Yap_LocalBase)
#define TR_BASE ((tr_fr_ptr) Yap_TrailBase)
#if SIZEOF_INT_P == 4
#define ALIGN 3
@ -36,9 +36,9 @@ extern int PageSize;
#define ALLOC_BLOCK(BLOCK, SIZE) \
BLOCK = (void *) AllocAtomSpace(SIZE)
BLOCK = (void *) Yap_AllocAtomSpace(SIZE)
#define FREE_BLOCK(BLOCK) \
FreeCodeSpace((char *) (BLOCK))
Yap_FreeCodeSpace((char *) (BLOCK))
@ -53,15 +53,15 @@ extern int PageSize;
#ifdef USE_HEAP
#define alloc_memory_block(SIZE) (void *)AllocCodeSpace(SIZE)
#define free_memory_block(BLK) FreeCodeSpace((ADDR)BLK)
#define alloc_memory_block(SIZE) (void *)Yap_AllocCodeSpace(SIZE)
#define free_memory_block(BLK) Yap_FreeCodeSpace((ADDR)BLK)
#define reset_alloc_block_area()
#define ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE) STR = (STR_TYPE *)AllocCodeSpace(sizeof(STR_TYPE))
#define ALLOC_STRUCT(STR, STR_PAGES, STR_TYPE) STR = (STR_TYPE *)Yap_AllocCodeSpace(sizeof(STR_TYPE))
#define ALLOC_NEXT_FREE_STRUCT(STR, STR_PAGES, STR_TYPE) STR = (STR_TYPE *)AllocCodeSpace(sizeof(STR_TYPE))
#define ALLOC_NEXT_FREE_STRUCT(STR, STR_PAGES, STR_TYPE) STR = (STR_TYPE *)Yap_AllocCodeSpace(sizeof(STR_TYPE))
#define FREE_STRUCT(STR, STR_PAGES, STR_TYPE) FreeCodeSpace((ADDR)(STR))
#define FREE_STRUCT(STR, STR_PAGES, STR_TYPE) Yap_FreeCodeSpace((ADDR)(STR))
#else

View File

@ -127,7 +127,7 @@ void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_wo
TrailAuxArea = ADJUST_SIZE(TrailAuxArea * KBYTES);
/* we'll need this later */
_YAP_GlobalBase = mmap_addr + HeapArea;
Yap_GlobalBase = mmap_addr + HeapArea;
/* model dependent */
/* shared memory allocation */
@ -168,14 +168,14 @@ void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_wo
/* just allocate local space for stacks */
if ((private_fd_mapfile = open("/dev/zero", O_RDWR)) < 0)
abort_optyap("open error in function map_memory: %s", strerror(errno));
if (mmap(_YAP_GlobalBase, GlobalLocalArea + TrailAuxArea, PROT_READ|PROT_WRITE,
if (mmap(Yap_GlobalBase, GlobalLocalArea + TrailAuxArea, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, private_fd_mapfile, 0) == (void *) -1)
abort_optyap("mmap error in function map_memory: %s", strerror(errno));
close(private_fd_mapfile);
#else /* ENV_COPY or SBA */
for (i = 0; i < n_workers; i++) {
/* initialize worker vars */
worker_area(i) = _YAP_GlobalBase + i * WorkerArea;
worker_area(i) = Yap_GlobalBase + i * WorkerArea;
worker_offset(i) = worker_area(i) - worker_area(0);
#ifdef SHM_MEMORY_MAPPING_SCHEME
/* mapping worker area */
@ -199,22 +199,22 @@ void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_wo
if ((CELL)binding_array & MBIT) {
abort_optyap("OOPS: binding_array start address %p conflicts with tag %x used in IDB", binding_array, MBIT);
}
sba_offset = binding_array - _YAP_GlobalBase;
sba_offset = binding_array - Yap_GlobalBase;
sba_end = (int)binding_array + sba_size;
#endif /* SBA */
_YAP_TrailBase = _YAP_GlobalBase + GlobalLocalArea;
_YAP_LocalBase = _YAP_TrailBase - CellSize;
Yap_TrailBase = Yap_GlobalBase + GlobalLocalArea;
Yap_LocalBase = Yap_TrailBase - CellSize;
if (TrailAuxArea > 262144) /* 262144 = 256 * 1024 */
TrailTop = TrailBase + TrailAuxArea - 131072; /* 131072 = 262144 / 2 */
Yap_TrailTop = Yap_TrailBase + TrailAuxArea - 131072; /* 131072 = 262144 / 2 */
else
TrailTop = TrailBase + TrailAuxArea / 2;
Yap_TrailTop = Yap_TrailBase + TrailAuxArea / 2;
AuxTop = _YAP_TrailBase + TrailAuxArea - CellSize;
AuxTop = Yap_TrailBase + TrailAuxArea - CellSize;
AuxSp = (CELL *) AuxTop;
_YAP_InitHeap(mmap_addr);
Yap_InitHeap(mmap_addr);
BaseWorkArea = mmap_addr;
}
@ -292,10 +292,10 @@ void remap_memory(void) {
/* setup workers so that they have different areas */
long WorkerArea = worker_offset(1);
_YAP_GlobalBase += worker_id * WorkerArea;
_YAP_TrailBase += worker_id * WorkerArea;
_YAP_LocalBase += worker_id * WorkerArea;
_YAP_TrailTop += worker_id * WorkerArea;
Yap_GlobalBase += worker_id * WorkerArea;
Yap_TrailBase += worker_id * WorkerArea;
Yap_LocalBase += worker_id * WorkerArea;
Yap_TrailTop += worker_id * WorkerArea;
AuxTop += worker_id * WorkerArea;
AuxSp = (CELL *) AuxTop;
#endif /* SBA */
@ -360,7 +360,7 @@ void *alloc_memory_block(int size) {
void free_memory_block(void *block) {
#if USE_HEAP_FOR_ALLOC_MEMORY_BLOCKS
LOCK(Pg_lock(GLOBAL_PAGES_void));
FreeCodeSpace((char *) block);
Yap_FreeCodeSpace((char *) block);
UNLOCK(Pg_lock(GLOBAL_PAGES_void));
#endif /* USE_HEAP_FOR_ALLOC_MEMORY_BLOCKS */
}

View File

@ -68,28 +68,28 @@ static int p_debug_prolog(void);
** Global functions **
** -------------------------- */
void _YAP_init_optyap_preds(void) {
_YAP_InitCPred("$default_sequential", 1, p_default_sequential, SafePredFlag);
void Yap_init_optyap_preds(void) {
Yap_InitCPred("$default_sequential", 1, p_default_sequential, SafePredFlag);
#ifdef YAPOR
_YAP_InitCPred("$yapor_on", 0, yapor_on, SafePredFlag);
_YAP_InitCPred("$start_yapor", 0, start_yapor, SafePredFlag);
_YAP_InitCPred("$sequential", 1, p_sequential, SafePredFlag);
_YAP_InitCPred("execution_mode", 1, p_execution_mode, SafePredFlag);
_YAP_InitCPred("performance", 1, p_performance, SafePredFlag);
_YAP_InitCPred("$parallel_new_answer", 1, p_parallel_new_answer, SafePredFlag);
_YAP_InitCPred("$parallel_yes_answer", 0, p_parallel_yes_answer, SafePredFlag);
Yap_InitCPred("$yapor_on", 0, yapor_on, SafePredFlag);
Yap_InitCPred("$start_yapor", 0, start_yapor, SafePredFlag);
Yap_InitCPred("$sequential", 1, p_sequential, SafePredFlag);
Yap_InitCPred("execution_mode", 1, p_execution_mode, SafePredFlag);
Yap_InitCPred("performance", 1, p_performance, SafePredFlag);
Yap_InitCPred("$parallel_new_answer", 1, p_parallel_new_answer, SafePredFlag);
Yap_InitCPred("$parallel_yes_answer", 0, p_parallel_yes_answer, SafePredFlag);
#endif /* YAPOR */
#ifdef TABLING
_YAP_InitCPred("$do_table", 2, p_table, SafePredFlag);
_YAP_InitCPred("$do_abolish_trie", 2, p_abolish_trie, SafePredFlag);
_YAP_InitCPred("$show_trie", 3, p_show_trie, SafePredFlag);
_YAP_InitCPred("$resume_trie", 2, p_resume_trie, SafePredFlag);
Yap_InitCPred("$do_table", 2, p_table, SafePredFlag);
Yap_InitCPred("$do_abolish_trie", 2, p_abolish_trie, SafePredFlag);
Yap_InitCPred("$show_trie", 3, p_show_trie, SafePredFlag);
Yap_InitCPred("$resume_trie", 2, p_resume_trie, SafePredFlag);
#endif /* TABLING */
#ifdef STATISTICS
_YAP_InitCPred("show_frames", 0, p_show_frames, SafePredFlag);
Yap_InitCPred("show_frames", 0, p_show_frames, SafePredFlag);
#endif /* STATISTICS */
#if defined(YAPOR_ERRORS) || defined(TABLING_ERRORS)
_YAP_InitCPred("debug_prolog", 1, p_debug_prolog, SafePredFlag);
Yap_InitCPred("debug_prolog", 1, p_debug_prolog, SafePredFlag);
#endif /* YAPOR_ERRORS || TABLING_ERRORS */
}
@ -116,9 +116,9 @@ int p_default_sequential(void) {
if (IsVarTerm(t)) {
Term ta;
if (SEQUENTIAL_IS_DEFAULT)
ta = MkAtomTerm(_YAP_LookupAtom("on"));
ta = MkAtomTerm(Yap_LookupAtom("on"));
else
ta = MkAtomTerm(_YAP_LookupAtom("off"));
ta = MkAtomTerm(Yap_LookupAtom("off"));
Bind((CELL *)t, ta);
return(TRUE);
}
@ -147,7 +147,7 @@ realtime current_time(void) {
/* to get time as Yap */
/*
double now, interval;
_YAP_cputime_interval(&now, &interval);
Yap_cputime_interval(&now, &interval);
return ((realtime)now);
*/
struct timeval tempo;
@ -196,7 +196,7 @@ int p_sequential(void) {
if (IsVarTerm(tmod) || !IsAtomTerm(tmod)) {
return(FALSE);
}
mod = LookupModule(tmod);
mod = Yap_LookupModule(tmod);
if (IsAtomTerm(t)) {
at = AtomOfTerm(t);
arity = 0;
@ -222,9 +222,9 @@ int p_execution_mode(void) {
if (IsVarTerm(t)) {
Term ta;
if (PARALLEL_EXECUTION_MODE)
ta = MkAtomTerm(_YAP_LookupAtom("parallel"));
ta = MkAtomTerm(Yap_LookupAtom("parallel"));
else
ta = MkAtomTerm(_YAP_LookupAtom("sequential"));
ta = MkAtomTerm(Yap_LookupAtom("sequential"));
Bind((CELL *)t, ta);
return(TRUE);
}
@ -255,9 +255,9 @@ int p_performance(void) {
if (IsVarTerm(t)) {
Term ta;
if (GLOBAL_performance_mode & PERFORMANCE_ON) {
ta = MkAtomTerm(_YAP_LookupAtom("on"));
ta = MkAtomTerm(Yap_LookupAtom("on"));
} else {
ta = MkAtomTerm(_YAP_LookupAtom("off"));
ta = MkAtomTerm(Yap_LookupAtom("off"));
}
Bind((CELL *)t, ta);
return(TRUE);
@ -325,7 +325,7 @@ int p_parallel_new_answer(void) {
length_answer = 0;
ALLOC_QG_ANSWER_FRAME(actual_answer);
_YAP_plwrite(ARG1, parallel_new_answer_putchar, 4);
Yap_plwrite(ARG1, parallel_new_answer_putchar, 4);
AnsFr_answer(actual_answer)[length_answer] = 0;
AnsFr_next(actual_answer) = NULL;
leftmost_or_fr = CUT_leftmost_or_frame();
@ -468,7 +468,7 @@ int p_table(void) {
if (IsVarTerm(t2) || !IsAtomTerm(t2)) {
return (FALSE);
} else {
mod = LookupModule(t2);
mod = Yap_LookupModule(t2);
}
if (IsAtomTerm(t)) {
Atom at = AtomOfTerm(t);
@ -502,7 +502,7 @@ int p_abolish_trie(void) {
if (IsVarTerm(tmod) || !IsAtomTerm(tmod)) {
return (FALSE);
} else {
mod = LookupModule(tmod);
mod = Yap_LookupModule(tmod);
}
if (IsAtomTerm(t)) {
Atom at = AtomOfTerm(t);
@ -541,7 +541,7 @@ int p_show_trie(void) {
if (IsVarTerm(tmod) || !IsAtomTerm(tmod)) {
return (FALSE);
} else {
mod = LookupModule(tmod);
mod = Yap_LookupModule(tmod);
}
if (IsAtomTerm(t1)) {
at = AtomOfTerm(t1);
@ -557,7 +557,7 @@ int p_show_trie(void) {
t2 = Deref(ARG3);
if (IsVarTerm(t2)) {
Term ta = MkAtomTerm(_YAP_LookupAtom("stdout"));
Term ta = MkAtomTerm(Yap_LookupAtom("stdout"));
Bind((CELL *)t2, ta);
traverse_trie(stderr, TrNode_child(TabEnt_subgoal_trie(pe->TableOfPred)), arity, at, TRUE);
} else if (IsAtomTerm(t2)) {
@ -585,7 +585,7 @@ int p_resume_trie(void) {
if (IsVarTerm(tmod) || !IsAtomTerm(tmod)) {
return (FALSE);
} else {
mod = LookupModule(tmod);
mod = Yap_LookupModule(tmod);
}
t1 = Deref(ARG1);
if (IsAtomTerm(t1)) {

View File

@ -303,7 +303,7 @@ sync_with_p:
#ifdef YAPOR_ERRORS
if ((CELL *)aux_cell < H0)
YAPOR_ERROR_MESSAGE("aux_cell < H0 (q_share_work)");
if ((ADDR)aux_cell > _YAP_LocalBase)
if ((ADDR)aux_cell > Yap_LocalBase)
YAPOR_ERROR_MESSAGE("aux_cell > LocalBase (q_share_work)");
#endif /* YAPOR_ERRORS */
#ifdef TABLING

View File

@ -30,7 +30,7 @@ static inline
Int bind_variable(Term t0, Term t1)
{
tr_fr_ptr TR0 = TR;
if (_YAP_IUnify(t0,t1)) {
if (Yap_IUnify(t0,t1)) {
return(TRUE);
} else {
while(TR != TR0) {
@ -48,7 +48,7 @@ Int unify(Term t0, Term t1)
Int unify(Term t0, Term t1)
{
tr_fr_ptr TR0 = TR;
if (_YAP_IUnify(t0,t1)) {
if (Yap_IUnify(t0,t1)) {
return(TRUE);
} else {
while(TR != TR0) {

View File

@ -91,7 +91,7 @@
x_args++; \
x_args[-1] = x; \
} \
Y = pt_args; \
YENV = pt_args; \
SET_BB(PROTECT_FROZEN_B(B)); \
}
@ -142,14 +142,14 @@
H = HBREG = PROTECT_FROZEN_H(B); \
CPREG = B->cp_cp; \
ENV = B->cp_env; \
/* set_cut(Y, B->cp_b); has no effect */ \
/* set_cut(YENV, B->cp_b); has no effect */ \
PREG = (yamop *) CPREG; \
PREFETCH_OP(PREG); \
/* load answer from table to global stack */ \
init_substitution_pointer(subs_ptr, DEP_FR); \
load_answer_trie(ANSWER, subs_ptr); \
/* procceed */ \
Y = ENV; \
YENV = ENV; \
GONext(); \
}
@ -195,14 +195,14 @@
sg_fr_ptr sg_fr;
CELL *Yaddr;
Yaddr = Y;
Yaddr = YENV;
check_trail();
tab_ent = PREG->u.ld.te;
#ifdef TABLE_LOCK_AT_ENTRY_LEVEL
LOCK(TabEnt_lock(tab_ent));
#endif /* TABLE_LOCK_LEVEL */
sg_node = subgoal_search(tab_ent, PREG->u.ld.s, &Yaddr);
Y = Yaddr;
YENV = Yaddr;
#if defined(TABLE_LOCK_AT_NODE_LEVEL)
LOCK(TrNode_lock(sg_node));
#elif defined(TABLE_LOCK_AT_WRITE_LEVEL)
@ -220,10 +220,10 @@
UNLOCK_TABLE(sg_node);
#endif /* TABLE_LOCK_LEVEL */
LOCAL_top_sg_fr = sg_fr;
store_generator_node(Y, PREG->u.ld.s, COMPLETION, sg_fr);
store_generator_node(YENV, PREG->u.ld.s, COMPLETION, sg_fr);
PREG = NEXTOP(PREG, ld);
PREFETCH_OP(PREG);
allocate_environment(Y);
allocate_environment(YENV);
GONext();
} else {
/* tabled subgoal not new */
@ -248,14 +248,14 @@
/* yes answer --> procceed */
PREG = (yamop *) CPREG;
PREFETCH_OP(PREG);
Y = ENV;
YENV = ENV;
GONext();
} else {
/* answers -> load first answer */
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
PREFETCH_OP(PREG);
*--Y = 0; /* vars_arity */
*--Y = 0; /* heap_arity */
*--YENV = 0; /* vars_arity */
*--YENV = 0; /* heap_arity */
GONext();
}
} else {
@ -265,7 +265,7 @@
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
UNLOCK(SgFr_lock(sg_fr));
find_leader_node(leader_cp, leader_dep_on_stack);
store_consumer_node(Y, sg_fr, leader_cp, leader_dep_on_stack);
store_consumer_node(YENV, sg_fr, leader_cp, leader_dep_on_stack);
#ifdef OPTYAP_ERRORS
if (PARALLEL_EXECUTION_MODE) {
choiceptr aux_cp;
@ -294,14 +294,14 @@
sg_fr_ptr sg_fr;
CELL *Yaddr;
Yaddr = Y;
Yaddr = YENV;
check_trail();
tab_ent = PREG->u.ld.te;
#ifdef TABLE_LOCK_AT_ENTRY_LEVEL
LOCK(TabEnt_lock(tab_ent));
#endif /* TABLE_LOCK_LEVEL */
sg_node = subgoal_search(tab_ent, PREG->u.ld.s, &Yaddr);
Y = Yaddr;
YENV = Yaddr;
#if defined(TABLE_LOCK_AT_NODE_LEVEL)
LOCK(TrNode_lock(sg_node));
#elif defined(TABLE_LOCK_AT_WRITE_LEVEL)
@ -319,10 +319,10 @@
UNLOCK_TABLE(sg_node);
#endif /* TABLE_LOCK_LEVEL */
LOCAL_top_sg_fr = sg_fr;
store_generator_node(Y, PREG->u.ld.s, PREG->u.ld.d, sg_fr);
store_generator_node(YENV, PREG->u.ld.s, PREG->u.ld.d, sg_fr);
PREG = NEXTOP(PREG, ld);
PREFETCH_OP(PREG);
allocate_environment(Y);
allocate_environment(YENV);
GONext();
} else {
/* tabled subgoal not new */
@ -347,14 +347,14 @@
/* yes answer --> procceed */
PREG = (yamop *) CPREG;
PREFETCH_OP(PREG);
Y = ENV;
YENV = ENV;
GONext();
} else {
/* answers -> load first answer */
PREG = (yamop *) TrNode_child(SgFr_answer_trie(sg_fr));
PREFETCH_OP(PREG);
*--Y = 0; /* vars_arity */
*--Y = 0; /* heap_arity */
*--YENV = 0; /* vars_arity */
*--YENV = 0; /* heap_arity */
GONext();
}
} else {
@ -364,7 +364,7 @@
find_dependency_node(sg_fr, leader_cp, leader_dep_on_stack);
UNLOCK(SgFr_lock(sg_fr));
find_leader_node(leader_cp, leader_dep_on_stack);
store_consumer_node(Y, sg_fr, leader_cp, leader_dep_on_stack);
store_consumer_node(YENV, sg_fr, leader_cp, leader_dep_on_stack);
#ifdef OPTYAP_ERRORS
if (PARALLEL_EXECUTION_MODE) {
choiceptr aux_cp;
@ -389,10 +389,10 @@
Op(table_retry_me, ld)
restore_generator_node(B, PREG->u.ld.s, PREG->u.ld.d);
Y = (CELL *) PROTECT_FROZEN_B(B);
set_cut(Y, B->cp_b);
SET_BB(NORM_CP(Y));
allocate_environment(Y);
YENV = (CELL *) PROTECT_FROZEN_B(B);
set_cut(YENV, B->cp_b);
SET_BB(NORM_CP(YENV));
allocate_environment(YENV);
PREG = NEXTOP(PREG,ld);
GONext();
ENDOp();
@ -401,10 +401,10 @@
Op(table_trust_me, ld)
restore_generator_node(B, PREG->u.ld.s, COMPLETION);
Y = (CELL *) PROTECT_FROZEN_B(B);
set_cut(Y, B->cp_b);
SET_BB(NORM_CP(Y));
allocate_environment(Y);
YENV = (CELL *) PROTECT_FROZEN_B(B);
set_cut(YENV, B->cp_b);
SET_BB(NORM_CP(YENV));
allocate_environment(YENV);
PREG = NEXTOP(PREG,ld);
GONext();
ENDOp();
@ -419,7 +419,7 @@
/* possible optimization: when the number of substitution variables **
** is zero, an answer is sufficient to perform an early completion */
gcp = GEN_CP(Y[E_B]);
gcp = GEN_CP(YENV[E_B]);
sg_fr = GEN_CP_SG_FR(gcp);
subs_ptr = (CELL *)(gcp + 1) + PREG->u.s.s;
#ifdef TABLING_ERRORS
@ -501,11 +501,11 @@
}
#ifdef TABLING_BATCHED_SCHEDULING
/* deallocate and procceed */
PREG = (yamop *) Y[E_CP];
PREG = (yamop *) YENV[E_CP];
PREFETCH_OP(PREG);
CPREG = PREG;
SREG = Y;
ENV = Y = (CELL *) Y[E_E];
SREG = YENV;
ENV = YENV = (CELL *) YENV[E_E];
GONext();
#else /* TABLING_LOCAL_SCHEDULING */
/* fail */
@ -611,11 +611,11 @@
UNLOCK(SgFr_lock(sg_fr));
#ifdef TABLING_BATCHED_SCHEDULING
/* deallocate and procceed */
PREG = (yamop *) Y[E_CP];
PREG = (yamop *) YENV[E_CP];
PREFETCH_OP(PREG);
CPREG = PREG;
SREG = Y;
ENV = Y = (CELL *) Y[E_E];
SREG = YENV;
ENV = YENV = (CELL *) YENV[E_E];
GONext();
#else /* TABLING_LOCAL_SCHEDULING */
/* fail */

View File

@ -92,9 +92,9 @@ STD_PROTO(static inline tg_sol_fr_ptr CUT_prune_tg_solution_frames, (tg_sol_fr_p
if ((STACK) <= STACK_TOP+1024) { \
CELL *NEW_STACK; \
UInt diff; \
char *OldTrailTop = (char *)TrailTop; \
_YAP_growtrail(64 * 1024Lf); \
diff = (char *)TrailTop - OldTrailTop; \
char *OldTrailTop = (char *)Yap_TrailTop; \
Yap_growtrail(64 * 1024L); \
diff = (char *)Yap_TrailTop - OldTrailTop; \
NEW_STACK = (CELL *)((char *)(STACK)+diff); \
memmove((void *)NEW_STACK, (void *)(STACK), (char *)OldTrailTop-(char *)STACK); \
(STACK) = NEW_STACK; \
@ -369,7 +369,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 >= TrailBase) {
if ((ADDR)ref >= Yap_TrailBase) {
/* avoid frozen segments */
unbind_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
@ -408,7 +408,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 >= TrailBase) {
if ((ADDR)ref >= Yap_TrailBase) {
/* avoid frozen segments */
rebind_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
@ -451,7 +451,7 @@ 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 >= TrailBase) {
if ((ADDR)ref >= Yap_TrailBase) {
unbind_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
if (unbind_tr > (tr_fr_ptr) TrailTop)
@ -465,7 +465,7 @@ 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 >= TrailBase) {
if ((ADDR)ref >= Yap_TrailBase) {
end_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
if (end_tr > (tr_fr_ptr) TrailTop)
@ -482,7 +482,7 @@ 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 >= TrailBase) {
if ((ADDR)ref >= Yap_TrailBase) {
rebind_tr = (tr_fr_ptr) ref;
#ifdef TABLING_ERRORS
if (rebind_tr > (tr_fr_ptr) TrailTop)

View File

@ -660,11 +660,11 @@ sg_node_ptr subgoal_search(tab_ent_ptr tab_ent, OPREG arity, CELL **Yaddr) {
count_vars = 0;
stack_vars = *Yaddr;
#ifdef YAPOR
stack_terms_top = (CELL *)TrailTop;
stack_terms_top = (CELL *)Yap_TrailTop;
stack_terms_base = stack_terms = AuxSp;
#else
stack_terms_top = (CELL *)TR;
stack_terms_base = stack_terms = (CELL *)TrailTop;
stack_terms_base = stack_terms = (CELL *)Yap_TrailTop;
#endif
current_sg_node = TabEnt_subgoal_trie(tab_ent);
@ -680,7 +680,7 @@ sg_node_ptr subgoal_search(tab_ent_ptr tab_ent, OPREG arity, CELL **Yaddr) {
current_sg_node = subgoal_trie_node_check_insert(tab_ent, current_sg_node, t);
} else {
if (count_vars == MAX_TABLE_VARS)
Error(SYSTEM_ERROR,TermNil,"MAX_TABLE_VARS exceeded in function subgoal_search (%d)", count_vars);
Yap_Error(SYSTEM_ERROR,TermNil,"MAX_TABLE_VARS exceeded in function subgoal_search (%d)", count_vars);
FREE_STACK_PUSH(t, stack_vars);
*((CELL *)t) = GLOBAL_table_var_enumerator(count_vars);
t = MakeTableVarTerm(count_vars);
@ -734,7 +734,7 @@ ans_node_ptr answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
stack_terms_base = stack_terms = stack_vars - MAX_TABLE_VARS;
#else
stack_terms_top = (CELL *)TR;
stack_terms_base = stack_terms = (CELL *)TrailTop;
stack_terms_base = stack_terms = (CELL *)Yap_TrailTop;
#endif
current_ans_node = SgFr_answer_trie(sg_fr);
@ -754,7 +754,7 @@ ans_node_ptr answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
current_ans_node = answer_trie_node_check_insert(sg_fr, current_ans_node, t, _trie_retry_val);
} else {
if (count_vars == MAX_TABLE_VARS)
Error(SYSTEM_ERROR,TermNil,"MAX_TABLE_VARS exceeded in function answer_search (%d)", count_vars);
Yap_Error(SYSTEM_ERROR,TermNil,"MAX_TABLE_VARS exceeded in function answer_search (%d)", count_vars);
FREE_STACK_PUSH(t, stack_vars);
*((CELL *)t) = GLOBAL_table_var_enumerator(count_vars);
t = MakeTableVarTerm(count_vars);
@ -805,7 +805,7 @@ void load_answer_trie(ans_node_ptr ans_node, CELL *subs_ptr) {
stack_vars = stack_terms = AuxSp - MAX_TABLE_VARS;
#else
stack_top = (CELL *)TR;
stack_vars = stack_terms = ((CELL *)TrailTop)-MAX_TABLE_VARS;
stack_vars = stack_terms = ((CELL *)Yap_TrailTop)-MAX_TABLE_VARS;
#endif
/* load the new answer from the answer trie to the stack_terms */
@ -1494,7 +1494,7 @@ update_next_trie_branch:
}
TrNode_or_arg(node) = ltt;
TrNode_instr(node) = _YAP_opcode(TrNode_instr(node));
TrNode_instr(node) = Yap_opcode(TrNode_instr(node));
return ltt;
}
#else
@ -1512,7 +1512,7 @@ int update_answer_trie_branch(ans_node_ptr node) {
ltt = 1;
}
TrNode_or_arg(node) = ltt;
TrNode_instr(node) = _YAP_opcode(TrNode_instr(node));
TrNode_instr(node) = Yap__opcode(TrNode_instr(node));
return ltt;
}
#endif /* TABLING_INNER_CUTS */
@ -1528,7 +1528,7 @@ void update_answer_trie_branch(ans_node_ptr node) {
} else {
TrNode_instr(node) -= 2; /* retry --> trust : try --> do */
}
TrNode_instr(node) = _YAP_opcode(TrNode_instr(node));
TrNode_instr(node) = Yap_opcode(TrNode_instr(node));
return;
}
#endif /* YAPOR */

View File

@ -47,7 +47,7 @@
} else { \
/* procceed */ \
PREG = (yamop *) CPREG; \
Y = ENV; \
YENV = ENV; \
} \
PREFETCH_OP(PREG); \
GONext()
@ -82,12 +82,12 @@
ENV = B->cp_env; \
YAPOR_update_alternative(PREG, (yamop *) AP) \
B->cp_ap = (yamop *) AP; \
Y = (CELL *) PROTECT_FROZEN_B(B); \
SET_BB(NORM_CP(Y))
YENV = (CELL *) PROTECT_FROZEN_B(B); \
SET_BB(NORM_CP(YENV))
#define pop_trie_choice_point() \
Y = (CELL *) PROTECT_FROZEN_B((B+1)); \
YENV = (CELL *) PROTECT_FROZEN_B((B+1)); \
H = PROTECT_FROZEN_H(B); \
CPREG = B->cp_cp; \
TABLING_close_alt(B); \
@ -129,16 +129,16 @@
*((CELL *) var_ptr) = var_ptr; \
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
for (i = 0; i < vars_arity; i++) \
*--Y = *aux_ptr--; \
*--Y = var_ptr; \
*--YENV = *aux_ptr--; \
*--YENV = var_ptr; \
for (i = 0; i < subs_arity; i++) \
*--Y = *aux_ptr--; \
*--Y = subs_arity; \
*--Y = vars_arity + 1; \
*--YENV = *aux_ptr--; \
*--YENV = subs_arity; \
*--YENV = vars_arity + 1; \
aux_ptr--; \
for (i = 1; i < heap_arity; i++) \
*--Y = *--aux_ptr; \
*--Y = heap_arity - 1; \
*--YENV = *--aux_ptr; \
*--YENV = heap_arity - 1; \
next_instruction(--heap_arity || subs_arity, node); \
} else { \
aux_ptr += 2 + subs_arity; \
@ -146,17 +146,17 @@
/* Bind((CELL *) var_ptr, var_ptr); */ \
aux_ptr += vars_arity; \
for (i = 0; i < subs_arity + vars_arity; i++) \
*--Y = *aux_ptr--; \
*--Y = subs_arity - 1; \
*--Y = vars_arity + 1; \
*--Y = 0; \
*--YENV = *aux_ptr--; \
*--YENV = subs_arity - 1; \
*--YENV = vars_arity + 1; \
*--YENV = 0; \
next_instruction(--subs_arity, node); \
}
#define no_cp_trie_val_instr() \
if (heap_arity) { \
Y = ++aux_ptr; \
YENV = ++aux_ptr; \
subs_ptr = aux_ptr + heap_arity + 1 + subs_arity + vars_arity - var_index; \
aux = *aux_ptr; \
subs = *subs_ptr; \
@ -219,8 +219,8 @@
} \
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
for (i = 0; i < heap_arity + subs_arity + vars_arity + 1; i++) \
*--Y = *aux_ptr--; \
*--Y = heap_arity - 1; \
*--YENV = *aux_ptr--; \
*--YENV = heap_arity - 1; \
next_instruction(--heap_arity || subs_arity, node); \
} else { \
aux_ptr += 2 + subs_arity; \
@ -249,19 +249,19 @@
} \
aux_ptr += vars_arity; \
for (i = 0; i < vars_arity; i++) \
*--Y = *aux_ptr--; \
*--YENV = *aux_ptr--; \
for (i = 1; i < subs_arity; i++) \
*--Y = *--aux_ptr; \
*--Y = subs_arity - 1; \
*--Y = vars_arity; \
*--Y = 0; \
*--YENV = *--aux_ptr; \
*--YENV = subs_arity - 1; \
*--YENV = vars_arity; \
*--YENV = 0; \
next_instruction(--subs_arity, node); \
}
#define no_cp_trie_atom_instr() \
if (heap_arity) { \
Y = ++aux_ptr; \
YENV = ++aux_ptr; \
/* *((CELL *) *aux_ptr) = TrNode_entry(node); */ \
Bind_Global((CELL *) *aux_ptr, TrNode_entry(node)); \
*aux_ptr = heap_arity - 1; \
@ -286,20 +286,20 @@
Bind_Global((CELL *) *aux_ptr, TrNode_entry(node)); \
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
for (i = 0; i < heap_arity + subs_arity + vars_arity + 1; i++) \
*--Y = *aux_ptr--; \
*--Y = heap_arity - 1; \
*--YENV = *aux_ptr--; \
*--YENV = heap_arity - 1; \
next_instruction(--heap_arity || subs_arity, node); \
} else { \
aux_ptr += 2 + subs_arity; \
Bind((CELL *) *aux_ptr, TrNode_entry(node)); \
aux_ptr += vars_arity; \
for (i = 0; i < vars_arity; i++) \
*--Y = *aux_ptr--; \
*--YENV = *aux_ptr--; \
for (i = 1; i < subs_arity; i++) \
*--Y = *--aux_ptr; \
*--Y = subs_arity - 1; \
*--Y = vars_arity; \
*--Y = 0; \
*--YENV = *--aux_ptr; \
*--YENV = subs_arity - 1; \
*--YENV = vars_arity; \
*--YENV = 0; \
next_instruction(--subs_arity, node); \
}
@ -313,13 +313,13 @@
*aux_ptr-- = (CELL) (H - 1); \
*aux_ptr-- = (CELL) (H - 2); \
*aux_ptr = heap_arity - 1 + 2; \
Y = aux_ptr; \
YENV = aux_ptr; \
} else { \
H += 2; \
*aux_ptr-- = (CELL) (H - 1); \
*aux_ptr-- = (CELL) (H - 2); \
*aux_ptr = 2; \
Y = aux_ptr; \
YENV = aux_ptr; \
aux_ptr += 2 + 2; \
*aux_ptr = subs_arity - 1; \
aux_ptr += subs_arity; \
@ -339,25 +339,25 @@
Bind_Global((CELL *) *aux_ptr, AbsPair(H)); \
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
for (i = 0; i < vars_arity + subs_arity + heap_arity + 1; i++) \
*--Y = *aux_ptr--; \
*--YENV = *aux_ptr--; \
H += 2; \
*--Y = (CELL) (H - 1); \
*--Y = (CELL) (H - 2); \
*--Y = heap_arity + 1; \
*--YENV = (CELL) (H - 1); \
*--YENV = (CELL) (H - 2); \
*--YENV = heap_arity + 1; \
} else { \
aux_ptr += 2 + subs_arity; \
Bind((CELL *) *aux_ptr, AbsPair(H)); \
aux_ptr += vars_arity; \
for (i = 0; i < vars_arity; i++) \
*--Y = *aux_ptr--; \
*--YENV = *aux_ptr--; \
for (i = 1; i < subs_arity; i++) \
*--Y = *--aux_ptr; \
*--Y = subs_arity - 1; \
*--Y = vars_arity; \
*--YENV = *--aux_ptr; \
*--YENV = subs_arity - 1; \
*--YENV = vars_arity; \
H += 2; \
*--Y = (CELL) (H - 1); \
*--Y = (CELL) (H - 2); \
*--Y = 2; \
*--YENV = (CELL) (H - 1); \
*--YENV = (CELL) (H - 2); \
*--YENV = 2; \
} \
next_trie_instruction(node)
@ -372,14 +372,14 @@
for (i = 1; i <= func_arity; i++) \
*aux_ptr-- = (CELL) (H - i); \
*aux_ptr = heap_arity - 1 + func_arity; \
Y = aux_ptr; \
YENV = aux_ptr; \
} else { \
*H++ = (CELL) func; \
H += func_arity; \
for (i = 1; i <= func_arity; i++) \
*aux_ptr-- = (CELL) (H - i); \
*aux_ptr = func_arity; \
Y = aux_ptr; \
YENV = aux_ptr; \
aux_ptr += func_arity + 2; \
*aux_ptr = subs_arity - 1; \
aux_ptr += subs_arity; \
@ -399,27 +399,27 @@
Bind_Global((CELL *) *aux_ptr, AbsAppl(H)); \
aux_ptr += heap_arity + subs_arity + vars_arity + 1; \
for (i = 0; i < vars_arity + subs_arity + heap_arity + 1; i++) \
*--Y = *aux_ptr--; \
*--YENV = *aux_ptr--; \
*H++ = (CELL) func; \
H += func_arity; \
for (i = 1; i <= func_arity; i++) \
*--Y = (CELL) (H - i); \
*--Y = heap_arity + func_arity - 1; \
*--YENV = (CELL) (H - i); \
*--YENV = heap_arity + func_arity - 1; \
} else { \
aux_ptr += 2 + subs_arity; \
Bind((CELL *) *aux_ptr, AbsAppl(H)); \
aux_ptr += vars_arity; \
for (i = 0; i < vars_arity; i++) \
*--Y = *aux_ptr--; \
*--YENV = *aux_ptr--; \
for (i = 1; i < subs_arity; i++) \
*--Y = *--aux_ptr; \
*--Y = subs_arity - 1; \
*--Y = vars_arity; \
*--YENV = *--aux_ptr; \
*--YENV = subs_arity - 1; \
*--YENV = vars_arity; \
*H++ = (CELL) func; \
H += func_arity; \
for (i = 1; i <= func_arity; i++) \
*--Y = (CELL) (H - i); \
*--Y = func_arity; \
*--YENV = (CELL) (H - i); \
*--YENV = func_arity; \
} \
next_trie_instruction(node)
@ -431,7 +431,7 @@
PBOp(trie_do_var, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y;
register CELL *aux_ptr = YENV;
register CELL var_ptr;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
@ -444,14 +444,14 @@
PBOp(trie_try_var, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y;
register CELL *aux_ptr = YENV;
register CELL var_ptr;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
int subs_arity = *(aux_ptr + heap_arity + 2);
int i;
store_trie_choice_point(Y, TrNode_next(node));
store_trie_choice_point(YENV, TrNode_next(node));
cp_trie_var_instr();
ENDPBOp();
@ -487,7 +487,7 @@
#endif /* YAPOR */
{
pop_trie_choice_point();
if ((choiceptr) Y == B_FZ) {
if ((choiceptr) YENV == B_FZ) {
cp_trie_var_instr();
} else {
no_cp_trie_var_instr();
@ -498,7 +498,7 @@
PBOp(trie_do_val, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y, *subs_ptr;
register CELL *aux_ptr = YENV, *subs_ptr;
register CELL aux, subs;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
@ -512,7 +512,7 @@
PBOp(trie_try_val, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y, *subs_ptr;
register CELL *aux_ptr = YENV, *subs_ptr;
register CELL aux, subs;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
@ -520,7 +520,7 @@
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
int i;
store_trie_choice_point(Y, TrNode_next(node));
store_trie_choice_point(YENV, TrNode_next(node));
cp_trie_val_instr();
ENDPBOp();
@ -558,7 +558,7 @@
#endif /* YAPOR */
{
pop_trie_choice_point();
if ((choiceptr) Y == B_FZ) {
if ((choiceptr) YENV == B_FZ) {
cp_trie_val_instr();
} else {
no_cp_trie_val_instr();
@ -569,7 +569,7 @@
PBOp(trie_do_atom, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y;
register CELL *aux_ptr = YENV;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
int subs_arity = *(aux_ptr + heap_arity + 2);
@ -581,13 +581,13 @@
PBOp(trie_try_atom, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y;
register CELL *aux_ptr = YENV;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
int subs_arity = *(aux_ptr + heap_arity + 2);
int i;
store_trie_choice_point(Y, TrNode_next(node));
store_trie_choice_point(YENV, TrNode_next(node));
cp_trie_atom_instr();
ENDPBOp();
@ -621,7 +621,7 @@
#endif /* YAPOR */
{
pop_trie_choice_point();
if ((choiceptr) Y == B_FZ) {
if ((choiceptr) YENV == B_FZ) {
cp_trie_atom_instr();
} else {
no_cp_trie_atom_instr();
@ -632,7 +632,7 @@
PBOp(trie_do_list, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y;
register CELL *aux_ptr = YENV;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
int subs_arity = *(aux_ptr + heap_arity + 2);
@ -644,13 +644,13 @@
PBOp(trie_try_list, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y;
register CELL *aux_ptr = YENV;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
int subs_arity = *(aux_ptr + heap_arity + 2);
int i;
store_trie_choice_point(Y, TrNode_next(node));
store_trie_choice_point(YENV, TrNode_next(node));
cp_trie_list_instr();
ENDPBOp();
@ -684,7 +684,7 @@
#endif /* YAPOR */
{
pop_trie_choice_point();
if ((choiceptr) Y == B_FZ) {
if ((choiceptr) YENV == B_FZ) {
cp_trie_list_instr();
} else {
no_cp_trie_list_instr();
@ -695,7 +695,7 @@
PBOp(trie_do_struct, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y;
register CELL *aux_ptr = YENV;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
int subs_arity = *(aux_ptr + heap_arity + 2);
@ -709,7 +709,7 @@
PBOp(trie_try_struct, e)
register ans_node_ptr node = (ans_node_ptr) PREG;
register CELL *aux_ptr = Y;
register CELL *aux_ptr = YENV;
int heap_arity = *aux_ptr;
int vars_arity = *(aux_ptr + heap_arity + 1);
int subs_arity = *(aux_ptr + heap_arity + 2);
@ -717,7 +717,7 @@
int func_arity = ArityOfFunctor(func);
int i;
store_trie_choice_point(Y, TrNode_next(node));
store_trie_choice_point(YENV, TrNode_next(node));
cp_trie_struct_instr();
ENDPBOp();
@ -755,7 +755,7 @@
#endif /* YAPOR */
{
pop_trie_choice_point();
if ((choiceptr) Y == B_FZ) {
if ((choiceptr) YENV == B_FZ) {
cp_trie_struct_instr();
} else {
no_cp_trie_struct_instr();