From 0352410666da868b623e34231f5a9313d3fe5348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Thu, 24 Mar 2011 10:25:02 +0000 Subject: [PATCH] support separate file for LOCALS --- H/dlocals.h | 146 ++++++++++++++++++++++++++++++++++++++++++++++ H/hlocals.h | 148 +++++++++++++++++++++++++++++++++++++++++++++++ H/ilocals.h | 146 ++++++++++++++++++++++++++++++++++++++++++++++ H/rlocals.h | 146 ++++++++++++++++++++++++++++++++++++++++++++++ misc/LOCALS | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 750 insertions(+) create mode 100644 H/dlocals.h create mode 100644 H/hlocals.h create mode 100644 H/ilocals.h create mode 100644 H/rlocals.h create mode 100644 misc/LOCALS diff --git a/H/dlocals.h b/H/dlocals.h new file mode 100644 index 000000000..9440b46db --- /dev/null +++ b/H/dlocals.h @@ -0,0 +1,146 @@ + + /* This file, dlocals.h, was generated automatically by "yap -L misc/buildheap" + please do not update, update misc/LOCALS instead */ + + + + +#define Yap_c_input_stream WL->c_input_stream +#define Yap_c_output_stream WL->c_output_stream +#define Yap_c_error_stream WL->c_error_stream + +#define OldASP WL->rinfo.old_ASP +#define OldLCL0 WL->rinfo.old_LCL0 +#define OldTR WL->rinfo.old_TR +#define OldGlobalBase WL->rinfo.old_GlobalBase +#define OldH WL->rinfo.old_H +#define OldH0 WL->rinfo.old_H0 +#define OldTrailBase WL->rinfo.old_TrailBase +#define OldTrailTop WL->rinfo.old_TrailTop +#define OldHeapBase WL->rinfo.old_HeapBase +#define OldHeapTop WL->rinfo.old_HeapTop +#define ClDiff WL->rinfo.cl_diff +#define GDiff WL->rinfo.g_diff +#define HDiff WL->rinfo.h_diff +#define GDiff0 WL->rinfo.g_diff0 +#define GSplit WL->rinfo.g_split +#define LDiff WL->rinfo.l_diff +#define TrDiff WL->rinfo.tr_diff +#define XDiff WL->rinfo.x_diff +#define DelayDiff WL->rinfo.delay_diff +#define BaseDiff WL->rinfo.base_diff +#define ReductionsCounter WL->call_counters.reductions +#define PredEntriesCounter WL->call_counters.reductions_retries +#define RetriesCounter WL->call_counters.retries +#define ReductionsCounterOn WL->call_counters.reductions_on +#define PredEntriesCounterOn WL->call_counters.reductions_retries_on +#define RetriesCounterOn WL->call_counters.retries_on +#define Yap_InterruptsDisabled WL->interrupts_disabled + + +#define ConsultSp WL->consultsp + +#define ConsultCapacity WL->consultcapacity + +#define ConsultBase WL->consultbase + +#define ConsultLow WL->consultlow + +#define GlobalArena WL->global_arena +#define GlobalArenaOverflows WL->global_arena_overflows +#define DelayArenaOverflows WL->delay_arena_overflows +#define ArenaOverflows WL->arena_overflows +#define DepthArenas WL->depth_arenas +#define ArithError WL->arith_error +#define LastAssertedPred WL->last_asserted_pred +#define DebugOn WL->debug_on +#define FormatInfo WL->f_info +#define ScannerStack WL->scanner_stack +#define ScannerExtraBlocks WL->scanner_extra_blocks +#define BallTerm WL->ball_term +#define ActiveSignals WL->active_signals +#define IPredArity WL->i_pred_arity +#define ProfEnd WL->prof_end +#define UncaughtThrow WL->uncaught_throw +#define DoingUndefp WL->doing_undefp +#define StartLine WL->start_line +#define ScratchPad WL->scratchpad +#ifdef COROUTINING +#define WokenGoals WL->woken_goals +#define AttsMutableList WL->atts_mutable_list +#endif + +#define GcGeneration WL->gc_generation +#define GcPhase WL->gc_phase +#define GcCurrentPhase WL->gc_current_phase +#define GcCalls WL->gc_calls +#define TotGcTime WL->tot_gc_time +#define TotGcRecovered WL->tot_gc_recovered +#define LastGcTime WL->last_gc_time +#define LastSSTime WL->last_ss_time +#if LOW_LEVEL_TRACER +#define Yap_total_choicepoints WL->total_cps +#endif + +#if defined(YAPOR) || defined(THREADS) +#define SignalLock WL->signal_lock +#define WPP WL->wpp + +#define total_marked WL->tot_marked +#define total_oldies WL->tot_oldies +#if DEBUG && COROUTINING +#define total_smarked WL->tot_smarked +#endif +#define current_B WL->wl_current_B +#define prev_HB WL->wl_prev_HB +#define HGEN WL->hgen +#define iptop WL->ip_top +#if GC_NO_TAGS +#define Yap_bp WL->b_p +#endif +#if defined(TABLING) || defined(SBA) +#define sTR WL->wl_sTR +#define sTR0 WL->wl_sTR0 +#define new_TR WL->new_tr +#else +#define sTR WL->wl_sTR +#define sTR0 WL->wl_sTR0 +#define new_TR WL->new_tr +#endif +#define cont_top0 WL->conttop0 +#define cont_top WL->conttop +#define discard_trail_entries WL->disc_trail_entries +#define gc_ma_hash_table WL->Gc_ma_hash_table +#define gc_ma_h_top WL->Gc_ma_h_top +#define gc_ma_h_list WL->Gc_ma_h_list +#define gc_timestamp WL->Gc_timestamp +#define db_vec WL->DB_vec +#define db_vec0 WL->DB_vec0 +#define db_root WL->DB_root +#define db_nil WL->DB_nil +#endif /* defined(YAPOR) || defined(THREADS) */ +#define Yap_gc_restore WL->gc_restore +#define DynamicArrays WL->dynamic_arrays +#define StaticArrays WL->static_arrays +#define GlobalVariables WL->global_variables +#define Yap_AllowRestart WL->allow_restart + +#define Yap_CMemFirstBlock WL->cmem_first_block +#define Yap_CMemFirstBlockSz WL->cmem_first_block_sz + +#define Yap_LabelFirstArray WL->label_first_array +#define Yap_LabelFirstArraySz WL->label_first_array_sz + +#define PL_local_data_p WL->Yap_ld_ +#define execution WL->_execution + +#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS) +#define WORKER WL->worker +#endif +#ifdef THREADS +#define ThreadHandle WL->thread_handle +#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle) +#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle) +#endif + + diff --git a/H/hlocals.h b/H/hlocals.h new file mode 100644 index 000000000..9ebc4c711 --- /dev/null +++ b/H/hlocals.h @@ -0,0 +1,148 @@ + + /* This file, hlocals.h, was generated automatically by "yap -L misc/buildheap" + please do not update, update misc/LOCALS instead */ + + +typedef struct worker_local { + + int c_input_stream; + int c_output_stream; + int c_error_stream; + + restoreinfo rinfo; + + + + + + + + + + + + + + + + + + + + + struct reduction_counters call_counters; + + + + + + + int interrupts_disabled; + + + union CONSULT_OBJ* consultsp; + + UInt consultcapacity; + + union CONSULT_OBJ* consultbase; + + union CONSULT_OBJ* consultlow; + + Term global_arena; + UInt global_arena_overflows; + Int delay_arena_overflows; + Int arena_overflows; + Int depth_arenas; + int arith_error; + struct pred_entry* last_asserted_pred; + int debug_on; + struct format_status* f_info; + char* scanner_stack; + struct scanner_extra_alloc* scanner_extra_blocks; + struct DB_TERM *ball_term; + UInt active_signals; + UInt i_pred_arity; + yamop* prof_end; + int uncaught_throw; + int doing_undefp; + Int start_line; + scratch_block scratchpad; +#ifdef COROUTINING + Term woken_goals; + Term atts_mutable_list; +#endif + + Term gc_generation; + Term gc_phase; + UInt gc_current_phase; + UInt gc_calls; + Int tot_gc_time; + YAP_ULONG_LONG tot_gc_recovered; + Int last_gc_time; + Int last_ss_time; +#if LOW_LEVEL_TRACER + Int total_cps; +#endif + +#if defined(YAPOR) || defined(THREADS) + lockvar signal_lock; + struct pred_entry* wpp; + + Int tot_marked; + Int tot_oldies; +#if DEBUG && COROUTINING + UInt tot_smarked; +#endif + struct choicept *wl_current_B; + CELL* wl_prev_HB; + CELL* hgen; + CELL** ip_top; +#if GC_NO_TAGS + char* b_p; +#endif +#if defined(TABLING) || defined(SBA) + struct trail_frame* wl_sTR; + struct trail_frame* wl_sTR0; + struct trail_frame* new_tr; +#else + Term *wl_sTR; + Term *wl_sTR0; + Term *new_tr; +#endif + struct gc_mark_continuation* conttop0; + struct gc_mark_continuation* conttop; + int disc_trail_entries; + gc_ma_hash_entry Gc_ma_hash_table[GC_MAVARS_HASH_SIZE]; + gc_ma_hash_entry* Gc_ma_h_top; + gc_ma_hash_entry* Gc_ma_h_list; + UInt Gc_timestamp; + ADDR DB_vec; + ADDR DB_vec0; + struct RB_red_blk_node* DB_root; + struct RB_red_blk_node* DB_nil; +#endif /* defined(YAPOR) || defined(THREADS) */ + sigjmp_buf gc_restore; + struct array_entry* dynamic_arrays; + struct static_array_entry* static_arrays; + struct global_entry* global_variables; + int allow_restart; + + struct mem_blk* cmem_first_block; + UInt cmem_first_block_sz; + + Int* label_first_array; + UInt label_first_array_sz; + + struct PL_local_data *Yap_ld_; + struct open_query_struct* _execution; + +#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS) + struct worker worker; +#endif +#ifdef THREADS + struct thandle thread_handle; +#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle) +#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle) +#endif + +} w_local; diff --git a/H/ilocals.h b/H/ilocals.h new file mode 100644 index 000000000..c2481740c --- /dev/null +++ b/H/ilocals.h @@ -0,0 +1,146 @@ + + /* This file, ilocals.h, was generated automatically by "yap -L misc/buildheap" + please do not update, update misc/LOCALS instead */ + + +static void InitWorker(int wid) { + + FOREIGN_WL(wid)->c_input_stream = 0; + FOREIGN_WL(wid)->c_output_stream = 1; + FOREIGN_WL(wid)->c_error_stream = 2; + + FOREIGN_WL(wid)->rinfo.old_ASP = NULL; + FOREIGN_WL(wid)->rinfo.old_LCL0 = NULL; + FOREIGN_WL(wid)->rinfo.old_TR = NULL; + FOREIGN_WL(wid)->rinfo.old_GlobalBase = NULL; + FOREIGN_WL(wid)->rinfo.old_H = NULL; + FOREIGN_WL(wid)->rinfo.old_H0 = NULL; + FOREIGN_WL(wid)->rinfo.old_TrailBase = NULL; + FOREIGN_WL(wid)->rinfo.old_TrailTop = NULL; + FOREIGN_WL(wid)->rinfo.old_HeapBase = NULL; + FOREIGN_WL(wid)->rinfo.old_HeapTop = NULL; + FOREIGN_WL(wid)->rinfo.cl_diff = 0L; + FOREIGN_WL(wid)->rinfo.g_diff = 0L; + FOREIGN_WL(wid)->rinfo.h_diff = 0L; + FOREIGN_WL(wid)->rinfo.g_diff0 = 0L; + FOREIGN_WL(wid)->rinfo.g_split = NULL; + FOREIGN_WL(wid)->rinfo.l_diff = 0L; + FOREIGN_WL(wid)->rinfo.tr_diff = 0L; + FOREIGN_WL(wid)->rinfo.x_diff = 0L; + FOREIGN_WL(wid)->rinfo.delay_diff = 0L; + FOREIGN_WL(wid)->rinfo.base_diff = 0L; + FOREIGN_WL(wid)->call_counters.reductions = 0L; + FOREIGN_WL(wid)->call_counters.reductions_retries = 0L; + FOREIGN_WL(wid)->call_counters.retries = 0L; + FOREIGN_WL(wid)->call_counters.reductions_on = 0L; + FOREIGN_WL(wid)->call_counters.reductions_retries_on = 0L; + FOREIGN_WL(wid)->call_counters.retries_on = 0L; + FOREIGN_WL(wid)->interrupts_disabled = FALSE; + + + FOREIGN_WL(wid)->consultsp = NULL; + + + + FOREIGN_WL(wid)->consultbase = NULL; + + FOREIGN_WL(wid)->consultlow = NULL; + + FOREIGN_WL(wid)->global_arena = 0L; + FOREIGN_WL(wid)->global_arena_overflows = 0L; + FOREIGN_WL(wid)->delay_arena_overflows = 0L; + FOREIGN_WL(wid)->arena_overflows = 0L; + FOREIGN_WL(wid)->depth_arenas = 0; + FOREIGN_WL(wid)->arith_error = FALSE; + FOREIGN_WL(wid)->last_asserted_pred = NULL; + FOREIGN_WL(wid)->debug_on = FALSE; + FOREIGN_WL(wid)->f_info = NULL; + FOREIGN_WL(wid)->scanner_stack = NULL; + FOREIGN_WL(wid)->scanner_extra_blocks = NULL; + FOREIGN_WL(wid)->ball_term = NULL; + FOREIGN_WL(wid)->active_signals = 0L; + FOREIGN_WL(wid)->i_pred_arity = 0L; + FOREIGN_WL(wid)->prof_end = NULL; + FOREIGN_WL(wid)->uncaught_throw = FALSE; + FOREIGN_WL(wid)->doing_undefp = FALSE; + FOREIGN_WL(wid)->start_line = 0L; + InitScratchPad(wid); +#ifdef COROUTINING + FOREIGN_WL(wid)->woken_goals = 0L; + FOREIGN_WL(wid)->atts_mutable_list = 0L; +#endif + + FOREIGN_WL(wid)->gc_generation = 0L; + FOREIGN_WL(wid)->gc_phase = 0L; + FOREIGN_WL(wid)->gc_current_phase = 0L; + FOREIGN_WL(wid)->gc_calls = 0L; + FOREIGN_WL(wid)->tot_gc_time = 0L; + FOREIGN_WL(wid)->tot_gc_recovered = 0L; + FOREIGN_WL(wid)->last_gc_time = 0L; + FOREIGN_WL(wid)->last_ss_time = 0L; +#if LOW_LEVEL_TRACER + FOREIGN_WL(wid)->total_cps = 0; +#endif + +#if defined(YAPOR) || defined(THREADS) + INIT_LOCK(FOREIGN_WL(wid)->signal_lock); + FOREIGN_WL(wid)->wpp = NULL; + + FOREIGN_WL(wid)->tot_marked = 0L; + FOREIGN_WL(wid)->tot_oldies = 0L; +#if DEBUG && COROUTINING + FOREIGN_WL(wid)->tot_smarked = 0L; +#endif + FOREIGN_WL(wid)->wl_current_B = NULL; + FOREIGN_WL(wid)->wl_prev_HB = NULL; + FOREIGN_WL(wid)->hgen = NULL; + FOREIGN_WL(wid)->ip_top = NULL; +#if GC_NO_TAGS + FOREIGN_WL(wid)->b_p = NULL; +#endif +#if defined(TABLING) || defined(SBA) + FOREIGN_WL(wid)->wl_sTR = NULL; + FOREIGN_WL(wid)->wl_sTR0 = NULL; + FOREIGN_WL(wid)->new_tr = NULL; +#else + FOREIGN_WL(wid)->wl_sTR = NULL; + FOREIGN_WL(wid)->wl_sTR0 = NULL; + FOREIGN_WL(wid)->new_tr = NULL; +#endif + FOREIGN_WL(wid)->conttop0 = NULL; + FOREIGN_WL(wid)->conttop = NULL; + FOREIGN_WL(wid)->disc_trail_entries = 0; + + FOREIGN_WL(wid)->Gc_ma_h_top = NULL; + FOREIGN_WL(wid)->Gc_ma_h_list = NULL; + FOREIGN_WL(wid)->Gc_timestamp = 0L; + FOREIGN_WL(wid)->DB_vec = NULL; + FOREIGN_WL(wid)->DB_vec0 = NULL; + FOREIGN_WL(wid)->DB_root = NULL; + FOREIGN_WL(wid)->DB_nil = NULL; +#endif /* defined(YAPOR) || defined(THREADS) */ + + FOREIGN_WL(wid)->dynamic_arrays = NULL; + FOREIGN_WL(wid)->static_arrays = NULL; + FOREIGN_WL(wid)->global_variables = NULL; + FOREIGN_WL(wid)->allow_restart = FALSE; + + FOREIGN_WL(wid)->cmem_first_block = NULL; + FOREIGN_WL(wid)->cmem_first_block_sz = 0L; + + FOREIGN_WL(wid)->label_first_array = NULL; + FOREIGN_WL(wid)->label_first_array_sz = 0L; + + FOREIGN_WL(wid)->Yap_ld_ = Yap_InitThreadIO(wid); + FOREIGN_WL(wid)->_execution = NULL; + +#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS) + +#endif +#ifdef THREADS + InitThreadHandle(wid); +#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle) +#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle) +#endif + +} diff --git a/H/rlocals.h b/H/rlocals.h new file mode 100644 index 000000000..2ef9e5720 --- /dev/null +++ b/H/rlocals.h @@ -0,0 +1,146 @@ + + /* This file, rlocals.h, was generated automatically by "yap -L misc/buildheap" + please do not update, update misc/LOCALS instead */ + + +static void RestoreWorker(int wid USES_REGS) { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FOREIGN_WL(wid)->global_arena = TermToGlobalOrAtomAdjust(FOREIGN_WL(wid)->global_arena); + + + + + + + + + + + RestoreBallTerm(wid); + + + + + + + +#ifdef COROUTINING + FOREIGN_WL(wid)->woken_goals = TermToGlobalAdjust(FOREIGN_WL(wid)->woken_goals); + FOREIGN_WL(wid)->atts_mutable_list = TermToGlobalAdjust(FOREIGN_WL(wid)->atts_mutable_list); +#endif + + FOREIGN_WL(wid)->gc_generation = TermToGlobalAdjust(FOREIGN_WL(wid)->gc_generation); + FOREIGN_WL(wid)->gc_phase = TermToGlobalAdjust(FOREIGN_WL(wid)->gc_phase); + + + + + + +#if LOW_LEVEL_TRACER + +#endif + +#if defined(YAPOR) || defined(THREADS) + REINIT_LOCK(FOREIGN_WL(wid)->signal_lock); + + + + +#if DEBUG && COROUTINING + +#endif + + + + +#if GC_NO_TAGS + +#endif +#if defined(TABLING) || defined(SBA) + + + +#else + + + +#endif + + + + + + + + + + + +#endif /* defined(YAPOR) || defined(THREADS) */ + + FOREIGN_WL(wid)->dynamic_arrays = PtoArrayEAdjust(FOREIGN_WL(wid)->dynamic_arrays); + FOREIGN_WL(wid)->static_arrays = PtoArraySAdjust(FOREIGN_WL(wid)->static_arrays); + FOREIGN_WL(wid)->global_variables = PtoGlobalEAdjust(FOREIGN_WL(wid)->global_variables); + + + + + + + + + + + +#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS) + +#endif +#ifdef THREADS + +#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle) +#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle) +#endif + +} diff --git a/misc/LOCALS b/misc/LOCALS new file mode 100644 index 000000000..01464c803 --- /dev/null +++ b/misc/LOCALS @@ -0,0 +1,164 @@ +// Stuff that must be considered local to a thread or worker +START_WORKER_LOCAL + +// Streams +int c_input_stream Yap_c_input_stream =0 +int c_output_stream Yap_c_output_stream =1 +int c_error_stream Yap_c_error_stream =2 + +/* shifts and restore: per local data-structure */ +restoreinfo rinfo +. rinfo.old_ASP OldASP =NULL +. rinfo.old_LCL0 OldLCL0 =NULL +. rinfo.old_TR OldTR =NULL +. rinfo.old_GlobalBase OldGlobalBase =NULL +. rinfo.old_H OldH =NULL +. rinfo.old_H0 OldH0 =NULL +. rinfo.old_TrailBase OldTrailBase =NULL +. rinfo.old_TrailTop OldTrailTop =NULL +. rinfo.old_HeapBase OldHeapBase =NULL +. rinfo.old_HeapTop OldHeapTop =NULL +. rinfo.cl_diff ClDiff =0L +. rinfo.g_diff GDiff =0L +. rinfo.h_diff HDiff =0L +. rinfo.g_diff0 GDiff0 =0L +. rinfo.g_split GSplit =NULL +. rinfo.l_diff LDiff =0L +. rinfo.tr_diff TrDiff =0L +. rinfo.x_diff XDiff =0L +. rinfo.delay_diff DelayDiff =0L +. rinfo.base_diff BaseDiff =0L + +struct reduction_counters call_counters +. call_counters.reductions ReductionsCounter =0L +. call_counters.reductions_retries PredEntriesCounter =0L +. call_counters.retries RetriesCounter =0L +. call_counters.reductions_on ReductionsCounterOn =0L +. call_counters.reductions_retries_on PredEntriesCounterOn =0L +. call_counters.retries_on RetriesCounterOn =0L + +int interrupts_disabled Yap_InterruptsDisabled =FALSE + +// support for consulting files +/* current consult stack */ +union CONSULT_OBJ* consultsp ConsultSp =NULL +/* current maximum number of cells in consult stack */ +UInt consultcapacity ConsultCapacity void +/* top of consult stack */ +union CONSULT_OBJ* consultbase ConsultBase =NULL +/* low-water mark for consult */ +union CONSULT_OBJ* consultlow ConsultLow =NULL + +//global variables +Term global_arena GlobalArena =0L TermToGlobalOrAtomAdjust +UInt global_arena_overflows GlobalArenaOverflows =0L +Int delay_arena_overflows DelayArenaOverflows =0L +Int arena_overflows ArenaOverflows =0L +Int depth_arenas DepthArenas =0 + +int arith_error ArithError =FALSE +struct pred_entry* last_asserted_pred LastAssertedPred =NULL +int debug_on DebugOn =FALSE +struct format_status* f_info FormatInfo =NULL +char* scanner_stack ScannerStack =NULL +struct scanner_extra_alloc* scanner_extra_blocks ScannerExtraBlocks =NULL +struct DB_TERM *ball_term BallTerm =NULL RestoreBallTerm(wid) +UInt active_signals ActiveSignals =0L +UInt i_pred_arity IPredArity =0L +yamop* prof_end ProfEnd =NULL +int uncaught_throw UncaughtThrow =FALSE +int doing_undefp DoingUndefp =FALSE +Int start_line StartLine =0L +scratch_block scratchpad ScratchPad InitScratchPad(wid) +#ifdef COROUTINING +Term woken_goals WokenGoals =0L TermToGlobalAdjust +Term atts_mutable_list AttsMutableList =0L TermToGlobalAdjust +#endif + +// gc_stuff +Term gc_generation GcGeneration =0L TermToGlobalAdjust +Term gc_phase GcPhase =0L TermToGlobalAdjust +UInt gc_current_phase GcCurrentPhase =0L +UInt gc_calls GcCalls =0L +Int tot_gc_time TotGcTime =0L +YAP_ULONG_LONG tot_gc_recovered TotGcRecovered =0L +Int last_gc_time LastGcTime =0L +Int last_ss_time LastSSTime =0L + +#if LOW_LEVEL_TRACER +Int total_cps Yap_total_choicepoints =0 +#endif + +// global variables that cannot be global in a thread/or-p implementation +#if defined(YAPOR) || defined(THREADS) +lockvar signal_lock SignalLock MkLock +struct pred_entry* wpp WPP =NULL +/* in a single gc */ +Int tot_marked total_marked =0L +Int tot_oldies total_oldies =0L +#if DEBUG && COROUTINING +UInt tot_smarked total_smarked =0L +#endif +struct choicept *wl_current_B current_B =NULL +CELL* wl_prev_HB prev_HB =NULL +CELL* hgen HGEN =NULL +CELL** ip_top iptop =NULL +#if GC_NO_TAGS +char* b_p Yap_bp =NULL +#endif +#if defined(TABLING) || defined(SBA) +struct trail_frame* wl_sTR sTR =NULL +struct trail_frame* wl_sTR0 sTR0 =NULL +struct trail_frame* new_tr new_TR =NULL +#else +Term *wl_sTR sTR =NULL +Term *wl_sTR0 sTR0 =NULL +Term *new_tr new_TR =NULL +#endif +struct gc_mark_continuation* conttop0 cont_top0 =NULL +struct gc_mark_continuation* conttop cont_top =NULL +int disc_trail_entries discard_trail_entries =0 +gc_ma_hash_entry Gc_ma_hash_table[GC_MAVARS_HASH_SIZE] gc_ma_hash_table void +gc_ma_hash_entry* Gc_ma_h_top gc_ma_h_top =NULL +gc_ma_hash_entry* Gc_ma_h_list gc_ma_h_list =NULL +UInt Gc_timestamp gc_timestamp =0L +ADDR DB_vec db_vec =NULL +ADDR DB_vec0 db_vec0 =NULL +struct RB_red_blk_node* DB_root db_root =NULL +struct RB_red_blk_node* DB_nil db_nil =NULL +#endif /* defined(YAPOR) || defined(THREADS) */ + + +sigjmp_buf gc_restore Yap_gc_restore void +struct array_entry* dynamic_arrays DynamicArrays =NULL PtoArrayEAdjust +struct static_array_entry* static_arrays StaticArrays =NULL PtoArraySAdjust +struct global_entry* global_variables GlobalVariables =NULL PtoGlobalEAdjust +int allow_restart Yap_AllowRestart =FALSE + +// Thread Local Area for Fast Storage of Intermediate Compiled Code. +struct mem_blk* cmem_first_block Yap_CMemFirstBlock =NULL +UInt cmem_first_block_sz Yap_CMemFirstBlockSz =0L + +// Thread Local Area for Labels. +Int* label_first_array Yap_LabelFirstArray =NULL +UInt label_first_array_sz Yap_LabelFirstArraySz =0L + +// Thread Local Area for SWI-Prolog emulation routines. +struct PL_local_data *Yap_ld_ PL_local_data_p =Yap_InitThreadIO(wid) + +struct open_query_struct* _execution execution =NULL + +// Ricardo's stuff +#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS) +struct worker worker WORKER void +#endif + +#ifdef THREADS +struct thandle thread_handle ThreadHandle InitThreadHandle(wid) +#define FOREIGN_ThreadHandle(wid) (Yap_WLocal[(wid)]->thread_handle) +#define MY_ThreadHandle (Yap_WLocal[worker_id]->thread_handle) +#endif + +// END WORKER LOCAL STUFF +END_WORKER_LOCAL +