LOCALS and GLOBALS are now generated by misc/buildlocalglobal.

This commit is contained in:
Joao 2011-05-11 18:22:58 +01:00
parent d6fc76faf1
commit ab63cd190b
17 changed files with 1051 additions and 714 deletions

View File

@ -88,16 +88,12 @@ void init_yapor_workers(void);
ADDR Yap_HeapBase;
struct restore_info rinfo[MAX_THREADS];
struct thread_globs Yap_thread_gl[MAX_THREADS];
pthread_t Yap_master_thread;
#else
struct restore_info rinfo;
ADDR Yap_HeapBase,
Yap_LocalBase,
Yap_GlobalBase,

View File

@ -81,15 +81,6 @@ typedef struct atom_hash_entry {
Atom Entry;
} AtomHashEntry;
typedef struct reduction_counters {
YAP_ULONG_LONG reductions;
YAP_ULONG_LONG reductions_retries;
YAP_ULONG_LONG retries;
int reductions_on;
int reductions_retries_on;
int retries_on;
} red_counters;
typedef struct scratch_block_struct {
char *ptr;
UInt sz, msz;
@ -101,29 +92,6 @@ typedef struct record_list {
struct record_list *next_rec, *prev_rec;
} DBRecordList;
typedef struct restore_info {
Int base_diff;
Int cl_diff;
Int g_diff;
Int g_diff0;
Int h_diff;
Int l_diff;
Int tr_diff;
Int x_diff;
Int delay_diff;
CELL *old_ASP;
CELL *old_LCL0;
CELL *g_split;
tr_fr_ptr old_TR;
CELL *old_GlobalBase;
CELL *old_H;
CELL *old_H0;
ADDR old_TrailBase;
ADDR old_TrailTop;
ADDR old_HeapBase;
ADDR old_HeapTop;
} restoreinfo;
/* SWI Emulation */
#define SWI_BUF_SIZE 512
#define SWI_TMP_BUF_SIZE 2*SWI_BUF_SIZE

View File

@ -1,5 +1,5 @@
/* This file, dglobals.h, was generated automatically by "yap -L misc/buildheap"
/* This file, dglobals.h, was generated automatically by "yap -L misc/buildlocalglobal"
please do not update, update misc/GLOBALS instead */
@ -20,40 +20,36 @@
#define GLOBAL_Initialised Yap_global->Initialised_
#define GLOBAL_InitialisedFromPL Yap_global->InitialisedFromPL_
#define GLOBAL_PL_Argc Yap_global->PL_Argc_
#define GLOBAL_PL_Argv Yap_global->PL_Argv_
#define GLOBAL_Initialised Yap_global->initialised
#define GLOBAL_InitialisedFromPL Yap_global->initialised_from_pl
#define GLOBAL_PL_Argc Yap_global->pl_argc
#define GLOBAL_PL_Argv Yap_global->pl_argv
#define GLOBAL_HaltHooks Yap_global->HaltHooks_
#define GLOBAL_HaltHooks Yap_global->yap_halt_hook
#define GLOBAL_AllowLocalExpansion Yap_global->AllowLocalExpansion_
#define GLOBAL_AllowGlobalExpansion Yap_global->AllowGlobalExpansion_
#define GLOBAL_AllowTrailExpansion Yap_global->AllowTrailExpansion_
#define GLOBAL_SizeOfOverflow Yap_global->SizeOfOverflow_
#define GLOBAL_AllowLocalExpansion Yap_global->allow_local_expansion
#define GLOBAL_AllowGlobalExpansion Yap_global->allow_global_expansion
#define GLOBAL_AllowTrailExpansion Yap_global->allow_trail_expansion
#define GLOBAL_SizeOfOverflow Yap_global->size_of_overflow
#define GLOBAL_AGcThreshold Yap_global->agc_threshold
#define GLOBAL_AGCHook Yap_global->agc_hook
#define GLOBAL_AGcThreshold Yap_global->AGcThreshold_
#define GLOBAL_AGCHook Yap_global->AGCHook_
#if THREADS
#define GLOBAL_NOfThreads Yap_global->n_of_threads
#define GLOBAL_NOfThreads Yap_global->NOfThreads_
#define GLOBAL_NOfThreadsCreated Yap_global->n_of_threads_created
#define GLOBAL_NOfThreadsCreated Yap_global->NOfThreadsCreated_
#define GLOBAL_ThreadsTotalTime Yap_global->threads_total_time
#define GLOBAL_ThreadsTotalTime Yap_global->ThreadsTotalTime_
#define GLOBAL_ThreadHandlesLock Yap_global->ThreadHandlesLock_
#endif
#if defined(YAPOR) || defined(THREADS)
#define GLOBAL_BGL Yap_global->bgl
#define GLOBAL_BGL Yap_global->BGL_
#endif
#ifdef THREADS
#define GLOBAL_ThreadHandlesLock Yap_global->thread_handles_lock
#endif
#if defined(YAPOR) || defined(TABLING)
#define Yap_optyap_data Yap_global->optyap_data
#define GLOBAL_optyap_data Yap_global->optyap_data_
#endif /* YAPOR || TABLING */

View File

@ -1,140 +1,229 @@
/* This file, dlocals.h, was generated automatically by "yap -L misc/buildheap"
/* This file, dlocals.h, was generated automatically by "yap -L misc/buildlocalglobal"
please do not update, update misc/LOCALS instead */
#define LOCAL_c_input_stream LOCAL->c_input_stream
#define LOCAL_c_output_stream LOCAL->c_output_stream
#define LOCAL_c_error_stream LOCAL->c_error_stream
#define LOCAL_c_input_stream LOCAL->c_input_stream_
#define REMOTE_c_input_stream(wid) REMOTE(wid)->c_input_stream_
#define LOCAL_c_output_stream LOCAL->c_output_stream_
#define REMOTE_c_output_stream(wid) REMOTE(wid)->c_output_stream_
#define LOCAL_c_error_stream LOCAL->c_error_stream_
#define REMOTE_c_error_stream(wid) REMOTE(wid)->c_error_stream_
#define LOCAL_OldASP LOCAL->rinfo.old_ASP
#define LOCAL_OldLCL0 LOCAL->rinfo.old_LCL0
#define LOCAL_OldTR LOCAL->rinfo.old_TR
#define LOCAL_OldGlobalBase LOCAL->rinfo.old_GlobalBase
#define LOCAL_OldH LOCAL->rinfo.old_H
#define LOCAL_OldH0 LOCAL->rinfo.old_H0
#define LOCAL_OldTrailBase LOCAL->rinfo.old_TrailBase
#define LOCAL_OldTrailTop LOCAL->rinfo.old_TrailTop
#define LOCAL_OldHeapBase LOCAL->rinfo.old_HeapBase
#define LOCAL_OldHeapTop LOCAL->rinfo.old_HeapTop
#define LOCAL_ClDiff LOCAL->rinfo.cl_diff
#define LOCAL_GDiff LOCAL->rinfo.g_diff
#define LOCAL_HDiff LOCAL->rinfo.h_diff
#define LOCAL_GDiff0 LOCAL->rinfo.g_diff0
#define LOCAL_GSplit LOCAL->rinfo.g_split
#define LOCAL_LDiff LOCAL->rinfo.l_diff
#define LOCAL_TrDiff LOCAL->rinfo.tr_diff
#define LOCAL_XDiff LOCAL->rinfo.x_diff
#define LOCAL_DelayDiff LOCAL->rinfo.delay_diff
#define LOCAL_BaseDiff LOCAL->rinfo.base_diff
#define LOCAL_ReductionsCounter LOCAL->call_counters.reductions
#define LOCAL_PredEntriesCounter LOCAL->call_counters.reductions_retries
#define LOCAL_RetriesCounter LOCAL->call_counters.retries
#define LOCAL_ReductionsCounterOn LOCAL->call_counters.reductions_on
#define LOCAL_PredEntriesCounterOn LOCAL->call_counters.reductions_retries_on
#define LOCAL_RetriesCounterOn LOCAL->call_counters.retries_on
#define LOCAL_InterruptsDisabled LOCAL->interrupts_disabled
#define LOCAL_OldASP LOCAL->OldASP_
#define REMOTE_OldASP(wid) REMOTE(wid)->OldASP_
#define LOCAL_OldLCL0 LOCAL->OldLCL0_
#define REMOTE_OldLCL0(wid) REMOTE(wid)->OldLCL0_
#define LOCAL_OldTR LOCAL->OldTR_
#define REMOTE_OldTR(wid) REMOTE(wid)->OldTR_
#define LOCAL_OldGlobalBase LOCAL->OldGlobalBase_
#define REMOTE_OldGlobalBase(wid) REMOTE(wid)->OldGlobalBase_
#define LOCAL_OldH LOCAL->OldH_
#define REMOTE_OldH(wid) REMOTE(wid)->OldH_
#define LOCAL_OldH0 LOCAL->OldH0_
#define REMOTE_OldH0(wid) REMOTE(wid)->OldH0_
#define LOCAL_OldTrailBase LOCAL->OldTrailBase_
#define REMOTE_OldTrailBase(wid) REMOTE(wid)->OldTrailBase_
#define LOCAL_OldTrailTop LOCAL->OldTrailTop_
#define REMOTE_OldTrailTop(wid) REMOTE(wid)->OldTrailTop_
#define LOCAL_OldHeapBase LOCAL->OldHeapBase_
#define REMOTE_OldHeapBase(wid) REMOTE(wid)->OldHeapBase_
#define LOCAL_OldHeapTop LOCAL->OldHeapTop_
#define REMOTE_OldHeapTop(wid) REMOTE(wid)->OldHeapTop_
#define LOCAL_ClDiff LOCAL->ClDiff_
#define REMOTE_ClDiff(wid) REMOTE(wid)->ClDiff_
#define LOCAL_GDiff LOCAL->GDiff_
#define REMOTE_GDiff(wid) REMOTE(wid)->GDiff_
#define LOCAL_HDiff LOCAL->HDiff_
#define REMOTE_HDiff(wid) REMOTE(wid)->HDiff_
#define LOCAL_GDiff0 LOCAL->GDiff0_
#define REMOTE_GDiff0(wid) REMOTE(wid)->GDiff0_
#define LOCAL_GSplit LOCAL->GSplit_
#define REMOTE_GSplit(wid) REMOTE(wid)->GSplit_
#define LOCAL_LDiff LOCAL->LDiff_
#define REMOTE_LDiff(wid) REMOTE(wid)->LDiff_
#define LOCAL_TrDiff LOCAL->TrDiff_
#define REMOTE_TrDiff(wid) REMOTE(wid)->TrDiff_
#define LOCAL_XDiff LOCAL->XDiff_
#define REMOTE_XDiff(wid) REMOTE(wid)->XDiff_
#define LOCAL_DelayDiff LOCAL->DelayDiff_
#define REMOTE_DelayDiff(wid) REMOTE(wid)->DelayDiff_
#define LOCAL_BaseDiff LOCAL->BaseDiff_
#define REMOTE_BaseDiff(wid) REMOTE(wid)->BaseDiff_
#define LOCAL_ReductionsCounter LOCAL->ReductionsCounter_
#define REMOTE_ReductionsCounter(wid) REMOTE(wid)->ReductionsCounter_
#define LOCAL_PredEntriesCounter LOCAL->PredEntriesCounter_
#define REMOTE_PredEntriesCounter(wid) REMOTE(wid)->PredEntriesCounter_
#define LOCAL_RetriesCounter LOCAL->RetriesCounter_
#define REMOTE_RetriesCounter(wid) REMOTE(wid)->RetriesCounter_
#define LOCAL_ReductionsCounterOn LOCAL->ReductionsCounterOn_
#define REMOTE_ReductionsCounterOn(wid) REMOTE(wid)->ReductionsCounterOn_
#define LOCAL_PredEntriesCounterOn LOCAL->PredEntriesCounterOn_
#define REMOTE_PredEntriesCounterOn(wid) REMOTE(wid)->PredEntriesCounterOn_
#define LOCAL_RetriesCounterOn LOCAL->RetriesCounterOn_
#define REMOTE_RetriesCounterOn(wid) REMOTE(wid)->RetriesCounterOn_
#define LOCAL_ConsultSp LOCAL->consultsp
#define LOCAL_ConsultSp LOCAL->ConsultSp_
#define REMOTE_ConsultSp(wid) REMOTE(wid)->ConsultSp_
#define LOCAL_ConsultCapacity LOCAL->consultcapacity
#define LOCAL_ConsultCapacity LOCAL->ConsultCapacity_
#define REMOTE_ConsultCapacity(wid) REMOTE(wid)->ConsultCapacity_
#define LOCAL_ConsultBase LOCAL->consultbase
#define LOCAL_ConsultBase LOCAL->ConsultBase_
#define REMOTE_ConsultBase(wid) REMOTE(wid)->ConsultBase_
#define LOCAL_ConsultLow LOCAL->consultlow
#define LOCAL_ConsultLow LOCAL->ConsultLow_
#define REMOTE_ConsultLow(wid) REMOTE(wid)->ConsultLow_
#define LOCAL_GlobalArena LOCAL->global_arena
#define LOCAL_GlobalArenaOverflows LOCAL->global_arena_overflows
#define LOCAL_ArenaOverflows LOCAL->arena_overflows
#define LOCAL_DepthArenas LOCAL->depth_arenas
#define LOCAL_ArithError LOCAL->arith_error
#define LOCAL_LastAssertedPred LOCAL->last_asserted_pred
#define LOCAL_DebugOn LOCAL->debug_on
#define LOCAL_ScannerStack LOCAL->scanner_stack
#define LOCAL_ScannerExtraBlocks LOCAL->scanner_extra_blocks
#define LOCAL_BallTerm LOCAL->ball_term
#define LOCAL_ActiveSignals LOCAL->active_signals
#define LOCAL_IPredArity LOCAL->i_pred_arity
#define LOCAL_ProfEnd LOCAL->prof_end
#define LOCAL_UncaughtThrow LOCAL->uncaught_throw
#define LOCAL_DoingUndefp LOCAL->doing_undefp
#define LOCAL_StartLine LOCAL->start_line
#define LOCAL_ScratchPad LOCAL->scratchpad
#define LOCAL_GlobalArena LOCAL->GlobalArena_
#define REMOTE_GlobalArena(wid) REMOTE(wid)->GlobalArena_
#define LOCAL_GlobalArenaOverflows LOCAL->GlobalArenaOverflows_
#define REMOTE_GlobalArenaOverflows(wid) REMOTE(wid)->GlobalArenaOverflows_
#define LOCAL_ArenaOverflows LOCAL->ArenaOverflows_
#define REMOTE_ArenaOverflows(wid) REMOTE(wid)->ArenaOverflows_
#define LOCAL_DepthArenas LOCAL->DepthArenas_
#define REMOTE_DepthArenas(wid) REMOTE(wid)->DepthArenas_
#define LOCAL_ArithError LOCAL->ArithError_
#define REMOTE_ArithError(wid) REMOTE(wid)->ArithError_
#define LOCAL_LastAssertedPred LOCAL->LastAssertedPred_
#define REMOTE_LastAssertedPred(wid) REMOTE(wid)->LastAssertedPred_
#define LOCAL_DebugOn LOCAL->DebugOn_
#define REMOTE_DebugOn(wid) REMOTE(wid)->DebugOn_
#define LOCAL_ScannerStack LOCAL->ScannerStack_
#define REMOTE_ScannerStack(wid) REMOTE(wid)->ScannerStack_
#define LOCAL_ScannerExtraBlocks LOCAL->ScannerExtraBlocks_
#define REMOTE_ScannerExtraBlocks(wid) REMOTE(wid)->ScannerExtraBlocks_
#define LOCAL_BallTerm LOCAL->BallTerm_
#define REMOTE_BallTerm(wid) REMOTE(wid)->BallTerm_
#define LOCAL_ActiveSignals LOCAL->ActiveSignals_
#define REMOTE_ActiveSignals(wid) REMOTE(wid)->ActiveSignals_
#define LOCAL_IPredArity LOCAL->IPredArity_
#define REMOTE_IPredArity(wid) REMOTE(wid)->IPredArity_
#define LOCAL_ProfEnd LOCAL->ProfEnd_
#define REMOTE_ProfEnd(wid) REMOTE(wid)->ProfEnd_
#define LOCAL_UncaughtThrow LOCAL->UncaughtThrow_
#define REMOTE_UncaughtThrow(wid) REMOTE(wid)->UncaughtThrow_
#define LOCAL_DoingUndefp LOCAL->DoingUndefp_
#define REMOTE_DoingUndefp(wid) REMOTE(wid)->DoingUndefp_
#define LOCAL_StartLine LOCAL->StartLine_
#define REMOTE_StartLine(wid) REMOTE(wid)->StartLine_
#define LOCAL_ScratchPad LOCAL->ScratchPad_
#define REMOTE_ScratchPad(wid) REMOTE(wid)->ScratchPad_
#ifdef COROUTINING
#define LOCAL_WokenGoals LOCAL->woken_goals
#define LOCAL_AttsMutableList LOCAL->atts_mutable_list
#define LOCAL_WokenGoals LOCAL->WokenGoals_
#define REMOTE_WokenGoals(wid) REMOTE(wid)->WokenGoals_
#define LOCAL_AttsMutableList LOCAL->AttsMutableList_
#define REMOTE_AttsMutableList(wid) REMOTE(wid)->AttsMutableList_
#endif
#define LOCAL_GcGeneration LOCAL->gc_generation
#define LOCAL_GcPhase LOCAL->gc_phase
#define LOCAL_GcCurrentPhase LOCAL->gc_current_phase
#define LOCAL_GcCalls LOCAL->gc_calls
#define LOCAL_TotGcTime LOCAL->tot_gc_time
#define LOCAL_TotGcRecovered LOCAL->tot_gc_recovered
#define LOCAL_LastGcTime LOCAL->last_gc_time
#define LOCAL_LastSSTime LOCAL->last_ss_time
#if LOW_LEVEL_TRACER
#define LOCAL_total_choicepoints LOCAL->total_cps
#endif
#define LOCAL_consult_level LOCAL->consult_level_
#if defined(YAPOR) || defined(THREADS)
#define LOCAL_SignalLock LOCAL->signal_lock
#endif
#define LOCAL_total_marked LOCAL->tot_marked
#define LOCAL_total_oldies LOCAL->tot_oldies
#define LOCAL_current_B LOCAL->wl_current_B
#define LOCAL_prev_HB LOCAL->wl_prev_HB
#define LOCAL_HGEN LOCAL->hgen
#define LOCAL_iptop LOCAL->ip_top
#define LOCAL_GcGeneration LOCAL->GcGeneration_
#define REMOTE_GcGeneration(wid) REMOTE(wid)->GcGeneration_
#define LOCAL_GcPhase LOCAL->GcPhase_
#define REMOTE_GcPhase(wid) REMOTE(wid)->GcPhase_
#define LOCAL_GcCurrentPhase LOCAL->GcCurrentPhase_
#define REMOTE_GcCurrentPhase(wid) REMOTE(wid)->GcCurrentPhase_
#define LOCAL_GcCalls LOCAL->GcCalls_
#define REMOTE_GcCalls(wid) REMOTE(wid)->GcCalls_
#define LOCAL_TotGcTime LOCAL->TotGcTime_
#define REMOTE_TotGcTime(wid) REMOTE(wid)->TotGcTime_
#define LOCAL_TotGcRecovered LOCAL->TotGcRecovered_
#define REMOTE_TotGcRecovered(wid) REMOTE(wid)->TotGcRecovered_
#define LOCAL_LastGcTime LOCAL->LastGcTime_
#define REMOTE_LastGcTime(wid) REMOTE(wid)->LastGcTime_
#define LOCAL_LastSSTime LOCAL->LastSSTime_
#define REMOTE_LastSSTime(wid) REMOTE(wid)->LastSSTime_
#define LOCAL_total_marked LOCAL->total_marked_
#define REMOTE_total_marked(wid) REMOTE(wid)->total_marked_
#define LOCAL_total_oldies LOCAL->total_oldies_
#define REMOTE_total_oldies(wid) REMOTE(wid)->total_oldies_
#define LOCAL_current_B LOCAL->current_B_
#define REMOTE_current_B(wid) REMOTE(wid)->current_B_
#define LOCAL_prev_HB LOCAL->prev_HB_
#define REMOTE_prev_HB(wid) REMOTE(wid)->prev_HB_
#define LOCAL_HGEN LOCAL->HGEN_
#define REMOTE_HGEN(wid) REMOTE(wid)->HGEN_
#define LOCAL_iptop LOCAL->iptop_
#define REMOTE_iptop(wid) REMOTE(wid)->iptop_
#if defined(GC_NO_TAGS)
#define LOCAL_bp LOCAL->b_p
#define LOCAL_bp LOCAL->bp_
#define REMOTE_bp(wid) REMOTE(wid)->bp_
#endif
#define LOCAL_sTR LOCAL->wl_sTR
#define LOCAL_sTR0 LOCAL->wl_sTR0
#define LOCAL_new_TR LOCAL->new_tr
#define LOCAL_cont_top0 LOCAL->conttop0
#define LOCAL_cont_top LOCAL->conttop
#define LOCAL_discard_trail_entries LOCAL->disc_trail_entries
#define LOCAL_gc_ma_hash_table LOCAL->Gc_ma_hash_table
#define LOCAL_gc_ma_h_top LOCAL->Gc_ma_h_top
#define LOCAL_gc_ma_h_list LOCAL->Gc_ma_h_list
#define LOCAL_gc_timestamp LOCAL->Gc_timestamp
#define LOCAL_db_vec LOCAL->DB_vec
#define LOCAL_db_vec0 LOCAL->DB_vec0
#define LOCAL_db_root LOCAL->DB_root
#define LOCAL_db_nil LOCAL->DB_nil
#define LOCAL_gc_restore LOCAL->gc_restore
#define LOCAL_DynamicArrays LOCAL->dynamic_arrays
#define LOCAL_StaticArrays LOCAL->static_arrays
#define LOCAL_GlobalVariables LOCAL->global_variables
#define LOCAL_AllowRestart LOCAL->allow_restart
#define LOCAL_sTR LOCAL->sTR_
#define REMOTE_sTR(wid) REMOTE(wid)->sTR_
#define LOCAL_sTR0 LOCAL->sTR0_
#define REMOTE_sTR0(wid) REMOTE(wid)->sTR0_
#define LOCAL_new_TR LOCAL->new_TR_
#define REMOTE_new_TR(wid) REMOTE(wid)->new_TR_
#define LOCAL_cont_top0 LOCAL->cont_top0_
#define REMOTE_cont_top0(wid) REMOTE(wid)->cont_top0_
#define LOCAL_cont_top LOCAL->cont_top_
#define REMOTE_cont_top(wid) REMOTE(wid)->cont_top_
#define LOCAL_discard_trail_entries LOCAL->discard_trail_entries_
#define REMOTE_discard_trail_entries(wid) REMOTE(wid)->discard_trail_entries_
#define LOCAL_gc_ma_hash_table LOCAL->gc_ma_hash_table_
#define REMOTE_gc_ma_hash_table(wid) REMOTE(wid)->gc_ma_hash_table_
#define LOCAL_gc_ma_h_top LOCAL->gc_ma_h_top_
#define REMOTE_gc_ma_h_top(wid) REMOTE(wid)->gc_ma_h_top_
#define LOCAL_gc_ma_h_list LOCAL->gc_ma_h_list_
#define REMOTE_gc_ma_h_list(wid) REMOTE(wid)->gc_ma_h_list_
#define LOCAL_gc_timestamp LOCAL->gc_timestamp_
#define REMOTE_gc_timestamp(wid) REMOTE(wid)->gc_timestamp_
#define LOCAL_db_vec LOCAL->db_vec_
#define REMOTE_db_vec(wid) REMOTE(wid)->db_vec_
#define LOCAL_db_vec0 LOCAL->db_vec0_
#define REMOTE_db_vec0(wid) REMOTE(wid)->db_vec0_
#define LOCAL_db_root LOCAL->db_root_
#define REMOTE_db_root(wid) REMOTE(wid)->db_root_
#define LOCAL_db_nil LOCAL->db_nil_
#define REMOTE_db_nil(wid) REMOTE(wid)->db_nil_
#define LOCAL_gc_restore LOCAL->gc_restore_
#define REMOTE_gc_restore(wid) REMOTE(wid)->gc_restore_
#define LOCAL_DynamicArrays LOCAL->DynamicArrays_
#define REMOTE_DynamicArrays(wid) REMOTE(wid)->DynamicArrays_
#define LOCAL_StaticArrays LOCAL->StaticArrays_
#define REMOTE_StaticArrays(wid) REMOTE(wid)->StaticArrays_
#define LOCAL_GlobalVariables LOCAL->GlobalVariables_
#define REMOTE_GlobalVariables(wid) REMOTE(wid)->GlobalVariables_
#define LOCAL_AllowRestart LOCAL->AllowRestart_
#define REMOTE_AllowRestart(wid) REMOTE(wid)->AllowRestart_
#define LOCAL_CMemFirstBlock LOCAL->cmem_first_block
#define LOCAL_CMemFirstBlockSz LOCAL->cmem_first_block_sz
#define LOCAL_CMemFirstBlock LOCAL->CMemFirstBlock_
#define REMOTE_CMemFirstBlock(wid) REMOTE(wid)->CMemFirstBlock_
#define LOCAL_CMemFirstBlockSz LOCAL->CMemFirstBlockSz_
#define REMOTE_CMemFirstBlockSz(wid) REMOTE(wid)->CMemFirstBlockSz_
#define LOCAL_LabelFirstArray LOCAL->label_first_array
#define LOCAL_LabelFirstArraySz LOCAL->label_first_array_sz
#define LOCAL_LabelFirstArray LOCAL->LabelFirstArray_
#define REMOTE_LabelFirstArray(wid) REMOTE(wid)->LabelFirstArray_
#define LOCAL_LabelFirstArraySz LOCAL->LabelFirstArraySz_
#define REMOTE_LabelFirstArraySz(wid) REMOTE(wid)->LabelFirstArraySz_
#define LOCAL_PL_local_data_p LOCAL->Yap_ld_
#define LOCAL_execution LOCAL->_execution
#define LOCAL_PL_local_data_p LOCAL->PL_local_data_p_
#define REMOTE_PL_local_data_p(wid) REMOTE(wid)->PL_local_data_p_
#ifdef THREADS
#define LOCAL_ThreadHandle LOCAL->thread_handle
#define LOCAL_ThreadHandle LOCAL->ThreadHandle_
#define REMOTE_ThreadHandle(wid) REMOTE(wid)->ThreadHandle_
#endif /* THREADS */
#if defined(YAPOR) || defined(TABLING)
#define LOCAL_optyap_data LOCAL->optyap_data
#define LOCAL_optyap_data LOCAL->optyap_data_
#define REMOTE_optyap_data(wid) REMOTE(wid)->optyap_data_
#endif /* YAPOR || TABLING */
#define REMOTE_ThreadHandle(wid) (REMOTE(wid)->thread_handle)
#define REMOTE_c_input_stream(wid) (REMOTE(wid)->c_input_stream)
#define REMOTE_c_output_stream(wid) (REMOTE(wid)->c_output_stream)
#define REMOTE_c_error_stream(wid) (REMOTE(wid)->c_error_stream)
#define REMOTE_ActiveSignals(wid) (REMOTE(wid)->active_signals)
#define REMOTE_SignalLock(wid) (REMOTE(wid)->signal_lock)
#define REMOTE_ScratchPad(wid) (REMOTE(wid)->scratchpad)
#define LOCAL_InterruptsDisabled LOCAL->InterruptsDisabled_
#define REMOTE_InterruptsDisabled(wid) REMOTE(wid)->InterruptsDisabled_
#define LOCAL_execution LOCAL->execution_
#define REMOTE_execution(wid) REMOTE(wid)->execution_
#if LOW_LEVEL_TRACER
#define LOCAL_total_choicepoints LOCAL->total_choicepoints_
#define REMOTE_total_choicepoints(wid) REMOTE(wid)->total_choicepoints_
#endif
#define LOCAL_consult_level LOCAL->consult_level_
#define REMOTE_consult_level(wid) REMOTE(wid)->consult_level_
#if defined(YAPOR) || defined(THREADS)
#define LOCAL_SignalLock LOCAL->SignalLock_
#define REMOTE_SignalLock(wid) REMOTE(wid)->SignalLock_
#endif

View File

@ -1,5 +1,5 @@
/* This file, hglobals.h, was generated automatically by "yap -L misc/buildheap"
/* This file, hglobals.h, was generated automatically by "yap -L misc/buildlocalglobal"
please do not update, update misc/GLOBALS instead */
@ -18,42 +18,38 @@
typedef struct global_data {
int initialised;
int initialised_from_pl;
int pl_argc;
char **pl_argv;
int Initialised_;
int InitialisedFromPL_;
int PL_Argc_;
char** PL_Argv_;
struct halt_hook *yap_halt_hook;
struct halt_hook* HaltHooks_;
int allow_local_expansion;
int allow_global_expansion;
int allow_trail_expansion;
UInt size_of_overflow;
int AllowLocalExpansion_;
int AllowGlobalExpansion_;
int AllowTrailExpansion_;
UInt SizeOfOverflow_;
UInt agc_threshold;
Agc_hook agc_hook;
UInt AGcThreshold_;
Agc_hook AGCHook_;
#if THREADS
UInt n_of_threads;
UInt NOfThreads_;
UInt n_of_threads_created;
UInt NOfThreadsCreated_;
UInt threads_total_time;
UInt ThreadsTotalTime_;
lockvar ThreadHandlesLock_;
#endif
#if defined(YAPOR) || defined(THREADS)
lockvar bgl;
lockvar BGL_;
#endif
#ifdef THREADS
lockvar thread_handles_lock;
#endif
#if defined(YAPOR) || defined(TABLING)
struct global_optyap_data optyap_data;
struct global_optyap_data optyap_data_;
#endif /* YAPOR || TABLING */
} w_shared;

View File

@ -1,142 +1,131 @@
/* This file, hlocals.h, was generated automatically by "yap -L misc/buildheap"
/* This file, hlocals.h, was generated automatically by "yap -L misc/buildlocalglobal"
please do not update, update misc/LOCALS instead */
typedef struct worker_local {
int c_input_stream;
int c_output_stream;
int c_error_stream;
int c_input_stream_;
int c_output_stream_;
int c_error_stream_;
restoreinfo rinfo;
CELL* OldASP_;
CELL* OldLCL0_;
tr_fr_ptr OldTR_;
CELL* OldGlobalBase_;
CELL* OldH_;
CELL* OldH0_;
ADDR OldTrailBase_;
ADDR OldTrailTop_;
ADDR OldHeapBase_;
ADDR OldHeapTop_;
Int ClDiff_;
Int GDiff_;
Int HDiff_;
Int GDiff0_;
Int GSplit_;
Int LDiff_;
Int TrDiff_;
Int XDiff_;
Int DelayDiff_;
Int BaseDiff_;
YAP_ULONG_LONG ReductionsCounter_;
YAP_ULONG_LONG PredEntriesCounter_;
YAP_ULONG_LONG RetriesCounter_;
int ReductionsCounterOn_;
int PredEntriesCounterOn_;
int RetriesCounterOn_;
union CONSULT_OBJ* ConsultSp_;
UInt ConsultCapacity_;
union CONSULT_OBJ* ConsultBase_;
union CONSULT_OBJ* ConsultLow_;
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 arena_overflows;
Int depth_arenas;
int arith_error;
struct pred_entry* last_asserted_pred;
int debug_on;
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;
Term GlobalArena_;
UInt GlobalArenaOverflows_;
Int ArenaOverflows_;
Int DepthArenas_;
int ArithError_;
struct pred_entry* LastAssertedPred_;
int DebugOn_;
char* ScannerStack_;
struct scanner_extra_alloc* ScannerExtraBlocks_;
struct DB_TERM* BallTerm_;
UInt ActiveSignals_;
UInt IPredArity_;
yamop* ProfEnd_;
int UncaughtThrow_;
int DoingUndefp_;
Int StartLine_;
scratch_block ScratchPad_;
#ifdef COROUTINING
Term woken_goals;
Term atts_mutable_list;
Term WokenGoals_;
Term AttsMutableList_;
#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;
Term GcGeneration_;
Term GcPhase_;
UInt GcCurrentPhase_;
UInt GcCalls_;
Int TotGcTime_;
YAP_ULONG_LONG TotGcRecovered_;
Int LastGcTime_;
Int LastSSTime_;
Int total_marked_;
Int total_oldies_;
struct choicept* current_B_;
CELL* prev_HB_;
CELL* HGEN_;
CELL** iptop_;
#if defined(GC_NO_TAGS)
char* bp_;
#endif
tr_fr_ptr sTR_;
tr_fr_ptr sTR0_;
tr_fr_ptr new_TR_;
struct gc_mark_continuation* cont_top0_;
struct gc_mark_continuation* cont_top_;
int discard_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_;
sigjmp_buf gc_restore_;
struct array_entry* DynamicArrays_;
struct static_array_entry* StaticArrays_;
struct global_entry* GlobalVariables_;
int AllowRestart_;
struct mem_blk* CMemFirstBlock_;
UInt CMemFirstBlockSz_;
Int* LabelFirstArray_;
UInt LabelFirstArraySz_;
struct PL_local_data* PL_local_data_p_;
#ifdef THREADS
struct thandle ThreadHandle_;
#endif /* THREADS */
#if defined(YAPOR) || defined(TABLING)
struct local_optyap_data optyap_data_;
#endif /* YAPOR || TABLING */
int InterruptsDisabled_;
struct open_query_struct* execution_;
#if LOW_LEVEL_TRACER
Int total_cps;
Int total_choicepoints_;
#endif
int consult_level_;
#if defined(YAPOR) || defined(THREADS)
lockvar signal_lock;
lockvar SignalLock_;
#endif
Int tot_marked;
Int tot_oldies;
struct choicept* wl_current_B;
CELL* wl_prev_HB;
CELL* hgen;
CELL** ip_top;
#if defined(GC_NO_TAGS)
char* b_p;
#endif
tr_fr_ptr wl_sTR;
tr_fr_ptr wl_sTR0;
tr_fr_ptr new_tr;
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;
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;
#ifdef THREADS
struct thandle thread_handle;
#endif /* THREADS */
#if defined(YAPOR) || defined(TABLING)
struct local_optyap_data optyap_data;
#endif /* YAPOR || TABLING */
#define REMOTE_ThreadHandle(wid) (REMOTE(wid)->thread_handle)
#define REMOTE_c_input_stream(wid) (REMOTE(wid)->c_input_stream)
#define REMOTE_c_output_stream(wid) (REMOTE(wid)->c_output_stream)
#define REMOTE_c_error_stream(wid) (REMOTE(wid)->c_error_stream)
#define REMOTE_ActiveSignals(wid) (REMOTE(wid)->active_signals)
#define REMOTE_SignalLock(wid) (REMOTE(wid)->signal_lock)
#define REMOTE_ScratchPad(wid) (REMOTE(wid)->scratchpad)
} w_local;

View File

@ -1,5 +1,5 @@
/* This file, iglobals.h, was generated automatically by "yap -L misc/buildheap"
/* This file, iglobals.h, was generated automatically by "yap -L misc/buildlocalglobal"
please do not update, update misc/GLOBALS instead */
@ -18,7 +18,6 @@
static void InitGlobal(void) {
GLOBAL_Initialised = FALSE;
@ -43,16 +42,13 @@ static void InitGlobal(void) {
GLOBAL_NOfThreadsCreated = 1;
GLOBAL_ThreadsTotalTime = 0L;
#endif
INIT_LOCK(GLOBAL_ThreadHandlesLock);
#endif
#if defined(YAPOR) || defined(THREADS)
INIT_LOCK(GLOBAL_BGL);
#endif
#ifdef THREADS
INIT_LOCK(GLOBAL_ThreadHandlesLock);
#endif
#if defined(YAPOR) || defined(TABLING)
#endif /* YAPOR || TABLING */

View File

@ -1,140 +1,131 @@
/* This file, ilocals.h, was generated automatically by "yap -L misc/buildheap"
/* This file, ilocals.h, was generated automatically by "yap -L misc/buildlocalglobal"
please do not update, update misc/LOCALS instead */
static void InitWorker(int wid) {
REMOTE(wid)->c_input_stream = 0;
REMOTE(wid)->c_output_stream = 1;
REMOTE(wid)->c_error_stream = 2;
REMOTE_c_input_stream(wid) = 0;
REMOTE_c_output_stream(wid) = 1;
REMOTE_c_error_stream(wid) = 2;
REMOTE(wid)->rinfo.old_ASP = NULL;
REMOTE(wid)->rinfo.old_LCL0 = NULL;
REMOTE(wid)->rinfo.old_TR = NULL;
REMOTE(wid)->rinfo.old_GlobalBase = NULL;
REMOTE(wid)->rinfo.old_H = NULL;
REMOTE(wid)->rinfo.old_H0 = NULL;
REMOTE(wid)->rinfo.old_TrailBase = NULL;
REMOTE(wid)->rinfo.old_TrailTop = NULL;
REMOTE(wid)->rinfo.old_HeapBase = NULL;
REMOTE(wid)->rinfo.old_HeapTop = NULL;
REMOTE(wid)->rinfo.cl_diff = 0L;
REMOTE(wid)->rinfo.g_diff = 0L;
REMOTE(wid)->rinfo.h_diff = 0L;
REMOTE(wid)->rinfo.g_diff0 = 0L;
REMOTE(wid)->rinfo.g_split = NULL;
REMOTE(wid)->rinfo.l_diff = 0L;
REMOTE(wid)->rinfo.tr_diff = 0L;
REMOTE(wid)->rinfo.x_diff = 0L;
REMOTE(wid)->rinfo.delay_diff = 0L;
REMOTE(wid)->rinfo.base_diff = 0L;
REMOTE(wid)->call_counters.reductions = 0L;
REMOTE(wid)->call_counters.reductions_retries = 0L;
REMOTE(wid)->call_counters.retries = 0L;
REMOTE(wid)->call_counters.reductions_on = 0L;
REMOTE(wid)->call_counters.reductions_retries_on = 0L;
REMOTE(wid)->call_counters.retries_on = 0L;
REMOTE(wid)->interrupts_disabled = FALSE;
REMOTE_OldASP(wid) = NULL;
REMOTE_OldLCL0(wid) = NULL;
REMOTE_OldTR(wid) = NULL;
REMOTE_OldGlobalBase(wid) = NULL;
REMOTE_OldH(wid) = NULL;
REMOTE_OldH0(wid) = NULL;
REMOTE_OldTrailBase(wid) = NULL;
REMOTE_OldTrailTop(wid) = NULL;
REMOTE_OldHeapBase(wid) = NULL;
REMOTE_OldHeapTop(wid) = NULL;
REMOTE_ClDiff(wid) = 0L;
REMOTE_GDiff(wid) = 0L;
REMOTE_HDiff(wid) = 0L;
REMOTE_GDiff0(wid) = 0L;
REMOTE_GSplit(wid) = NULL;
REMOTE_LDiff(wid) = 0L;
REMOTE_TrDiff(wid) = 0L;
REMOTE_XDiff(wid) = 0L;
REMOTE_DelayDiff(wid) = 0L;
REMOTE_BaseDiff(wid) = 0L;
REMOTE_ReductionsCounter(wid) = 0L;
REMOTE_PredEntriesCounter(wid) = 0L;
REMOTE_RetriesCounter(wid) = 0L;
REMOTE_ReductionsCounterOn(wid) = 0L;
REMOTE_PredEntriesCounterOn(wid) = 0L;
REMOTE_RetriesCounterOn(wid) = 0L;
REMOTE(wid)->consultsp = NULL;
REMOTE_ConsultSp(wid) = NULL;
REMOTE(wid)->consultbase = NULL;
REMOTE_ConsultBase(wid) = NULL;
REMOTE(wid)->consultlow = NULL;
REMOTE_ConsultLow(wid) = NULL;
REMOTE(wid)->global_arena = 0L;
REMOTE(wid)->global_arena_overflows = 0L;
REMOTE(wid)->arena_overflows = 0L;
REMOTE(wid)->depth_arenas = 0;
REMOTE(wid)->arith_error = FALSE;
REMOTE(wid)->last_asserted_pred = NULL;
REMOTE(wid)->debug_on = FALSE;
REMOTE(wid)->scanner_stack = NULL;
REMOTE(wid)->scanner_extra_blocks = NULL;
REMOTE(wid)->ball_term = NULL;
REMOTE(wid)->active_signals = 0L;
REMOTE(wid)->i_pred_arity = 0L;
REMOTE(wid)->prof_end = NULL;
REMOTE(wid)->uncaught_throw = FALSE;
REMOTE(wid)->doing_undefp = FALSE;
REMOTE(wid)->start_line = 0L;
REMOTE_GlobalArena(wid) = 0L;
REMOTE_GlobalArenaOverflows(wid) = 0L;
REMOTE_ArenaOverflows(wid) = 0L;
REMOTE_DepthArenas(wid) = 0;
REMOTE_ArithError(wid) = FALSE;
REMOTE_LastAssertedPred(wid) = NULL;
REMOTE_DebugOn(wid) = FALSE;
REMOTE_ScannerStack(wid) = NULL;
REMOTE_ScannerExtraBlocks(wid) = NULL;
REMOTE_BallTerm(wid) = NULL;
REMOTE_ActiveSignals(wid) = 0L;
REMOTE_IPredArity(wid) = 0L;
REMOTE_ProfEnd(wid) = NULL;
REMOTE_UncaughtThrow(wid) = FALSE;
REMOTE_DoingUndefp(wid) = FALSE;
REMOTE_StartLine(wid) = 0L;
InitScratchPad(wid);
#ifdef COROUTINING
REMOTE(wid)->woken_goals = 0L;
REMOTE(wid)->atts_mutable_list = 0L;
REMOTE_WokenGoals(wid) = 0L;
REMOTE_AttsMutableList(wid) = 0L;
#endif
REMOTE(wid)->gc_generation = 0L;
REMOTE(wid)->gc_phase = 0L;
REMOTE(wid)->gc_current_phase = 0L;
REMOTE(wid)->gc_calls = 0L;
REMOTE(wid)->tot_gc_time = 0L;
REMOTE(wid)->tot_gc_recovered = 0L;
REMOTE(wid)->last_gc_time = 0L;
REMOTE(wid)->last_ss_time = 0L;
#if LOW_LEVEL_TRACER
REMOTE(wid)->total_cps = 0;
#endif
REMOTE(wid)->consult_level_ = 0;
#if defined(YAPOR) || defined(THREADS)
INIT_LOCK(REMOTE(wid)->signal_lock);
#endif
REMOTE(wid)->tot_marked = 0L;
REMOTE(wid)->tot_oldies = 0L;
REMOTE(wid)->wl_current_B = NULL;
REMOTE(wid)->wl_prev_HB = NULL;
REMOTE(wid)->hgen = NULL;
REMOTE(wid)->ip_top = NULL;
REMOTE_GcGeneration(wid) = 0L;
REMOTE_GcPhase(wid) = 0L;
REMOTE_GcCurrentPhase(wid) = 0L;
REMOTE_GcCalls(wid) = 0L;
REMOTE_TotGcTime(wid) = 0L;
REMOTE_TotGcRecovered(wid) = 0L;
REMOTE_LastGcTime(wid) = 0L;
REMOTE_LastSSTime(wid) = 0L;
REMOTE_total_marked(wid) = 0L;
REMOTE_total_oldies(wid) = 0L;
REMOTE_current_B(wid) = NULL;
REMOTE_prev_HB(wid) = NULL;
REMOTE_HGEN(wid) = NULL;
REMOTE_iptop(wid) = NULL;
#if defined(GC_NO_TAGS)
REMOTE(wid)->b_p = NULL;
REMOTE_bp(wid) = NULL;
#endif
REMOTE(wid)->wl_sTR = NULL;
REMOTE(wid)->wl_sTR0 = NULL;
REMOTE(wid)->new_tr = NULL;
REMOTE(wid)->conttop0 = NULL;
REMOTE(wid)->conttop = NULL;
REMOTE(wid)->disc_trail_entries = 0;
REMOTE_sTR(wid) = NULL;
REMOTE_sTR0(wid) = NULL;
REMOTE_new_TR(wid) = NULL;
REMOTE_cont_top0(wid) = NULL;
REMOTE_cont_top(wid) = NULL;
REMOTE_discard_trail_entries(wid) = 0;
REMOTE(wid)->Gc_ma_h_top = NULL;
REMOTE(wid)->Gc_ma_h_list = NULL;
REMOTE(wid)->Gc_timestamp = 0L;
REMOTE(wid)->DB_vec = NULL;
REMOTE(wid)->DB_vec0 = NULL;
REMOTE(wid)->DB_root = NULL;
REMOTE(wid)->DB_nil = NULL;
REMOTE_gc_ma_h_top(wid) = NULL;
REMOTE_gc_ma_h_list(wid) = NULL;
REMOTE_gc_timestamp(wid) = 0L;
REMOTE_db_vec(wid) = NULL;
REMOTE_db_vec0(wid) = NULL;
REMOTE_db_root(wid) = NULL;
REMOTE_db_nil(wid) = NULL;
REMOTE(wid)->dynamic_arrays = NULL;
REMOTE(wid)->static_arrays = NULL;
REMOTE(wid)->global_variables = NULL;
REMOTE(wid)->allow_restart = FALSE;
REMOTE_DynamicArrays(wid) = NULL;
REMOTE_StaticArrays(wid) = NULL;
REMOTE_GlobalVariables(wid) = NULL;
REMOTE_AllowRestart(wid) = FALSE;
REMOTE(wid)->cmem_first_block = NULL;
REMOTE(wid)->cmem_first_block_sz = 0L;
REMOTE_CMemFirstBlock(wid) = NULL;
REMOTE_CMemFirstBlockSz(wid) = 0L;
REMOTE(wid)->label_first_array = NULL;
REMOTE(wid)->label_first_array_sz = 0L;
REMOTE_LabelFirstArray(wid) = NULL;
REMOTE_LabelFirstArraySz(wid) = 0L;
REMOTE(wid)->Yap_ld_ = Yap_InitThreadIO(wid);
REMOTE(wid)->_execution = NULL;
REMOTE_PL_local_data_p(wid) = Yap_InitThreadIO(wid);
#ifdef THREADS
InitThreadHandle(wid);
#endif /* THREADS */
#if defined(YAPOR) || defined(TABLING)
Yap_init_local_optyap_data(wid);
#endif /* YAPOR || TABLING */
#define REMOTE_ThreadHandle(wid) (REMOTE(wid)->thread_handle)
#define REMOTE_c_input_stream(wid) (REMOTE(wid)->c_input_stream)
#define REMOTE_c_output_stream(wid) (REMOTE(wid)->c_output_stream)
#define REMOTE_c_error_stream(wid) (REMOTE(wid)->c_error_stream)
#define REMOTE_ActiveSignals(wid) (REMOTE(wid)->active_signals)
#define REMOTE_SignalLock(wid) (REMOTE(wid)->signal_lock)
#define REMOTE_ScratchPad(wid) (REMOTE(wid)->scratchpad)
REMOTE_InterruptsDisabled(wid) = FALSE;
REMOTE_execution(wid) = NULL;
#if LOW_LEVEL_TRACER
REMOTE_total_choicepoints(wid) = 0;
#endif
REMOTE_consult_level(wid) = 0;
#if defined(YAPOR) || defined(THREADS)
INIT_LOCK(REMOTE_SignalLock(wid));
#endif
}

View File

@ -1,5 +1,5 @@
/* This file, rglobals.h, was generated automatically by "yap -L misc/buildheap"
/* This file, rglobals.h, was generated automatically by "yap -L misc/buildlocalglobal"
please do not update, update misc/GLOBALS instead */
@ -18,7 +18,6 @@
static void RestoreGlobal(void) {
@ -43,16 +42,13 @@ static void RestoreGlobal(void) {
#endif
REINIT_LOCK(GLOBAL_ThreadHandlesLock);
#endif
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(GLOBAL_BGL);
#endif
#ifdef THREADS
REINIT_LOCK(GLOBAL_ThreadHandlesLock);
#endif
#if defined(YAPOR) || defined(TABLING)
#endif /* YAPOR || TABLING */

View File

@ -1,5 +1,5 @@
/* This file, rlocals.h, was generated automatically by "yap -L misc/buildheap"
/* This file, rlocals.h, was generated automatically by "yap -L misc/buildlocalglobal"
please do not update, update misc/LOCALS instead */
@ -46,7 +46,7 @@ static void RestoreWorker(int wid USES_REGS) {
REMOTE(wid)->global_arena = TermToGlobalOrAtomAdjust(REMOTE(wid)->global_arena);
REMOTE_GlobalArena(wid) = TermToGlobalOrAtomAdjust(REMOTE_GlobalArena(wid));
@ -64,26 +64,18 @@ static void RestoreWorker(int wid USES_REGS) {
#ifdef COROUTINING
REMOTE(wid)->woken_goals = TermToGlobalAdjust(REMOTE(wid)->woken_goals);
REMOTE(wid)->atts_mutable_list = TermToGlobalAdjust(REMOTE(wid)->atts_mutable_list);
REMOTE_WokenGoals(wid) = TermToGlobalAdjust(REMOTE_WokenGoals(wid));
REMOTE_AttsMutableList(wid) = TermToGlobalAdjust(REMOTE_AttsMutableList(wid));
#endif
REMOTE(wid)->gc_generation = TermToGlobalAdjust(REMOTE(wid)->gc_generation);
REMOTE(wid)->gc_phase = TermToGlobalAdjust(REMOTE(wid)->gc_phase);
REMOTE_GcGeneration(wid) = TermToGlobalAdjust(REMOTE_GcGeneration(wid));
REMOTE_GcPhase(wid) = TermToGlobalAdjust(REMOTE_GcPhase(wid));
#if LOW_LEVEL_TRACER
#endif
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(REMOTE(wid)->signal_lock);
#endif
@ -109,10 +101,9 @@ static void RestoreWorker(int wid USES_REGS) {
REMOTE(wid)->dynamic_arrays = PtoArrayEAdjust(REMOTE(wid)->dynamic_arrays);
REMOTE(wid)->static_arrays = PtoArraySAdjust(REMOTE(wid)->static_arrays);
REMOTE(wid)->global_variables = PtoGlobalEAdjust(REMOTE(wid)->global_variables);
REMOTE_DynamicArrays(wid) = PtoArrayEAdjust(REMOTE_DynamicArrays(wid));
REMOTE_StaticArrays(wid) = PtoArraySAdjust(REMOTE_StaticArrays(wid));
REMOTE_GlobalVariables(wid) = PtoGlobalEAdjust(REMOTE_GlobalVariables(wid));
@ -129,12 +120,12 @@ static void RestoreWorker(int wid USES_REGS) {
#endif /* YAPOR || TABLING */
#define REMOTE_ThreadHandle(wid) (REMOTE(wid)->thread_handle)
#define REMOTE_c_input_stream(wid) (REMOTE(wid)->c_input_stream)
#define REMOTE_c_output_stream(wid) (REMOTE(wid)->c_output_stream)
#define REMOTE_c_error_stream(wid) (REMOTE(wid)->c_error_stream)
#define REMOTE_ActiveSignals(wid) (REMOTE(wid)->active_signals)
#define REMOTE_SignalLock(wid) (REMOTE(wid)->signal_lock)
#define REMOTE_ScratchPad(wid) (REMOTE(wid)->scratchpad)
#if LOW_LEVEL_TRACER
#endif
#if defined(YAPOR) || defined(THREADS)
REINIT_LOCK(REMOTE_SignalLock(wid));
#endif
}

View File

@ -224,72 +224,72 @@ struct global_optyap_data {
#endif /* TABLING */
};
#define GLOBAL_max_pages (Yap_optyap_data.pages.max_pages)
#define GLOBAL_pages_void (Yap_optyap_data.pages.void_pages)
#define GLOBAL_pages_or_fr (Yap_optyap_data.pages.or_frame_pages)
#define GLOBAL_pages_qg_sol_fr (Yap_optyap_data.pages.query_goal_solution_frame_pages)
#define GLOBAL_pages_qg_ans_fr (Yap_optyap_data.pages.query_goal_answer_frame_pages)
#define GLOBAL_pages_tg_sol_fr (Yap_optyap_data.pages.table_subgoal_solution_frame_pages)
#define GLOBAL_pages_tg_ans_fr (Yap_optyap_data.pages.table_subgoal_answer_frame_pages)
#define GLOBAL_pages_tab_ent (Yap_optyap_data.pages.table_entry_pages)
#define GLOBAL_pages_sg_fr (Yap_optyap_data.pages.subgoal_frame_pages)
#define GLOBAL_pages_dep_fr (Yap_optyap_data.pages.dependency_frame_pages)
#define GLOBAL_pages_sg_node (Yap_optyap_data.pages.subgoal_trie_node_pages)
#define GLOBAL_pages_ans_node (Yap_optyap_data.pages.answer_trie_node_pages)
#define GLOBAL_pages_gt_node (Yap_optyap_data.pages.global_trie_node_pages)
#define GLOBAL_pages_sg_hash (Yap_optyap_data.pages.subgoal_trie_hash_pages)
#define GLOBAL_pages_ans_hash (Yap_optyap_data.pages.answer_trie_hash_pages)
#define GLOBAL_pages_gt_hash (Yap_optyap_data.pages.global_trie_hash_pages)
#define GLOBAL_pages_susp_fr (Yap_optyap_data.pages.suspension_frame_pages)
#define GLOBAL_scheduler_loop (Yap_optyap_data.scheduler_loop)
#define GLOBAL_delayed_release_load (Yap_optyap_data.delayed_release_load)
#define GLOBAL_number_workers (Yap_optyap_data.number_workers)
#define GLOBAL_worker_pid(worker) (Yap_optyap_data.worker_pid[worker])
#define GLOBAL_master_worker (Yap_optyap_data.master_worker)
#define GLOBAL_execution_time (Yap_optyap_data.execution_time)
#define GLOBAL_best_times(time) (Yap_optyap_data.best_execution_times[time])
#define GLOBAL_number_goals (Yap_optyap_data.number_of_executed_goals)
#define GLOBAL_performance_mode (Yap_optyap_data.performance_mode)
#define GLOBAL_max_pages (GLOBAL_optyap_data.pages.max_pages)
#define GLOBAL_pages_void (GLOBAL_optyap_data.pages.void_pages)
#define GLOBAL_pages_or_fr (GLOBAL_optyap_data.pages.or_frame_pages)
#define GLOBAL_pages_qg_sol_fr (GLOBAL_optyap_data.pages.query_goal_solution_frame_pages)
#define GLOBAL_pages_qg_ans_fr (GLOBAL_optyap_data.pages.query_goal_answer_frame_pages)
#define GLOBAL_pages_tg_sol_fr (GLOBAL_optyap_data.pages.table_subgoal_solution_frame_pages)
#define GLOBAL_pages_tg_ans_fr (GLOBAL_optyap_data.pages.table_subgoal_answer_frame_pages)
#define GLOBAL_pages_tab_ent (GLOBAL_optyap_data.pages.table_entry_pages)
#define GLOBAL_pages_sg_fr (GLOBAL_optyap_data.pages.subgoal_frame_pages)
#define GLOBAL_pages_dep_fr (GLOBAL_optyap_data.pages.dependency_frame_pages)
#define GLOBAL_pages_sg_node (GLOBAL_optyap_data.pages.subgoal_trie_node_pages)
#define GLOBAL_pages_ans_node (GLOBAL_optyap_data.pages.answer_trie_node_pages)
#define GLOBAL_pages_gt_node (GLOBAL_optyap_data.pages.global_trie_node_pages)
#define GLOBAL_pages_sg_hash (GLOBAL_optyap_data.pages.subgoal_trie_hash_pages)
#define GLOBAL_pages_ans_hash (GLOBAL_optyap_data.pages.answer_trie_hash_pages)
#define GLOBAL_pages_gt_hash (GLOBAL_optyap_data.pages.global_trie_hash_pages)
#define GLOBAL_pages_susp_fr (GLOBAL_optyap_data.pages.suspension_frame_pages)
#define GLOBAL_scheduler_loop (GLOBAL_optyap_data.scheduler_loop)
#define GLOBAL_delayed_release_load (GLOBAL_optyap_data.delayed_release_load)
#define GLOBAL_number_workers (GLOBAL_optyap_data.number_workers)
#define GLOBAL_worker_pid(worker) (GLOBAL_optyap_data.worker_pid[worker])
#define GLOBAL_master_worker (GLOBAL_optyap_data.master_worker)
#define GLOBAL_execution_time (GLOBAL_optyap_data.execution_time)
#define GLOBAL_best_times(time) (GLOBAL_optyap_data.best_execution_times[time])
#define GLOBAL_number_goals (GLOBAL_optyap_data.number_of_executed_goals)
#define GLOBAL_performance_mode (GLOBAL_optyap_data.performance_mode)
#ifdef YAPOR_THREADS
#define Get_GLOBAL_root_cp() offset_to_cptr(Yap_optyap_data.root_choice_point_offset)
#define Set_GLOBAL_root_cp(bptr) (Yap_optyap_data.root_choice_point_offset = cptr_to_offset(bptr))
#define Get_GLOBAL_root_cp() offset_to_cptr(GLOBAL_optyap_data.root_choice_point_offset)
#define Set_GLOBAL_root_cp(bptr) (GLOBAL_optyap_data.root_choice_point_offset = cptr_to_offset(bptr))
#else
#define GLOBAL_root_cp (Yap_optyap_data.root_choice_point)
#define Get_GLOBAL_root_cp() (Yap_optyap_data.root_choice_point)
#define Set_GLOBAL_root_cp(bptr) (Yap_optyap_data.root_choice_point = (bptr))
#define GLOBAL_root_cp (GLOBAL_optyap_data.root_choice_point)
#define Get_GLOBAL_root_cp() (GLOBAL_optyap_data.root_choice_point)
#define Set_GLOBAL_root_cp(bptr) (GLOBAL_optyap_data.root_choice_point = (bptr))
#endif
#define GLOBAL_root_or_fr (Yap_optyap_data.root_or_frame)
#define GLOBAL_bm_present_workers (Yap_optyap_data.present_workers)
#define GLOBAL_bm_idle_workers (Yap_optyap_data.idle_workers)
#define GLOBAL_bm_root_cp_workers (Yap_optyap_data.root_cp_workers)
#define GLOBAL_bm_invisible_workers (Yap_optyap_data.invisible_workers)
#define GLOBAL_bm_requestable_workers (Yap_optyap_data.requestable_workers)
#define GLOBAL_bm_executing_workers (Yap_optyap_data.executing_workers)
#define GLOBAL_bm_finished_workers (Yap_optyap_data.finished_workers)
#define GLOBAL_bm_pruning_workers (Yap_optyap_data.pruning_workers)
#define GLOBAL_locks_bm_idle_workers (Yap_optyap_data.locks.bitmap_idle_workers)
#define GLOBAL_locks_bm_root_cp_workers (Yap_optyap_data.locks.bitmap_root_cp_workers)
#define GLOBAL_locks_bm_invisible_workers (Yap_optyap_data.locks.bitmap_invisible_workers)
#define GLOBAL_locks_bm_requestable_workers (Yap_optyap_data.locks.bitmap_requestable_workers)
#define GLOBAL_locks_bm_executing_workers (Yap_optyap_data.locks.bitmap_executing_workers)
#define GLOBAL_locks_bm_finished_workers (Yap_optyap_data.locks.bitmap_finished_workers)
#define GLOBAL_locks_bm_pruning_workers (Yap_optyap_data.locks.bitmap_pruning_workers)
#define GLOBAL_locks_who_locked_heap (Yap_optyap_data.locks.who_locked_heap)
#define GLOBAL_locks_heap_access (Yap_optyap_data.locks.heap_access)
#define GLOBAL_locks_alloc_block (Yap_optyap_data.locks.alloc_block)
#define GLOBAL_branch(worker, depth) (Yap_optyap_data.branch[worker][depth])
#define GLOBAL_parallel_execution_mode (Yap_optyap_data.parallel_execution_mode)
#define GLOBAL_answers (Yap_optyap_data.answers)
#define GLOBAL_root_gt (Yap_optyap_data.root_global_trie)
#define GLOBAL_root_tab_ent (Yap_optyap_data.root_table_entry)
#define GLOBAL_first_sg_fr (Yap_optyap_data.first_subgoal_frame)
#define GLOBAL_last_sg_fr (Yap_optyap_data.last_subgoal_frame)
#define GLOBAL_check_sg_fr (Yap_optyap_data.check_subgoal_frame)
#define GLOBAL_root_dep_fr (Yap_optyap_data.root_dependency_frame)
#define GLOBAL_table_var_enumerator(index) (Yap_optyap_data.table_var_enumerator[index])
#define GLOBAL_table_var_enumerator_addr(index) (Yap_optyap_data.table_var_enumerator + (index))
#define GLOBAL_table_lock(index) (Yap_optyap_data.table_lock[index])
#define GLOBAL_timestamp (Yap_optyap_data.timestamp)
#define GLOBAL_root_or_fr (GLOBAL_optyap_data.root_or_frame)
#define GLOBAL_bm_present_workers (GLOBAL_optyap_data.present_workers)
#define GLOBAL_bm_idle_workers (GLOBAL_optyap_data.idle_workers)
#define GLOBAL_bm_root_cp_workers (GLOBAL_optyap_data.root_cp_workers)
#define GLOBAL_bm_invisible_workers (GLOBAL_optyap_data.invisible_workers)
#define GLOBAL_bm_requestable_workers (GLOBAL_optyap_data.requestable_workers)
#define GLOBAL_bm_executing_workers (GLOBAL_optyap_data.executing_workers)
#define GLOBAL_bm_finished_workers (GLOBAL_optyap_data.finished_workers)
#define GLOBAL_bm_pruning_workers (GLOBAL_optyap_data.pruning_workers)
#define GLOBAL_locks_bm_idle_workers (GLOBAL_optyap_data.locks.bitmap_idle_workers)
#define GLOBAL_locks_bm_root_cp_workers (GLOBAL_optyap_data.locks.bitmap_root_cp_workers)
#define GLOBAL_locks_bm_invisible_workers (GLOBAL_optyap_data.locks.bitmap_invisible_workers)
#define GLOBAL_locks_bm_requestable_workers (GLOBAL_optyap_data.locks.bitmap_requestable_workers)
#define GLOBAL_locks_bm_executing_workers (GLOBAL_optyap_data.locks.bitmap_executing_workers)
#define GLOBAL_locks_bm_finished_workers (GLOBAL_optyap_data.locks.bitmap_finished_workers)
#define GLOBAL_locks_bm_pruning_workers (GLOBAL_optyap_data.locks.bitmap_pruning_workers)
#define GLOBAL_locks_who_locked_heap (GLOBAL_optyap_data.locks.who_locked_heap)
#define GLOBAL_locks_heap_access (GLOBAL_optyap_data.locks.heap_access)
#define GLOBAL_locks_alloc_block (GLOBAL_optyap_data.locks.alloc_block)
#define GLOBAL_branch(worker, depth) (GLOBAL_optyap_data.branch[worker][depth])
#define GLOBAL_parallel_execution_mode (GLOBAL_optyap_data.parallel_execution_mode)
#define GLOBAL_answers (GLOBAL_optyap_data.answers)
#define GLOBAL_root_gt (GLOBAL_optyap_data.root_global_trie)
#define GLOBAL_root_tab_ent (GLOBAL_optyap_data.root_table_entry)
#define GLOBAL_first_sg_fr (GLOBAL_optyap_data.first_subgoal_frame)
#define GLOBAL_last_sg_fr (GLOBAL_optyap_data.last_subgoal_frame)
#define GLOBAL_check_sg_fr (GLOBAL_optyap_data.check_subgoal_frame)
#define GLOBAL_root_dep_fr (GLOBAL_optyap_data.root_dependency_frame)
#define GLOBAL_table_var_enumerator(index) (GLOBAL_optyap_data.table_var_enumerator[index])
#define GLOBAL_table_var_enumerator_addr(index) (GLOBAL_optyap_data.table_var_enumerator + (index))
#define GLOBAL_table_lock(index) (GLOBAL_optyap_data.table_lock[index])
#define GLOBAL_timestamp (GLOBAL_optyap_data.timestamp)
@ -442,47 +442,47 @@ struct local_optyap_data {
#define LOCAL_ma_hash_table (LOCAL_optyap_data.ma_hash_table)
#define REMOTE_lock(wid) (REMOTE(wid)->optyap_data.lock)
#define REMOTE_load(wid) (REMOTE(wid)->optyap_data.load)
#define REMOTE_lock(wid) (REMOTE(wid)->optyap_data_.lock)
#define REMOTE_load(wid) (REMOTE(wid)->optyap_data_.load)
#ifdef YAPOR_THREADS
#define REMOTE_top_cp(wid) offset_to_cptr(REMOTE(wid)->optyap_data.top_choice_point_offset)
#define Set_REMOTE_top_cp(wid, bptr) (REMOTE(wid)->optyap_data.top_choice_point_offset = cptr_to_offset(bptr))
#define REMOTE_top_cp(wid) offset_to_cptr(REMOTE(wid)->optyap_data_.top_choice_point_offset)
#define Set_REMOTE_top_cp(wid, bptr) (REMOTE(wid)->optyap_data_.top_choice_point_offset = cptr_to_offset(bptr))
#else
#define REMOTE_top_cp(wid) (REMOTE(wid)->optyap_data.top_choice_point)
#define Set_REMOTE_top_cp(wid, bptr) (REMOTE(wid)->optyap_data.top_choice_point = (bptr))
#define REMOTE_top_cp(wid) (REMOTE(wid)->optyap_data_.top_choice_point)
#define Set_REMOTE_top_cp(wid, bptr) (REMOTE(wid)->optyap_data_.top_choice_point = (bptr))
#endif /* YAPOR_THREADS */
#define REMOTE_top_or_fr(wid) (REMOTE(wid)->optyap_data.top_or_frame)
#define REMOTE_top_or_fr(wid) (REMOTE(wid)->optyap_data_.top_or_frame)
#ifdef YAPOR_THREADS
#define Get_REMOTE_prune_request(wid) offset_to_cptr_with_null(REMOTE(wid)->optyap_data.prune_request_offset)
#define Set_REMOTE_prune_request(wid,cp) (REMOTE(wid)->optyap_data.prune_request_offset = cptr_to_offset_with_null(cp))
#define Get_REMOTE_prune_request(wid) offset_to_cptr_with_null(REMOTE(wid)->optyap_data_.prune_request_offset)
#define Set_REMOTE_prune_request(wid,cp) (REMOTE(wid)->optyap_data_.prune_request_offset = cptr_to_offset_with_null(cp))
#else
#define REMOTE_prune_request(wid) (REMOTE(wid)->optyap_data.prune_request)
#define Get_REMOTE_prune_request(wid) (REMOTE(wid)->optyap_data.prune_request)
#define Set_REMOTE_prune_request(wid,cp) (REMOTE(wid)->optyap_data.prune_request = cp)
#define REMOTE_prune_request(wid) (REMOTE(wid)->optyap_data_.prune_request)
#define Get_REMOTE_prune_request(wid) (REMOTE(wid)->optyap_data_.prune_request)
#define Set_REMOTE_prune_request(wid,cp) (REMOTE(wid)->optyap_data_.prune_request = cp)
#endif /* YAPOR_THREADS */
#define REMOTE_share_request(wid) (REMOTE(wid)->optyap_data.share_request)
#define REMOTE_reply_signal(wid) (REMOTE(wid)->optyap_data.share_signals.reply_signal)
#define REMOTE_p_fase_signal(wid) (REMOTE(wid)->optyap_data.share_signals.P_fase)
#define REMOTE_q_fase_signal(wid) (REMOTE(wid)->optyap_data.share_signals.Q_fase)
#define REMOTE_lock_signals(wid) (REMOTE(wid)->optyap_data.share_signals.lock)
#define REMOTE_start_global_copy(wid) (REMOTE(wid)->optyap_data.global_copy.start)
#define REMOTE_end_global_copy(wid) (REMOTE(wid)->optyap_data.global_copy.end)
#define REMOTE_start_local_copy(wid) (REMOTE(wid)->optyap_data.local_copy.start)
#define REMOTE_end_local_copy(wid) (REMOTE(wid)->optyap_data.local_copy.end)
#define REMOTE_start_trail_copy(wid) (REMOTE(wid)->optyap_data.trail_copy.start)
#define REMOTE_end_trail_copy(wid) (REMOTE(wid)->optyap_data.trail_copy.end)
#define REMOTE_next_free_ans_node(wid) (REMOTE(wid)->optyap_data.next_free_answer_trie_node)
#define REMOTE_top_sg_fr(wid) (REMOTE(wid)->optyap_data.top_subgoal_frame)
#define REMOTE_top_dep_fr(wid) (REMOTE(wid)->optyap_data.top_dependency_frame)
#define REMOTE_pruning_scope(wid) (REMOTE(wid)->optyap_data.bottom_pruning_scope)
#define REMOTE_share_request(wid) (REMOTE(wid)->optyap_data_.share_request)
#define REMOTE_reply_signal(wid) (REMOTE(wid)->optyap_data_.share_signals.reply_signal)
#define REMOTE_p_fase_signal(wid) (REMOTE(wid)->optyap_data_.share_signals.P_fase)
#define REMOTE_q_fase_signal(wid) (REMOTE(wid)->optyap_data_.share_signals.Q_fase)
#define REMOTE_lock_signals(wid) (REMOTE(wid)->optyap_data_.share_signals.lock)
#define REMOTE_start_global_copy(wid) (REMOTE(wid)->optyap_data_.global_copy.start)
#define REMOTE_end_global_copy(wid) (REMOTE(wid)->optyap_data_.global_copy.end)
#define REMOTE_start_local_copy(wid) (REMOTE(wid)->optyap_data_.local_copy.start)
#define REMOTE_end_local_copy(wid) (REMOTE(wid)->optyap_data_.local_copy.end)
#define REMOTE_start_trail_copy(wid) (REMOTE(wid)->optyap_data_.trail_copy.start)
#define REMOTE_end_trail_copy(wid) (REMOTE(wid)->optyap_data_.trail_copy.end)
#define REMOTE_next_free_ans_node(wid) (REMOTE(wid)->optyap_data_.next_free_answer_trie_node)
#define REMOTE_top_sg_fr(wid) (REMOTE(wid)->optyap_data_.top_subgoal_frame)
#define REMOTE_top_dep_fr(wid) (REMOTE(wid)->optyap_data_.top_dependency_frame)
#define REMOTE_pruning_scope(wid) (REMOTE(wid)->optyap_data_.bottom_pruning_scope)
#ifdef YAPOR_THREADS
#define REMOTE_top_cp_on_stack(wid) offset_to_cptr(REMOTE(wid)->optyap_data.top_choice_point_on_stack_offset)
#define Set_REMOTE_top_cp_on_stack(wid, bptr) (REMOTE(wid)->optyap_data.top_choice_point_on_stack_offset = cptr_to_offset(bptr))
#define REMOTE_top_cp_on_stack(wid) offset_to_cptr(REMOTE(wid)->optyap_data_.top_choice_point_on_stack_offset)
#define Set_REMOTE_top_cp_on_stack(wid, bptr) (REMOTE(wid)->optyap_data_.top_choice_point_on_stack_offset = cptr_to_offset(bptr))
#else
#define REMOTE_top_cp_on_stack(wid) (REMOTE(wid)->optyap_data.top_choice_point_on_stack)
#define Set_REMOTE_top_cp_on_stack(wid, bptr) (REMOTE(wid)->optyap_data.top_choice_point_on_stack = (bptr))
#define REMOTE_top_cp_on_stack(wid) (REMOTE(wid)->optyap_data_.top_choice_point_on_stack)
#define Set_REMOTE_top_cp_on_stack(wid, bptr) (REMOTE(wid)->optyap_data_.top_choice_point_on_stack = (bptr))
#endif /* YAPOR_THREADS */
#define REMOTE_top_susp_or_fr(wid) (REMOTE(wid)->optyap_data.top_or_frame_with_suspensions)
#define REMOTE_top_susp_or_fr(wid) (REMOTE(wid)->optyap_data_.top_or_frame_with_suspensions)
#ifdef YAPOR

View File

@ -2505,7 +2505,7 @@ X_API int
PL_destroy_engine(PL_engine_t e)
{
#if THREADS
return YAP_ThreadDestroyEngine(((struct worker_local *)e)->thread_handle.current_yaam_regs->worker_id_);
return YAP_ThreadDestroyEngine(((struct worker_local *)e)->ThreadHandle_.current_yaam_regs->worker_id_);
#else
return FALSE;
#endif
@ -2538,7 +2538,7 @@ PL_set_engine(PL_engine_t engine, PL_engine_t *old)
}
return PL_ENGINE_SET;
} else {
nwid = ((struct worker_local *)engine)->thread_handle.current_yaam_regs->worker_id_;
nwid = ((struct worker_local *)engine)->ThreadHandle_.current_yaam_regs->worker_id_;
}
pthread_mutex_lock(&(REMOTE_ThreadHandle(nwid).tlock));

View File

@ -7,10 +7,9 @@
// - they must be initialised somewhere
// - they may be of interest to restore
//
// The defs include 4+ components:
// The defs include 3+ components:
// Type
// name in structured
// global name
// name in structured / global name
// init code (optional)
// restore code (optional)
//
@ -19,47 +18,43 @@
START_GLOBAL_DATA
// initialization: tell whether the system has been initialised and by whom.
int initialised GLOBAL_Initialised =FALSE
int initialised_from_pl GLOBAL_InitialisedFromPL =FALSE
int pl_argc GLOBAL_PL_Argc =0
char **pl_argv GLOBAL_PL_Argv =NULL
int Initialised =FALSE
int InitialisedFromPL =FALSE
int PL_Argc =0
char** PL_Argv =NULL
// halt hooks
struct halt_hook *yap_halt_hook GLOBAL_HaltHooks =NULL
struct halt_hook* HaltHooks =NULL
// stack overflow expansion/gc control
int allow_local_expansion GLOBAL_AllowLocalExpansion =TRUE
int allow_global_expansion GLOBAL_AllowGlobalExpansion =TRUE
int allow_trail_expansion GLOBAL_AllowTrailExpansion =TRUE
UInt size_of_overflow GLOBAL_SizeOfOverflow =0
int AllowLocalExpansion =TRUE
int AllowGlobalExpansion =TRUE
int AllowTrailExpansion =TRUE
UInt SizeOfOverflow =0
// amount of space recovered in all garbage collections
UInt agc_threshold GLOBAL_AGcThreshold =10000
Agc_hook agc_hook GLOBAL_AGCHook =NULL
UInt AGcThreshold =10000
Agc_hook AGCHook =NULL
/* multi-thread support */
#if THREADS
/* number of threads and processes in system */
UInt n_of_threads GLOBAL_NOfThreads =1
UInt NOfThreads =1
/* number of threads created since start */
UInt n_of_threads_created GLOBAL_NOfThreadsCreated =1
UInt NOfThreadsCreated =1
/* total run time for dead threads */
UInt threads_total_time GLOBAL_ThreadsTotalTime =0L
UInt ThreadsTotalTime =0L
// Threads Array
lockvar ThreadHandlesLock MkLock
#endif
// multi-thread/ORP support
#if defined(YAPOR) || defined(THREADS)
// protect long critical regions
lockvar bgl GLOBAL_BGL MkLock
lockvar BGL MkLock
#endif
// Threads Array
#ifdef THREADS
lockvar thread_handles_lock GLOBAL_ThreadHandlesLock MkLock
#endif
#if defined(YAPOR) || defined(TABLING)
struct global_optyap_data optyap_data Yap_optyap_data void
struct global_optyap_data optyap_data void
#endif /* YAPOR || TABLING */
END_GLOBAL_DATA

View File

@ -2,159 +2,148 @@
START_WORKER_LOCAL
// Streams
int c_input_stream LOCAL_c_input_stream =0
int c_output_stream LOCAL_c_output_stream =1
int c_error_stream LOCAL_c_error_stream =2
int c_input_stream =0
int c_output_stream =1
int c_error_stream =2
/* shifts and restore: per local data-structure */
restoreinfo rinfo
. rinfo.old_ASP LOCAL_OldASP =NULL
. rinfo.old_LCL0 LOCAL_OldLCL0 =NULL
. rinfo.old_TR LOCAL_OldTR =NULL
. rinfo.old_GlobalBase LOCAL_OldGlobalBase =NULL
. rinfo.old_H LOCAL_OldH =NULL
. rinfo.old_H0 LOCAL_OldH0 =NULL
. rinfo.old_TrailBase LOCAL_OldTrailBase =NULL
. rinfo.old_TrailTop LOCAL_OldTrailTop =NULL
. rinfo.old_HeapBase LOCAL_OldHeapBase =NULL
. rinfo.old_HeapTop LOCAL_OldHeapTop =NULL
. rinfo.cl_diff LOCAL_ClDiff =0L
. rinfo.g_diff LOCAL_GDiff =0L
. rinfo.h_diff LOCAL_HDiff =0L
. rinfo.g_diff0 LOCAL_GDiff0 =0L
. rinfo.g_split LOCAL_GSplit =NULL
. rinfo.l_diff LOCAL_LDiff =0L
. rinfo.tr_diff LOCAL_TrDiff =0L
. rinfo.x_diff LOCAL_XDiff =0L
. rinfo.delay_diff LOCAL_DelayDiff =0L
. rinfo.base_diff LOCAL_BaseDiff =0L
// Restore info
CELL* OldASP =NULL
CELL* OldLCL0 =NULL
tr_fr_ptr OldTR =NULL
CELL* OldGlobalBase =NULL
CELL* OldH =NULL
CELL* OldH0 =NULL
ADDR OldTrailBase =NULL
ADDR OldTrailTop =NULL
ADDR OldHeapBase =NULL
ADDR OldHeapTop =NULL
Int ClDiff =0L
Int GDiff =0L
Int HDiff =0L
Int GDiff0 =0L
Int GSplit =NULL
Int LDiff =0L
Int TrDiff =0L
Int XDiff =0L
Int DelayDiff =0L
Int BaseDiff =0L
struct reduction_counters call_counters
. call_counters.reductions LOCAL_ReductionsCounter =0L
. call_counters.reductions_retries LOCAL_PredEntriesCounter =0L
. call_counters.retries LOCAL_RetriesCounter =0L
. call_counters.reductions_on LOCAL_ReductionsCounterOn =0L
. call_counters.reductions_retries_on LOCAL_PredEntriesCounterOn =0L
. call_counters.retries_on LOCAL_RetriesCounterOn =0L
int interrupts_disabled LOCAL_InterruptsDisabled =FALSE
// Reduction counters
YAP_ULONG_LONG ReductionsCounter =0L
YAP_ULONG_LONG PredEntriesCounter =0L
YAP_ULONG_LONG RetriesCounter =0L
int ReductionsCounterOn =0L
int PredEntriesCounterOn =0L
int RetriesCounterOn =0L
// support for consulting files
/* current consult stack */
union CONSULT_OBJ* consultsp LOCAL_ConsultSp =NULL
union CONSULT_OBJ* ConsultSp =NULL
/* current maximum number of cells in consult stack */
UInt consultcapacity LOCAL_ConsultCapacity void
UInt ConsultCapacity void
/* top of consult stack */
union CONSULT_OBJ* consultbase LOCAL_ConsultBase =NULL
union CONSULT_OBJ* ConsultBase =NULL
/* low-water mark for consult */
union CONSULT_OBJ* consultlow LOCAL_ConsultLow =NULL
union CONSULT_OBJ* ConsultLow =NULL
//global variables
Term global_arena LOCAL_GlobalArena =0L TermToGlobalOrAtomAdjust
UInt global_arena_overflows LOCAL_GlobalArenaOverflows =0L
Int arena_overflows LOCAL_ArenaOverflows =0L
Int depth_arenas LOCAL_DepthArenas =0
Term GlobalArena =0L TermToGlobalOrAtomAdjust
UInt GlobalArenaOverflows =0L
Int ArenaOverflows =0L
Int DepthArenas =0
int arith_error LOCAL_ArithError =FALSE
struct pred_entry* last_asserted_pred LOCAL_LastAssertedPred =NULL
int debug_on LOCAL_DebugOn =FALSE
char* scanner_stack LOCAL_ScannerStack =NULL
struct scanner_extra_alloc* scanner_extra_blocks LOCAL_ScannerExtraBlocks =NULL
struct DB_TERM* ball_term LOCAL_BallTerm =NULL RestoreBallTerm(wid)
UInt active_signals LOCAL_ActiveSignals =0L
UInt i_pred_arity LOCAL_IPredArity =0L
yamop* prof_end LOCAL_ProfEnd =NULL
int uncaught_throw LOCAL_UncaughtThrow =FALSE
int doing_undefp LOCAL_DoingUndefp =FALSE
Int start_line LOCAL_StartLine =0L
scratch_block scratchpad LOCAL_ScratchPad InitScratchPad(wid)
int ArithError =FALSE
struct pred_entry* LastAssertedPred =NULL
int DebugOn =FALSE
char* ScannerStack =NULL
struct scanner_extra_alloc* ScannerExtraBlocks =NULL
struct DB_TERM* BallTerm =NULL RestoreBallTerm(wid)
UInt ActiveSignals =0L
UInt IPredArity =0L
yamop* ProfEnd =NULL
int UncaughtThrow =FALSE
int DoingUndefp =FALSE
Int StartLine =0L
scratch_block ScratchPad InitScratchPad(wid)
#ifdef COROUTINING
Term woken_goals LOCAL_WokenGoals =0L TermToGlobalAdjust
Term atts_mutable_list LOCAL_AttsMutableList =0L TermToGlobalAdjust
Term WokenGoals =0L TermToGlobalAdjust
Term AttsMutableList =0L TermToGlobalAdjust
#endif
// gc_stuff
Term gc_generation LOCAL_GcGeneration =0L TermToGlobalAdjust
Term gc_phase LOCAL_GcPhase =0L TermToGlobalAdjust
UInt gc_current_phase LOCAL_GcCurrentPhase =0L
UInt gc_calls LOCAL_GcCalls =0L
Int tot_gc_time LOCAL_TotGcTime =0L
YAP_ULONG_LONG tot_gc_recovered LOCAL_TotGcRecovered =0L
Int last_gc_time LOCAL_LastGcTime =0L
Int last_ss_time LOCAL_LastSSTime =0L
Term GcGeneration =0L TermToGlobalAdjust
Term GcPhase =0L TermToGlobalAdjust
UInt GcCurrentPhase =0L
UInt GcCalls =0L
Int TotGcTime =0L
YAP_ULONG_LONG TotGcRecovered =0L
Int LastGcTime =0L
Int LastSSTime =0L
#if LOW_LEVEL_TRACER
Int total_cps LOCAL_total_choicepoints =0
#endif
int consult_level_ LOCAL_consult_level =0
#if defined(YAPOR) || defined(THREADS)
lockvar signal_lock LOCAL_SignalLock MkLock
#endif
/* in a single gc */
Int tot_marked LOCAL_total_marked =0L
Int tot_oldies LOCAL_total_oldies =0L
struct choicept* wl_current_B LOCAL_current_B =NULL
CELL* wl_prev_HB LOCAL_prev_HB =NULL
CELL* hgen LOCAL_HGEN =NULL
CELL** ip_top LOCAL_iptop =NULL
//#endif
Int total_marked =0L
Int total_oldies =0L
struct choicept* current_B =NULL
CELL* prev_HB =NULL
CELL* HGEN =NULL
CELL** iptop =NULL
#if defined(GC_NO_TAGS)
char* b_p LOCAL_bp =NULL
char* bp =NULL
#endif
tr_fr_ptr wl_sTR LOCAL_sTR =NULL
tr_fr_ptr wl_sTR0 LOCAL_sTR0 =NULL
tr_fr_ptr new_tr LOCAL_new_TR =NULL
struct gc_mark_continuation* conttop0 LOCAL_cont_top0 =NULL
struct gc_mark_continuation* conttop LOCAL_cont_top =NULL
int disc_trail_entries LOCAL_discard_trail_entries =0
gc_ma_hash_entry Gc_ma_hash_table[GC_MAVARS_HASH_SIZE] LOCAL_gc_ma_hash_table void
gc_ma_hash_entry* Gc_ma_h_top LOCAL_gc_ma_h_top =NULL
gc_ma_hash_entry* Gc_ma_h_list LOCAL_gc_ma_h_list =NULL
UInt Gc_timestamp LOCAL_gc_timestamp =0L
ADDR DB_vec LOCAL_db_vec =NULL
ADDR DB_vec0 LOCAL_db_vec0 =NULL
struct RB_red_blk_node* DB_root LOCAL_db_root =NULL
struct RB_red_blk_node* DB_nil LOCAL_db_nil =NULL
tr_fr_ptr sTR =NULL
tr_fr_ptr sTR0 =NULL
tr_fr_ptr new_TR =NULL
struct gc_mark_continuation* cont_top0 =NULL
struct gc_mark_continuation* cont_top =NULL
int discard_trail_entries =0
gc_ma_hash_entry gc_ma_hash_table[GC_MAVARS_HASH_SIZE] void
gc_ma_hash_entry* gc_ma_h_top =NULL
gc_ma_hash_entry* gc_ma_h_list =NULL
UInt gc_timestamp =0L
ADDR db_vec =NULL
ADDR db_vec0 =NULL
struct RB_red_blk_node* db_root =NULL
struct RB_red_blk_node* db_nil =NULL
sigjmp_buf gc_restore LOCAL_gc_restore void
struct array_entry* dynamic_arrays LOCAL_DynamicArrays =NULL PtoArrayEAdjust
struct static_array_entry* static_arrays LOCAL_StaticArrays =NULL PtoArraySAdjust
struct global_entry* global_variables LOCAL_GlobalVariables =NULL PtoGlobalEAdjust
int allow_restart LOCAL_AllowRestart =FALSE
sigjmp_buf gc_restore void
struct array_entry* DynamicArrays =NULL PtoArrayEAdjust
struct static_array_entry* StaticArrays =NULL PtoArraySAdjust
struct global_entry* GlobalVariables =NULL PtoGlobalEAdjust
int AllowRestart =FALSE
// Thread Local Area for Fast Storage of Intermediate Compiled Code.
struct mem_blk* cmem_first_block LOCAL_CMemFirstBlock =NULL
UInt cmem_first_block_sz LOCAL_CMemFirstBlockSz =0L
// Thread Local Area for Fast Storage of Intermediate Compiled Code
struct mem_blk* CMemFirstBlock =NULL
UInt CMemFirstBlockSz =0L
// Thread Local Area for Labels.
Int* label_first_array LOCAL_LabelFirstArray =NULL
UInt label_first_array_sz LOCAL_LabelFirstArraySz =0L
// Thread Local Area for Labels
Int* LabelFirstArray =NULL
UInt LabelFirstArraySz =0L
// Thread Local Area for SWI-Prolog emulation routines.
struct PL_local_data* Yap_ld_ LOCAL_PL_local_data_p =Yap_InitThreadIO(wid)
struct open_query_struct* _execution LOCAL_execution =NULL
struct PL_local_data* PL_local_data_p =Yap_InitThreadIO(wid)
#ifdef THREADS
struct thandle thread_handle LOCAL_ThreadHandle InitThreadHandle(wid)
struct thandle ThreadHandle InitThreadHandle(wid)
#endif /* THREADS */
#if defined(YAPOR) || defined(TABLING)
struct local_optyap_data optyap_data LOCAL_optyap_data Yap_init_local_optyap_data(wid)
struct local_optyap_data optyap_data Yap_init_local_optyap_data(wid)
#endif /* YAPOR || TABLING */
int InterruptsDisabled =FALSE
// defines
#define REMOTE_ThreadHandle(wid) (REMOTE(wid)->thread_handle)
#define REMOTE_c_input_stream(wid) (REMOTE(wid)->c_input_stream)
#define REMOTE_c_output_stream(wid) (REMOTE(wid)->c_output_stream)
#define REMOTE_c_error_stream(wid) (REMOTE(wid)->c_error_stream)
#define REMOTE_ActiveSignals(wid) (REMOTE(wid)->active_signals)
#define REMOTE_SignalLock(wid) (REMOTE(wid)->signal_lock)
#define REMOTE_ScratchPad(wid) (REMOTE(wid)->scratchpad)
struct open_query_struct* execution =NULL
#if LOW_LEVEL_TRACER
Int total_choicepoints =0
#endif
int consult_level =0
#if defined(YAPOR) || defined(THREADS)
lockvar SignalLock MkLock
#endif
// END WORKER LOCAL STUFF
END_WORKER_LOCAL

View File

@ -21,15 +21,15 @@ main :-
file_filter_with_init('misc/HEAPFIELDS','H/hstruct.h',gen_struct,Warning,['hstruct.h','HEAPFIELDS']),
file_filter_with_init('misc/HEAPFIELDS','H/dhstruct.h',gen_dstruct,Warning,['dhstruct.h','HEAPFIELDS']),
file_filter_with_init('misc/HEAPFIELDS','H/rhstruct.h',gen_hstruct,Warning,['rhstruct.h','HEAPFIELDS']),
file_filter_with_init('misc/HEAPFIELDS','H/ihstruct.h',gen_init,Warning,['ihstruct.h','HEAPFIELDS']),
file_filter_with_init('misc/GLOBALS','H/hglobals.h',gen_struct,Warning,['hglobals.h','GLOBALS']),
file_filter_with_init('misc/GLOBALS','H/dglobals.h',gen_dstruct,Warning,['dglobals.h','GLOBALS']),
file_filter_with_init('misc/GLOBALS','H/rglobals.h',gen_hstruct,Warning,['rglobals.h','GLOBALS']),
file_filter_with_init('misc/GLOBALS','H/iglobals.h',gen_init,Warning,['iglobals.h','GLOBALS']),
file_filter_with_init('misc/LOCALS','H/hlocals.h',gen_struct,Warning,['hlocals.h','LOCALS']),
file_filter_with_init('misc/LOCALS','H/dlocals.h',gen_dstruct,Warning,['dlocals.h','LOCALS']),
file_filter_with_init('misc/LOCALS','H/rlocals.h',gen_hstruct,Warning,['rlocals.h','LOCALS']),
file_filter_with_init('misc/LOCALS','H/ilocals.h',gen_init,Warning,['ilocals.h','LOCALS']).
file_filter_with_init('misc/HEAPFIELDS','H/ihstruct.h',gen_init,Warning,['ihstruct.h','HEAPFIELDS']).
%file_filter_with_init('misc/GLOBALS','H/hglobals.h',gen_struct,Warning,['hglobals.h','GLOBALS']),
%file_filter_with_init('misc/GLOBALS','H/dglobals.h',gen_dstruct,Warning,['dglobals.h','GLOBALS']),
%file_filter_with_init('misc/GLOBALS','H/rglobals.h',gen_hstruct,Warning,['rglobals.h','GLOBALS']),
%file_filter_with_init('misc/GLOBALS','H/iglobals.h',gen_init,Warning,['iglobals.h','GLOBALS']),
%file_filter_with_init('misc/LOCALS','H/hlocals.h',gen_struct,Warning,['hlocals.h','LOCALS']),
%file_filter_with_init('misc/LOCALS','H/dlocals.h',gen_dstruct,Warning,['dlocals.h','LOCALS']),
%file_filter_with_init('misc/LOCALS','H/rlocals.h',gen_hstruct,Warning,['rlocals.h','LOCALS']),
%file_filter_with_init('misc/LOCALS','H/ilocals.h',gen_init,Warning,['ilocals.h','LOCALS']).
warning('~n /* This file, ~a, was generated automatically by \"yap -L misc/buildheap\"~n please do not update, update misc/~a instead */~n~n').

345
misc/buildlocalglobal Normal file
View File

@ -0,0 +1,345 @@
:- use_module(library(lineutils),
[file_filter_with_init/5,
split/3,
glue/3]).
:- use_module(library(lists),
[append/2,
append/3]).
:- initialization(main).
:- dynamic globals/1.
:- yap_flag(write_strings,on).
:- style_check(all).
main :-
warning(Warning),
%file_filter_with_init('misc/HEAPFIELDS','H/hstruct.h',gen_struct,Warning,['hstruct.h','HEAPFIELDS']),
%file_filter_with_init('misc/HEAPFIELDS','H/dhstruct.h',gen_dstruct,Warning,['dhstruct.h','HEAPFIELDS']),
%file_filter_with_init('misc/HEAPFIELDS','H/rhstruct.h',gen_hstruct,Warning,['rhstruct.h','HEAPFIELDS']),
%file_filter_with_init('misc/HEAPFIELDS','H/ihstruct.h',gen_init,Warning,['ihstruct.h','HEAPFIELDS']),
file_filter_with_init('misc/GLOBALS','H/hglobals.h',gen_struct,Warning,['hglobals.h','GLOBALS']),
file_filter_with_init('misc/GLOBALS','H/dglobals.h',gen_dstruct,Warning,['dglobals.h','GLOBALS']),
file_filter_with_init('misc/GLOBALS','H/rglobals.h',gen_hstruct,Warning,['rglobals.h','GLOBALS']),
file_filter_with_init('misc/GLOBALS','H/iglobals.h',gen_init,Warning,['iglobals.h','GLOBALS']),
file_filter_with_init('misc/LOCALS','H/hlocals.h',gen_struct,Warning,['hlocals.h','LOCALS']),
file_filter_with_init('misc/LOCALS','H/dlocals.h',gen_dstruct,Warning,['dlocals.h','LOCALS']),
file_filter_with_init('misc/LOCALS','H/rlocals.h',gen_hstruct,Warning,['rlocals.h','LOCALS']),
file_filter_with_init('misc/LOCALS','H/ilocals.h',gen_init,Warning,['ilocals.h','LOCALS']).
warning('~n /* This file, ~a, was generated automatically by \"yap -L misc/buildlocalglobal\"~n please do not update, update misc/~a instead */~n~n').
/* define the field */
gen_struct(Inp,"") :-
Inp = [0'/,0'/|_], !.
gen_struct(Inp,"") :-
Inp = [0'/,0'*|_], !.
gen_struct(Inp, Out) :-
Inp = [0'#|_], !, Out = Inp. % '
gen_struct(Inp,"") :-
Inp = [0'.|_], !. %'
gen_struct(Inp,Out) :-
Inp = "START_WORKER_LOCAL", !,
Out = "typedef struct worker_local {".
gen_struct(Inp,Out) :-
Inp = "END_WORKER_LOCAL", !,
Out = "} w_local;".
gen_struct(Inp,Out) :-
Inp = "START_GLOBAL_DATA", !,
Out = "typedef struct global_data {".
gen_struct(Inp,Out) :-
Inp = "END_GLOBAL_DATA", !,
Out = "} w_shared;".
gen_struct(Inp,Out) :-
Inp = "ATOMS", !,
Out = "#include \"tatoms.h\"".
gen_struct(Inp,Out) :-
split(Inp," ",["struct",Type, Field|_]), !,
append([" struct ",Type," ",Field,"_",";"], Out).
gen_struct(Inp,Out) :-
split(Inp," ",["union",Type, Field|_]), !,
append([" union ",Type," ",Field,"_",";"], Out).
gen_struct(Inp,"") :-
split(Inp," ",["void","void"|_]), !.
gen_struct(Inp,Out) :-
split(Inp," ",[Type, Field|_]),
split(Field,"[",[RField,VECField]), !,
append([" ",Type," ",RField,"_","[",VECField,";"], Out).
gen_struct(Inp,Out) :-
split(Inp," ",[Type, Field|_]), !,
append([" ",Type," ",Field,"_",";"], Out).
gen_struct(Inp,_) :-
split(Inp," ",[_, _, _| _]),
format(user_error,"OOPS: could not gen_struct for ~s~n",[Inp]).
gen_dstruct(Inp,"") :-
Inp = [0'/,0'/|_], !.
gen_dstruct(Inp,"") :-
Inp = [0'/,0'*|_], !.
gen_dstruct(Inp, Out) :-
Inp = [0'#|_], !, Out = Inp. % '
gen_dstruct(Inp,"") :-
Inp = "START_WORKER_LOCAL", !,
assert(globals(worker)).
gen_dstruct(Inp,"") :-
Inp = "END_WORKER_LOCAL", !,
retract(globals(worker)).
gen_dstruct(Inp,"") :-
Inp = "START_GLOBAL_DATA", !,
assert(globals(all)).
gen_dstruct(Inp,"") :-
Inp = "END_GLOBAL_DATA", !,
retract(globals(all)).
gen_dstruct(Inp,Out) :-
Inp = "ATOMS", !,
Out = "".
gen_dstruct(Inp,"") :-
split(Inp," ",["void","void"|_]), !.
gen_dstruct(Inp,Out) :-
split(Inp," ",["struct"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_dstruct(Inp3, Out).
gen_dstruct(Inp,Out) :-
split(Inp," ",["union"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_dstruct(Inp3, Out).
gen_dstruct(Inp,Out) :-
split(Inp," ",[".", Field,_|_]), !,
cut_c_stuff(Field, RField),
split(RField,".",[_,MField]),
fetch_name(Global,Global2,RField,MField),
append(["#define ",Global," ",Global2], Out).
gen_dstruct(Inp,Out) :-
split(Inp," ",[_, Field,_|_]), !,
cut_c_stuff(Field, RField),
fetch_name(Global,Global2,RField," "),
append(["#define ",Global," ",Global2], Out).
gen_dstruct(Inp,_) :-
split(Inp," ",[_, _, _| _]),
format(user_error,"OOPS: could not gen_dstruct for ~s~n",[Inp]).
fetch_name(Global,Global2,RField," ") :-
globals(all), !,
append(["GLOBAL_", RField],Global),
append(["Yap_global->", RField,"_"],Global2).
fetch_name(Global,Global2,RField," ") :-
globals(worker),
append(["LOCAL_", RField],Global),
append(["LOCAL->", RField,"_"],Global2).
fetch_name(Global,Global2,RField," ") :-
globals(worker), !,
append(["REMOTE_", RField,"(wid)"],Global),
append(["REMOTE(wid)->", RField,"_"],Global2).
fetch_name(Global,Global2,RField,MField) :-
globals(worker),
append(["REMOTE_", MField,"(wid)"],Global),
append(["REMOTE(wid)->", RField],Global2).
fetch_name(Global,Global2,RField,MField) :-
globals(worker),!,
append(["LOCAL_", MField],Global),
append(["LOCAL->", RField],Global2).
fetch_name(Global, RField) :-
globals(worker_init), !,
append(["REMOTE_", RField,"(wid)"],Global).
fetch_name(Global, RField) :-
globals(all), !,
append(["GLOBAL_", RField],Global).
% handle *field[4]
cut_c_stuff([0'*|Name], RName) :- !, % 'cut *
cut_c_stuff(Name, RName).
cut_c_stuff(Name, RName) :-
cut_mat(Name, RName).
cut_mat([], []).
cut_mat([0'[|_], []) :- !. %'
cut_mat(H.Name, H.RName) :-
cut_mat(Name, RName).
gen_hstruct(Inp,"") :-
Inp = [0'/,0'/|_], !.
gen_hstruct(Inp,"") :-
Inp = [0'.|_], !. %'
gen_hstruct(Inp,"") :-
Inp = [0'/,0'*|_], !.
gen_hstruct(Inp,Out) :-
Inp = "ATOMS", !,
Out = "#include \"ratoms.h\"".
gen_hstruct(Inp,Out) :-
Inp = "START_WORKER_LOCAL", !,
Out = "static void RestoreWorker(int wid USES_REGS) {",
assert(globals(worker_init)).
gen_hstruct(Inp,Out) :-
Inp = "END_WORKER_LOCAL", !,
Out = "}",
retract(globals(worker_init)).
gen_hstruct(Inp,Out) :-
Inp = "START_GLOBAL_DATA", !,
Out = "static void RestoreGlobal(void) {",
assert(globals(all)).
gen_hstruct(Inp,Out) :-
Inp = "END_GLOBAL_DATA", !,
Out = "}",
retract(globals(all)).
gen_hstruct(Inp, Out) :-
Inp = [0'#|_], !, Out = Inp. % '
gen_hstruct(Inp,Out) :-
split(Inp," ",["struct"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_hstruct(Inp3,Out).
gen_hstruct(Inp,Out) :-
split(Inp," ",["union"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_hstruct(Inp3,Out).
gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, "MkAT", _]), !,
fetch_name(Global,Field),
append([" ",Global,Field," = AtomTermAdjust(Yap_heap_regs->",Field,");"], Out).
gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, "MkPred"| _]), !,
cut_c_stuff(Field, RField),
fetch_name(Global,RField),
append([" ",Global,RField," = PtoPredAdjust(Yap_heap_regs->",RField,");"], Out).
gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, "MkOp", Name]), !,
fetch_name(Global,Field),
append([" ",Global,Field," = Yap_opcode(",Name,");"], Out).
gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, "MkLock"]), !,
fetch_name(Global,Field),
append([" REINIT_LOCK(",Global,");"], Out).
gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field,"MkRWLock"]), !,
fetch_name(Global,Field),
append([" REINIT_RWLOCK(",Global,Field,");"], Out).
gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field,"MkInstE",OP]), !,
cut_c_stuff(Field, RField),
fetch_name(Global,RField),
append([" ",Global,RField,"->opc = Yap_opcode(",OP,");"], Out).
gen_hstruct(Inp,"") :-
split(Inp," ",[_, _, _]), !.
gen_hstruct(Inp,"") :-
split(Inp," ",[_, _, _, "void"]), !.
gen_hstruct(Inp,Restore) :-
split(Inp," ",[_, _, _, Restore0]),
append("Restore",_,Restore0), !,
append([" ",Restore0,";"],Restore). %'
gen_hstruct(Inp,Out) :-
split(Inp," ",[_, Field, _, Adjust]),
append(Adjust,"Adjust",_), !,
cut_c_stuff(Field, RField),
fetch_name(Global,RField),
append([" ",Global," = ",Adjust,"(",Global,");"], Out).
gen_hstruct(Inp,_) :-
split(Inp," ",[_, _, _| _]),
format(user_error,"OOPS: could not gen_hstruct for ~s~n",[Inp]).
gen_init(Inp,"") :-
Inp = [0'/,0'*|_], !.
gen_init(Inp,"") :-
Inp = [0'/,0'/|_], !.
gen_init(Inp, Out) :-
Inp = [0'#|_], !, Out = Inp. % '
gen_init(Inp,Out) :-
Inp = "ATOMS", !,
Out = "#include \"iatoms.h\"".
gen_init(Inp,Out) :-
Inp = "START_WORKER_LOCAL", !,
Out = "static void InitWorker(int wid) {",
assert(globals(worker_init)).
gen_init(Inp,Out) :-
Inp = "END_WORKER_LOCAL", !,
Out = "}",
retract(globals(worker_init)).
gen_init(Inp,Out) :-
Inp = "START_GLOBAL_DATA", !,
Out = "static void InitGlobal(void) {",
assert(globals(all)).
gen_init(Inp,Out) :-
Inp = "END_GLOBAL_DATA", !,
Out = "}",
retract(globals(all)).
gen_init(Inp,Out) :-
split(Inp," ",["struct"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_init(Inp3, Out).
gen_init(Inp,Out) :-
split(Inp," ",["union"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_init(Inp3, Out).
gen_init(Inp,"") :-
split(Inp," ",[_, _, "void"|_]), !.
gen_init(Inp,Init) :-
split(Inp," ",[_, _, Init0| _]),
append("Init",_,Init0), !,
append([" ",Init0,";"],Init).
gen_init(Inp,Init) :-
split(Inp," ",[_, _, Init0| _]),
append("Yap_Init",_,Init0), !,
append([" ",Init0,";"],Init).
gen_init(Inp,Init) :-
split(Inp," ",[_, _, Init0| _]),
append("Yap_init",_,Init0), !,
append([" ",Init0,";"],Init).
gen_init(Inp,Out) :-
split(Inp," ",[_, Field, "MkAT", AtomName]), !,
cut_c_stuff(Field, RField),
fetch_name(Global,RField),
append([" ",Global," = MkAtomTerm(",AtomName,");"], Out).
gen_init(Inp,Out) :-
split(Inp," ",[_, Field, "MkOp", Name]), !,
fetch_name(Global,Field),
append([" ",Global," = Yap_opcode(",Name,");"], Out).
gen_init(Inp,Out) :-
split(Inp," ",[_, Field, "MkLock"]), !,
fetch_name(Global,Field),
append([" INIT_LOCK(",Global,");"], Out).
gen_init(Inp,Out) :-
split(Inp," ",[_, Field, "MkRWLock"]), !,
fetch_name(Global,Field),
append([" INIT_RWLOCK(",Global,");"], Out).
gen_init(Inp,Out) :-
split(Inp," ",[_, Field, "MkInstE",OP]), !,
cut_c_stuff(Field, RField),
fetch_name(Global,RField),
append([" ",Global,"->opc = Yap_opcode(",OP,");"], Out).
gen_init(Inp,Out) :-
split(Inp," ",[_, Field, "MkPred", Atom, "0", Module]), !,
cut_c_stuff(Field, RField),
fetch_name(Global,RField),
append([" ",Global," = RepPredProp(PredPropByAtom(",Atom,",",Module,"));"], Out).
gen_init(Inp,Out) :-
split(Inp," ",[_, Field, "MkPred", Atom, Arity, Module]), !,
cut_c_stuff(Field, RField),
fetch_name(Global,RField),
append([" ",Global," = RepPredProp(PredPropByFunc(Yap_MkFunctor(",Atom,",",Arity,"),",Module,"));"], Out).
gen_init(Inp,Out) :-
split(Inp," ",[_, Field, "MkPred", Fun, Module]), !,
cut_c_stuff(Field, RField),
fetch_name(Global,RField),
append([" ",Global," = RepPredProp(PredPropByFunc(",Fun,",",Module,"));"], Out).
gen_init(Inp,Out) :-
split(Inp," ",[".", Field,F0|_]), !,
cut_c_stuff(Field, RField),
split(RField,".",[_,MField]),
append("=",F,F0), !,
fetch_name(Global,MField),
append([" ",Global," = ",F,";"], Out).
gen_init(Inp,Out) :-
split(Inp," ",[_, Field, F0|_]),
append("=",F,F0), !,
cut_c_stuff(Field, RField),
fetch_name(Global,RField),
append([" ",Global," = ",F,";"], Out).
gen_init(Inp,_) :-
split(Inp," ",[_, _, _| _]),
format(user_error,"OOPS: could not gen_init for ~s~n",[Inp]).

View File

@ -4740,7 +4740,7 @@ struct PL_local_data *Yap_InitThreadIO(int wid)
#if THREADS
if (wid) {
/* copy from other worker */
memcpy(p, Yap_local[worker_id]->Yap_ld_, sizeof(struct PL_local_data));
memcpy(p, Yap_local[worker_id]->PL_local_data_p_, sizeof(struct PL_local_data));
}
#endif
return p;