From 056ef59d4bfc40c79c0ed8c0f28c8d57732bbfd1 Mon Sep 17 00:00:00 2001 From: Joao Date: Thu, 7 Apr 2011 16:00:26 +0100 Subject: [PATCH] fix tabling. change Yap_timestamp to Yap_ma_timestamp. change Yap_time_stamp to Yap_timestamp. --- OPTYap/opt.init.c | 2 +- OPTYap/opt.mavar.h | 10 ++++----- OPTYap/opt.preds.c | 2 +- OPTYap/opt.structs.h | 49 +---------------------------------------- OPTYap/or.copy_engine.c | 2 +- OPTYap/or.scheduler.c | 2 +- OPTYap/tab.insts.i | 2 +- 7 files changed, 11 insertions(+), 58 deletions(-) diff --git a/OPTYap/opt.init.c b/OPTYap/opt.init.c index aedeba505..6bfdbc290 100644 --- a/OPTYap/opt.init.c +++ b/OPTYap/opt.init.c @@ -34,7 +34,7 @@ #endif /* !TABLING */ #ifdef MULTI_ASSIGNMENT_VARIABLES ma_hash_entry Yap_ma_hash_table[MAVARS_HASH_SIZE]; -UInt Yap_timestamp; /* an unsigned int */ +UInt Yap_ma_timestamp; /* an unsigned int */ ma_h_inner_struct *Yap_ma_h_top; #endif /* MULTI_ASSIGNMENT_VARIABLES */ #endif /* TABLING || !YAPOR_COW */ diff --git a/OPTYap/opt.mavar.h b/OPTYap/opt.mavar.h index 0613590f7..c198f06cf 100644 --- a/OPTYap/opt.mavar.h +++ b/OPTYap/opt.mavar.h @@ -35,7 +35,7 @@ typedef struct { extern ma_hash_entry Yap_ma_hash_table[MAVARS_HASH_SIZE]; -extern UInt Yap_timestamp; /* an unsigned int */ +extern UInt Yap_ma_timestamp; /* an unsigned int */ OPT_MAVAR_STATIC unsigned int Yap_MAVAR_HASH(CELL *); OPT_MAVAR_STATIC struct ma_h_entry *Yap_ALLOC_NEW_MASPACE(void); @@ -66,8 +66,8 @@ Yap_lookup_ma_var(CELL *addr) { unsigned int i = Yap_MAVAR_HASH(addr); struct ma_h_entry *nptr, *optr; - if (Yap_ma_hash_table[i].timestmp != Yap_timestamp) { - Yap_ma_hash_table[i].timestmp = Yap_timestamp; + if (Yap_ma_hash_table[i].timestmp != Yap_ma_timestamp) { + Yap_ma_hash_table[i].timestmp = Yap_ma_timestamp; Yap_ma_hash_table[i].val.addr = addr; Yap_ma_hash_table[i].val.next = NULL; return FALSE; @@ -91,13 +91,13 @@ Yap_lookup_ma_var(CELL *addr) { OPT_MAVAR_STATIC UInt Yap_NEW_MAHASH(ma_h_inner_struct *top) { - UInt time = ++Yap_timestamp; + UInt time = ++Yap_ma_timestamp; if (time == 0) { unsigned int i; /* damn, we overflowed */ for (i = 0; i < MAVARS_HASH_SIZE; i++) Yap_ma_hash_table[i].timestmp = 0; - time = ++Yap_timestamp; + time = ++Yap_ma_timestamp; } Yap_ma_h_top = top; return time; diff --git a/OPTYap/opt.preds.c b/OPTYap/opt.preds.c index 1e490762c..f16652fcb 100644 --- a/OPTYap/opt.preds.c +++ b/OPTYap/opt.preds.c @@ -524,7 +524,7 @@ static Int p_yapor_on( USES_REGS1 ) { static Int p_start_yapor( USES_REGS1 ) { #ifdef TIMESTAMP_CHECK - Yap_time_stamp = 0; + Yap_timestamp = 0; #endif /* TIMESTAMP_CHECK */ Yap_answers = NO_ANSWER; BITMAP_delete(Yap_bm_idle_workers, 0); diff --git a/OPTYap/opt.structs.h b/OPTYap/opt.structs.h index 527b28b41..f45679095 100644 --- a/OPTYap/opt.structs.h +++ b/OPTYap/opt.structs.h @@ -288,55 +288,8 @@ struct optyap_global_data{ #define Yap_table_var_enumerator(index) (Yap_optyap_data.table_var_enumerator[index]) #define Yap_table_var_enumerator_addr(index) (Yap_optyap_data.table_var_enumerator + (index)) #define Yap_table_lock(index) (Yap_optyap_data.table_lock[index]) -#define Yap_time_stamp (Yap_optyap_data.timestamp) - -/* -#define Yap_master_worker (Yap_optyap_data.master_worker) -#define Yap_execution_time (Yap_optyap_data.execution_time) -#define Yap_best_times(time) (Yap_optyap_data.best_execution_times[time]) -#define Yap_number_goals (Yap_optyap_data.number_of_executed_goals) -#define Yap_performance_mode (Yap_optyap_data.performance_mode) -#if THREADS -#define Get_Yap_root_cp() offset_to_cptr(Yap_optyap_data.root_choice_point_offset) -#define Set_Yap_root_cp(bptr) (Yap_optyap_data.root_choice_point_offset = cptr_to_offset(bptr)) -#else -#define Yap_root_cp (Yap_optyap_data.root_choice_point) -#define Get_Yap_root_cp() (Yap_optyap_data.root_choice_point) -#define Set_Yap_root_cp(bptr) (Yap_optyap_data.root_choice_point = (bptr)) -#endif -#define Yap_root_or_fr (Yap_optyap_data.root_or_frame) -#define Yap_bm_present_workers (Yap_optyap_data.present_workers) -#define Yap_bm_idle_workers (Yap_optyap_data.idle_workers) -#define Yap_bm_root_cp_workers (Yap_optyap_data.root_cp_workers) -#define Yap_bm_invisible_workers (Yap_optyap_data.invisible_workers) -#define Yap_bm_requestable_workers (Yap_optyap_data.requestable_workers) -#define Yap_bm_executing_workers (Yap_optyap_data.executing_workers) -#define Yap_bm_finished_workers (Yap_optyap_data.finished_workers) -#define Yap_bm_pruning_workers (Yap_optyap_data.pruning_workers) -#define Yap_locks_bm_idle_workers (Yap_optyap_data.locks.bitmap_idle_workers) -#define Yap_locks_bm_root_cp_workers (Yap_optyap_data.locks.bitmap_root_cp_workers) -#define Yap_locks_bm_invisible_workers (Yap_optyap_data.locks.bitmap_invisible_workers) -#define Yap_locks_bm_requestable_workers (Yap_optyap_data.locks.bitmap_requestable_workers) -#define Yap_locks_bm_executing_workers (Yap_optyap_data.locks.bitmap_executing_workers) -#define Yap_locks_bm_finished_workers (Yap_optyap_data.locks.bitmap_finished_workers) -#define Yap_locks_bm_pruning_workers (Yap_optyap_data.locks.bitmap_pruning_workers) -#define Yap_locks_who_locked_heap (Yap_optyap_data.locks.who_locked_heap) -#define Yap_locks_heap_access (Yap_optyap_data.locks.heap_access) -#define Yap_locks_alloc_block (Yap_optyap_data.locks.alloc_block) -#define Yap_branch(worker, depth) (Yap_optyap_data.branch[worker][depth]) -#define Yap_parallel_execution_mode (Yap_optyap_data.parallel_execution_mode) -#define Yap_answers (Yap_optyap_data.answers) -#define Yap_root_gt (Yap_optyap_data.root_global_trie) -#define Yap_root_tab_ent (Yap_optyap_data.root_table_entry) -#define Yap_first_sg_fr (Yap_optyap_data.first_subgoal_frame) -#define Yap_last_sg_fr (Yap_optyap_data.last_subgoal_frame) -#define Yap_check_sg_fr (Yap_optyap_data.check_subgoal_frame) -#define Yap_root_dep_fr (Yap_optyap_data.root_dependency_frame) -#define Yap_table_var_enumerator(index) (Yap_optyap_data.table_var_enumerator[index]) -#define Yap_table_var_enumerator_addr(index) (Yap_optyap_data.table_var_enumerator + (index)) -#define Yap_table_lock(index) (Yap_optyap_data.table_lock[index]) #define Yap_timestamp (Yap_optyap_data.timestamp) -*/ + /*********************************** diff --git a/OPTYap/or.copy_engine.c b/OPTYap/or.copy_engine.c index 7bb8d3239..fb5045a8a 100644 --- a/OPTYap/or.copy_engine.c +++ b/OPTYap/or.copy_engine.c @@ -321,6 +321,7 @@ sync_with_p: if (IN_BETWEEN(Yap_TrailBase, aux_cell, Yap_TrailTop)) { /* avoid frozen segments */ aux_tr = (tr_fr_ptr) aux_cell; + } #endif /* TABLING */ #ifdef MULTI_ASSIGNMENT_VARIABLES } else if (IsApplTerm(aux_cell)) { @@ -354,7 +355,6 @@ sync_with_p: #endif /* TABLING */ return TRUE; } -} /* ------------------------- ** diff --git a/OPTYap/or.scheduler.c b/OPTYap/or.scheduler.c index 68500f377..8931bb8e6 100644 --- a/OPTYap/or.scheduler.c +++ b/OPTYap/or.scheduler.c @@ -347,7 +347,7 @@ int move_up_one_node(or_fr_ptr nearest_livenode) { if (OrFr_suspensions(LOCAL_top_or_fr)) { susp_fr_ptr resume_fr; #ifdef TIMESTAMP_CHECK - resume_fr = suspension_frame_to_resume(LOCAL_top_or_fr, ++Yap_time_stamp); + resume_fr = suspension_frame_to_resume(LOCAL_top_or_fr, ++Yap_timestamp); #else resume_fr = suspension_frame_to_resume(LOCAL_top_or_fr); #endif /* TIMESTAMP_CHECK */ diff --git a/OPTYap/tab.insts.i b/OPTYap/tab.insts.i index 99fa62844..2f2226309 100644 --- a/OPTYap/tab.insts.i +++ b/OPTYap/tab.insts.i @@ -1381,7 +1381,7 @@ if (SCH_top_shared_cp(B)) { #ifdef TIMESTAMP_CHECK - timestamp = ++Yap_time_stamp; + timestamp = ++Yap_timestamp; #endif /* TIMESTAMP_CHECK */ entry_owners = OrFr_owners(LOCAL_top_or_fr); }