2011-03-24 10:25:02 +00:00
|
|
|
// 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
|
2011-03-30 15:32:59 +01:00
|
|
|
#if defined(TABLING) || defined(YAPOR_SBA)
|
2011-03-24 10:25:02 +00:00
|
|
|
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
|
|
|
|
|