2011-03-24 10:25:02 +00:00
|
|
|
// Stuff that must be considered local to a thread or worker
|
|
|
|
START_WORKER_LOCAL
|
|
|
|
|
|
|
|
// Streams
|
2011-05-25 16:40:36 +01:00
|
|
|
int c_input_stream =0
|
|
|
|
int c_output_stream =1
|
|
|
|
int c_error_stream =2
|
2011-05-11 18:22:58 +01:00
|
|
|
|
2015-06-19 00:56:24 +01:00
|
|
|
bool sockets_io =false
|
|
|
|
|
2015-07-06 12:04:42 +01:00
|
|
|
bool within_print_message =false
|
|
|
|
|
2015-06-19 00:56:24 +01:00
|
|
|
//
|
2016-06-17 16:42:26 +01:00
|
|
|
|
2015-06-19 00:56:24 +01:00
|
|
|
// Used by the prompts to check if they are after a newline, and then a
|
|
|
|
// prompt should be output, or if we are in the middle of a line.
|
|
|
|
//
|
|
|
|
bool newline =true
|
|
|
|
|
|
|
|
Atom AtPrompt =AtomNil
|
|
|
|
char Prompt[MAX_PROMPT+1] void
|
|
|
|
|
2015-10-08 02:23:45 +01:00
|
|
|
encoding_t encoding =Yap_DefaultEncoding()
|
2015-06-19 00:56:24 +01:00
|
|
|
bool quasi_quotations =false
|
|
|
|
UInt default_priority =1200
|
|
|
|
|
|
|
|
bool eot_before_eof =false
|
|
|
|
UInt max_depth =0
|
|
|
|
UInt max_list =0
|
|
|
|
UInt max_write_args =0
|
|
|
|
|
|
|
|
|
2011-05-11 18:22:58 +01:00
|
|
|
// Restore info
|
2011-05-25 16:40:36 +01:00
|
|
|
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
|
|
|
|
CELL* GSplit =NULL
|
|
|
|
Int LDiff =0L
|
|
|
|
Int TrDiff =0L
|
|
|
|
Int XDiff =0L
|
|
|
|
Int DelayDiff =0L
|
|
|
|
Int BaseDiff =0L
|
2011-05-11 18:22:58 +01:00
|
|
|
|
|
|
|
// Reduction counters
|
2011-05-25 16:40:36 +01:00
|
|
|
YAP_ULONG_LONG ReductionsCounter =0L
|
|
|
|
YAP_ULONG_LONG PredEntriesCounter =0L
|
|
|
|
YAP_ULONG_LONG RetriesCounter =0L
|
|
|
|
int ReductionsCounterOn =0L
|
|
|
|
int PredEntriesCounterOn =0L
|
|
|
|
int RetriesCounterOn =0L
|
2011-03-24 10:25:02 +00:00
|
|
|
|
|
|
|
// support for consulting files
|
|
|
|
/* current consult stack */
|
2011-05-25 16:40:36 +01:00
|
|
|
union CONSULT_OBJ* ConsultSp =NULL
|
2011-03-24 10:25:02 +00:00
|
|
|
/* current maximum number of cells in consult stack */
|
2011-05-25 16:40:36 +01:00
|
|
|
UInt ConsultCapacity void
|
2011-03-24 10:25:02 +00:00
|
|
|
/* top of consult stack */
|
2011-05-25 16:40:36 +01:00
|
|
|
union CONSULT_OBJ* ConsultBase =NULL
|
2011-03-24 10:25:02 +00:00
|
|
|
/* low-water mark for consult */
|
2011-05-25 16:40:36 +01:00
|
|
|
union CONSULT_OBJ* ConsultLow =NULL
|
2015-03-04 09:46:55 +00:00
|
|
|
Term VarNames =((Term)0)
|
2015-06-19 00:56:24 +01:00
|
|
|
Atom SourceFileName =NULL
|
|
|
|
UInt SourceFileLineno =0
|
2011-03-24 10:25:02 +00:00
|
|
|
|
|
|
|
//global variables
|
2011-05-25 16:40:36 +01:00
|
|
|
Term GlobalArena =0L TermToGlobalOrAtomAdjust
|
|
|
|
UInt GlobalArenaOverflows =0L
|
|
|
|
Int ArenaOverflows =0L
|
|
|
|
Int DepthArenas =0
|
|
|
|
|
|
|
|
int ArithError =FALSE
|
2016-03-29 02:02:43 +01:00
|
|
|
struct pred_entry* LastAssertedPred =NULL
|
|
|
|
struct pred_entry* TmpPred =NULL
|
|
|
|
char* ScannerStack =NULL
|
|
|
|
struct scanner_extra_alloc* ScannerExtraBlocks =NULL
|
|
|
|
|
|
|
|
/// worker control information
|
|
|
|
/// pointer to an exception term, from throw
|
2011-05-25 16:40:36 +01:00
|
|
|
struct DB_TERM* BallTerm =NULL RestoreBallTerm(wid)
|
2016-03-29 02:02:43 +01:00
|
|
|
/// stack limit after which the stack is managed by C-code.
|
|
|
|
Int CBorder =0
|
|
|
|
|
|
|
|
|
|
|
|
/// max number of signals (uint64_t)
|
2014-03-06 02:09:48 +00:00
|
|
|
UInt MaxActiveSignals =64L
|
2016-03-29 02:02:43 +01:00
|
|
|
/// actual life signals
|
2015-06-19 00:56:24 +01:00
|
|
|
uint64_t Signals =0L
|
2016-03-29 02:02:43 +01:00
|
|
|
/// indexing help data?
|
2011-05-25 16:40:36 +01:00
|
|
|
UInt IPredArity =0L
|
|
|
|
yamop* ProfEnd =NULL
|
|
|
|
int DoingUndefp =FALSE
|
2015-07-06 12:04:42 +01:00
|
|
|
Int StartCharCount =0L
|
|
|
|
Int StartLineCount =0L
|
|
|
|
Int StartLinePos =0L
|
2011-05-25 16:40:36 +01:00
|
|
|
scratch_block ScratchPad InitScratchPad(wid)
|
2011-03-24 10:25:02 +00:00
|
|
|
#ifdef COROUTINING
|
2011-05-25 16:40:36 +01:00
|
|
|
Term WokenGoals =0L TermToGlobalAdjust
|
|
|
|
Term AttsMutableList =0L TermToGlobalAdjust
|
2011-03-24 10:25:02 +00:00
|
|
|
#endif
|
|
|
|
|
2016-02-29 03:13:23 +00:00
|
|
|
|
|
|
|
|
2011-03-24 10:25:02 +00:00
|
|
|
// gc_stuff
|
2011-05-25 16:40:36 +01:00
|
|
|
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
|
2011-12-30 16:04:16 +00:00
|
|
|
CELL* OpenArray =NULL
|
2011-03-24 10:25:02 +00:00
|
|
|
|
2011-05-05 17:41:05 +01:00
|
|
|
/* in a single gc */
|
2011-05-25 16:40:36 +01:00
|
|
|
Int total_marked =0L
|
|
|
|
Int total_oldies =0L
|
|
|
|
struct choicept* current_B =NULL
|
|
|
|
CELL* prev_HB =NULL
|
|
|
|
CELL* HGEN =NULL
|
|
|
|
CELL** iptop =NULL
|
2011-05-11 18:22:58 +01:00
|
|
|
|
2011-05-05 17:41:05 +01:00
|
|
|
#if defined(GC_NO_TAGS)
|
2011-05-25 16:40:36 +01:00
|
|
|
char* bp =NULL
|
2011-03-24 10:25:02 +00:00
|
|
|
#endif
|
2011-05-25 16:40:36 +01:00
|
|
|
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 void
|
2011-12-13 10:01:51 +00:00
|
|
|
CELL* extra_gc_cells void
|
|
|
|
CELL* extra_gc_cells_base void
|
|
|
|
CELL* extra_gc_cells_top void
|
|
|
|
UInt extra_gc_cells_size =256
|
2011-05-25 16:40:36 +01:00
|
|
|
struct array_entry* DynamicArrays =NULL PtoArrayEAdjust
|
|
|
|
struct static_array_entry* StaticArrays =NULL PtoArraySAdjust
|
|
|
|
struct global_entry* GlobalVariables =NULL PtoGlobalEAdjust
|
|
|
|
int AllowRestart =FALSE
|
2015-07-06 12:04:42 +01:00
|
|
|
|
2011-05-11 18:22:58 +01:00
|
|
|
// Thread Local Area for Fast Storage of Intermediate Compiled Code
|
2011-05-25 16:40:36 +01:00
|
|
|
struct mem_blk* CMemFirstBlock =NULL
|
|
|
|
UInt CMemFirstBlockSz =0L
|
2011-05-11 18:22:58 +01:00
|
|
|
|
2012-02-06 15:11:50 +00:00
|
|
|
// Variable used by the compiler to store number of permanent vars in a clause
|
|
|
|
int nperm =0L
|
|
|
|
|
2011-05-11 18:22:58 +01:00
|
|
|
// Thread Local Area for Labels
|
2011-05-25 16:40:36 +01:00
|
|
|
Int* LabelFirstArray =NULL
|
|
|
|
UInt LabelFirstArraySz =0L
|
2011-03-24 10:25:02 +00:00
|
|
|
|
|
|
|
// Thread Local Area for SWI-Prolog emulation routines.
|
2015-06-19 00:56:24 +01:00
|
|
|
// struct PL_local_data* PL_local_data_p =Yap_InitThreadIO(wid)
|
2011-03-24 10:25:02 +00:00
|
|
|
|
|
|
|
#ifdef THREADS
|
2011-05-25 16:40:36 +01:00
|
|
|
struct thandle ThreadHandle InitThreadHandle(wid)
|
2011-05-09 19:55:06 +01:00
|
|
|
#endif /* THREADS */
|
2011-03-24 10:25:02 +00:00
|
|
|
|
2011-05-09 19:36:51 +01:00
|
|
|
#if defined(YAPOR) || defined(TABLING)
|
2011-05-25 16:40:36 +01:00
|
|
|
struct local_optyap_data optyap_data Yap_init_local_optyap_data(wid)
|
2015-06-19 00:56:24 +01:00
|
|
|
UInt TabMode =0L
|
2011-05-09 19:36:51 +01:00
|
|
|
#endif /* YAPOR || TABLING */
|
|
|
|
|
2011-05-25 16:40:36 +01:00
|
|
|
int InterruptsDisabled =FALSE
|
2011-05-09 20:19:49 +01:00
|
|
|
|
2011-05-25 16:40:36 +01:00
|
|
|
struct open_query_struct* execution =NULL
|
2011-05-11 18:22:58 +01:00
|
|
|
|
|
|
|
#if LOW_LEVEL_TRACER
|
2011-05-25 16:40:36 +01:00
|
|
|
Int total_choicepoints =0
|
2011-05-11 18:22:58 +01:00
|
|
|
#endif
|
|
|
|
|
2011-05-25 16:40:36 +01:00
|
|
|
int consult_level =0
|
2011-05-11 18:22:58 +01:00
|
|
|
|
2011-05-23 16:19:47 +01:00
|
|
|
// Variables related to memory allocation
|
2011-05-26 15:02:00 +01:00
|
|
|
ADDR LocalBase void
|
|
|
|
ADDR GlobalBase void
|
|
|
|
ADDR TrailBase void
|
|
|
|
ADDR TrailTop void
|
|
|
|
char* ErrorMessage void
|
|
|
|
Term Error_Term void
|
|
|
|
yap_error_number Error_TYPE void
|
2015-09-29 23:43:02 +01:00
|
|
|
const char* Error_File void
|
|
|
|
const char* Error_Function void
|
|
|
|
int Error_Lineno void
|
|
|
|
size_t Error_Size void
|
2011-05-25 16:40:36 +01:00
|
|
|
char ErrorSay[MAX_ERROR_MSG_SIZE] void
|
|
|
|
jmp_buf IOBotch void
|
2011-05-26 15:02:00 +01:00
|
|
|
TokEntry* tokptr void
|
|
|
|
TokEntry* toktide void
|
|
|
|
VarEntry* VarTable void
|
|
|
|
VarEntry* AnonVarTable void
|
2011-06-12 17:23:10 +01:00
|
|
|
Term Comments void
|
|
|
|
CELL* CommentsTail void
|
|
|
|
CELL* CommentsNextChar void
|
|
|
|
wchar_t* CommentsBuff void
|
|
|
|
size_t CommentsBuffPos void
|
|
|
|
size_t CommentsBuffLim void
|
2011-05-25 16:40:36 +01:00
|
|
|
sigjmp_buf RestartEnv void
|
2016-06-17 16:42:26 +01:00
|
|
|
char FileNameBuf[YAP_FILENAME_MAX+1] void
|
|
|
|
char FileNameBuf2[YAP_FILENAME_MAX+1] void
|
2011-05-25 16:40:36 +01:00
|
|
|
|
|
|
|
// Prolog State
|
2015-06-19 00:56:24 +01:00
|
|
|
UInt BreakLevel =0
|
2011-05-25 16:40:36 +01:00
|
|
|
Int PrologMode =BootMode
|
|
|
|
int CritLocks =0
|
|
|
|
|
2015-06-19 00:56:24 +01:00
|
|
|
// Prolog execution and state flags
|
|
|
|
union flagTerm* Flags void
|
|
|
|
UInt flagCount void
|
|
|
|
|
2011-05-25 16:40:36 +01:00
|
|
|
//analyst.c
|
|
|
|
/* used to find out how many instructions of each kind are executed */
|
|
|
|
#ifdef ANALYST
|
|
|
|
YAP_ULONG_LONG opcount[_std_top+1] void
|
|
|
|
YAP_ULONG_LONG 2opcount[_std_top+1][_std_top+1] void
|
|
|
|
#endif /* ANALYST */
|
2015-07-06 12:04:42 +01:00
|
|
|
|
2011-05-25 16:40:36 +01:00
|
|
|
//dbase.c
|
|
|
|
struct db_globs* s_dbg void
|
|
|
|
|
|
|
|
//eval.c
|
|
|
|
yap_error_number matherror =YAP_NO_ERROR
|
2014-10-16 10:49:11 +01:00
|
|
|
Term mathtt void
|
|
|
|
char* mathstring =NULL
|
2013-01-29 10:50:04 +00:00
|
|
|
yap_error_number CurrentError =YAP_NO_ERROR
|
2011-05-25 16:40:36 +01:00
|
|
|
|
|
|
|
//grow.c
|
|
|
|
int heap_overflows =0
|
|
|
|
Int total_heap_overflow_time =0
|
|
|
|
int stack_overflows =0
|
|
|
|
Int total_stack_overflow_time =0
|
2015-07-06 12:04:42 +01:00
|
|
|
int delay_overflows =0
|
2011-05-25 16:40:36 +01:00
|
|
|
Int total_delay_overflow_time =0
|
|
|
|
int trail_overflows =0
|
|
|
|
Int total_trail_overflow_time =0
|
|
|
|
int atom_table_overflows =0
|
|
|
|
Int total_atom_table_overflow_time =0
|
|
|
|
|
|
|
|
//load_dyld
|
|
|
|
#ifdef LOAD_DYLD
|
2011-08-16 14:34:44 +01:00
|
|
|
int dl_errno =0
|
2011-05-25 16:40:36 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//tracer.c
|
|
|
|
#ifdef LOW_LEVEL_TRACER
|
|
|
|
int do_trace_primitives =TRUE
|
|
|
|
#endif
|
|
|
|
|
2011-08-16 14:34:44 +01:00
|
|
|
//quick loader
|
2012-08-23 15:04:58 +01:00
|
|
|
struct export_atom_hash_entry_struct *ExportAtomHashChain =NULL
|
2011-08-16 14:34:44 +01:00
|
|
|
UInt ExportAtomHashTableSize =0
|
|
|
|
UInt ExportAtomHashTableNum =0
|
2012-08-23 15:04:58 +01:00
|
|
|
struct export_functor_hash_entry_struct *ExportFunctorHashChain =NULL
|
2011-08-16 14:34:44 +01:00
|
|
|
UInt ExportFunctorHashTableSize =0
|
|
|
|
UInt ExportFunctorHashTableNum =0
|
2012-08-23 00:57:13 +01:00
|
|
|
struct export_pred_entry_hash_entry_struct *ExportPredEntryHashChain =NULL
|
2011-08-24 04:11:54 +01:00
|
|
|
UInt ExportPredEntryHashTableSize =0
|
|
|
|
UInt ExportPredEntryHashTableNum =0
|
2012-08-23 15:04:58 +01:00
|
|
|
struct export_dbref_hash_entry_struct *ExportDBRefHashChain =NULL
|
2011-08-31 21:59:30 +01:00
|
|
|
UInt ExportDBRefHashTableSize =0
|
|
|
|
UInt ExportDBRefHashTableNum =0
|
2011-08-24 04:11:54 +01:00
|
|
|
struct import_atom_hash_entry_struct **ImportAtomHashChain =NULL
|
|
|
|
UInt ImportAtomHashTableSize =0
|
|
|
|
UInt ImportAtomHashTableNum =0
|
|
|
|
struct import_functor_hash_entry_struct **ImportFunctorHashChain =NULL
|
|
|
|
UInt ImportFunctorHashTableSize =0
|
|
|
|
UInt ImportFunctorHashTableNum =0
|
|
|
|
struct import_opcode_hash_entry_struct **ImportOPCODEHashChain =NULL
|
|
|
|
UInt ImportOPCODEHashTableSize =0
|
|
|
|
struct import_pred_entry_hash_entry_struct **ImportPredEntryHashChain =NULL
|
|
|
|
UInt ImportPredEntryHashTableSize =0
|
|
|
|
UInt ImportPredEntryHashTableNum =0
|
2011-08-31 21:59:30 +01:00
|
|
|
struct import_dbref_hash_entry_struct **ImportDBRefHashChain =NULL
|
|
|
|
UInt ImportDBRefHashTableSize =0
|
|
|
|
UInt ImportDBRefHashTableNum =0
|
|
|
|
yamop *ImportFAILCODE =NULL
|
2011-05-25 16:40:36 +01:00
|
|
|
|
2013-06-23 02:09:20 +01:00
|
|
|
// exo indexing
|
2013-04-17 02:04:53 +01:00
|
|
|
|
2013-01-09 09:21:07 +00:00
|
|
|
UInt ibnds[256] void
|
2013-06-23 02:09:20 +01:00
|
|
|
struct index_t* exo_it =NULL
|
|
|
|
CELL* exo_base =NULL
|
2013-04-17 02:04:53 +01:00
|
|
|
UInt exo_arity =0
|
|
|
|
UInt exo_arg =0
|
2013-01-09 09:21:07 +00:00
|
|
|
|
2013-01-17 12:43:01 +00:00
|
|
|
// atom completion
|
|
|
|
struct scan_atoms* search_atoms void
|
2016-04-19 23:30:02 +01:00
|
|
|
struct pred_entry* SearchPreds void
|
2013-01-17 12:43:01 +00:00
|
|
|
|
2013-11-20 22:27:46 +00:00
|
|
|
// Slots
|
2014-06-22 17:35:05 +01:00
|
|
|
yhandle_t CurSlot =0
|
2016-06-17 16:42:26 +01:00
|
|
|
yhandle_t FrozenHandles =0
|
2015-01-30 07:25:34 +00:00
|
|
|
yhandle_t NSlots =0
|
|
|
|
CELL* SlotBase =InitHandles(wid)
|
2013-11-20 22:27:46 +00:00
|
|
|
|
2014-11-27 10:02:04 +00:00
|
|
|
// Mutexes
|
|
|
|
struct swi_mutex* Mutexes =NULL
|
2013-11-20 22:27:46 +00:00
|
|
|
|
2013-11-13 10:38:20 +00:00
|
|
|
Term SourceModule =0
|
2015-09-21 23:05:36 +01:00
|
|
|
Term Including =TermNil
|
2013-11-13 10:38:20 +00:00
|
|
|
|
2013-12-02 14:49:41 +00:00
|
|
|
size_t MAX_SIZE =1024L
|
|
|
|
|
2016-02-29 03:13:23 +00:00
|
|
|
/* last call to walltime. */
|
|
|
|
uint64_t LastWTime =0
|
|
|
|
|
|
|
|
|
2011-08-16 14:34:44 +01:00
|
|
|
END_WORKER_LOCAL
|