2010-03-21 22:12:42 +00:00
|
|
|
//
|
|
|
|
// File defining fields in the Yap_GLOBAL global structure
|
|
|
|
//
|
|
|
|
// these fields used to spread all over the place, because they must be used in 3 ways:
|
|
|
|
// - they must be defined somewhere
|
|
|
|
// - they have an #ifdef to get a shorter name
|
|
|
|
// - they must be initialised somewhere
|
|
|
|
// - they may be of interest to restore
|
|
|
|
//
|
2011-05-11 18:22:58 +01:00
|
|
|
// The defs include 3+ components:
|
2010-03-21 22:12:42 +00:00
|
|
|
// Type
|
2011-05-11 18:22:58 +01:00
|
|
|
// name in structured / global name
|
2010-03-21 22:12:42 +00:00
|
|
|
// init code (optional)
|
|
|
|
// restore code (optional)
|
|
|
|
//
|
|
|
|
|
|
|
|
// Stuff that must be shared by all threads or workers
|
2011-03-25 18:01:17 +00:00
|
|
|
START_GLOBAL_DATA
|
2010-03-21 22:12:42 +00:00
|
|
|
|
2011-05-09 19:36:51 +01:00
|
|
|
// initialization: tell whether the system has been initialised and by whom.
|
2011-05-25 16:40:36 +01:00
|
|
|
int Initialised =FALSE
|
|
|
|
int InitialisedFromPL =FALSE
|
|
|
|
int PL_Argc =0
|
|
|
|
char** PL_Argv =NULL
|
2011-05-09 19:36:51 +01:00
|
|
|
|
|
|
|
// halt hooks
|
2011-05-25 16:40:36 +01:00
|
|
|
struct halt_hook* HaltHooks =NULL
|
2011-05-09 19:36:51 +01:00
|
|
|
|
|
|
|
// stack overflow expansion/gc control
|
2011-05-25 16:40:36 +01:00
|
|
|
int AllowLocalExpansion =TRUE
|
|
|
|
int AllowGlobalExpansion =TRUE
|
|
|
|
int AllowTrailExpansion =TRUE
|
|
|
|
UInt SizeOfOverflow =0
|
2011-05-10 12:20:22 +01:00
|
|
|
|
2011-05-09 19:36:51 +01:00
|
|
|
// amount of space recovered in all garbage collections
|
2011-05-25 16:40:36 +01:00
|
|
|
UInt AGcThreshold =10000
|
|
|
|
Agc_hook AGCHook =NULL
|
2011-05-09 19:36:51 +01:00
|
|
|
|
2014-06-22 17:35:05 +01:00
|
|
|
#if __ANDROID__
|
|
|
|
// no need to perform initialization, it is done before we start the Prolog engine.
|
|
|
|
struct AAssetManager* assetManager =GLOBAL_assetManager
|
|
|
|
#endif
|
2011-05-23 16:19:47 +01:00
|
|
|
|
2010-03-21 22:12:42 +00:00
|
|
|
/* multi-thread support */
|
|
|
|
#if THREADS
|
|
|
|
/* number of threads and processes in system */
|
2011-05-25 16:40:36 +01:00
|
|
|
UInt NOfThreads =1
|
2010-03-21 22:12:42 +00:00
|
|
|
/* number of threads created since start */
|
2011-05-25 16:40:36 +01:00
|
|
|
UInt NOfThreadsCreated =1
|
2010-03-21 22:12:42 +00:00
|
|
|
/* total run time for dead threads */
|
2011-05-25 16:40:36 +01:00
|
|
|
UInt ThreadsTotalTime =0L
|
2011-05-11 18:22:58 +01:00
|
|
|
// Threads Array
|
2011-05-25 16:40:36 +01:00
|
|
|
lockvar ThreadHandlesLock MkLock
|
|
|
|
#endif
|
2010-03-21 22:12:42 +00:00
|
|
|
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
// protect long critical regions
|
2011-05-25 16:40:36 +01:00
|
|
|
lockvar BGL MkLock
|
2010-03-21 22:12:42 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(YAPOR) || defined(TABLING)
|
2011-05-25 16:40:36 +01:00
|
|
|
struct global_optyap_data optyap_data void
|
2011-05-09 19:36:51 +01:00
|
|
|
#endif /* YAPOR || TABLING */
|
2010-11-29 18:08:29 +00:00
|
|
|
|
2011-05-25 16:40:36 +01:00
|
|
|
// whether Yap is responsible for signal handling
|
|
|
|
|
|
|
|
int PrologShouldHandleInterrupts void
|
|
|
|
|
|
|
|
/* This is the guy who actually started the system, and who has the correct registers */
|
|
|
|
#if defined(THREADS)
|
|
|
|
pthread_t master_thread void
|
|
|
|
#endif /* THREADS */
|
|
|
|
|
|
|
|
// streams
|
2014-03-06 02:09:48 +00:00
|
|
|
struct io_stream* stdout =Soutput
|
|
|
|
struct io_stream* stderr =Serror
|
2011-05-25 16:40:36 +01:00
|
|
|
|
|
|
|
// access to yap initial arguments
|
|
|
|
char** argv void
|
|
|
|
int argc void
|
|
|
|
|
|
|
|
// extensions to Terms
|
|
|
|
#ifdef COROUTINING
|
|
|
|
/* array with the ops for your favourite extensions */
|
|
|
|
ext_op attas[attvars_ext+1] void
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// agc.c
|
|
|
|
int agc_calls void
|
|
|
|
YAP_ULONG_LONG agc_collected void
|
|
|
|
/* total time spent in GC */
|
|
|
|
Int tot_agc_time =0
|
|
|
|
/* number of heap objects in all garbage collections */
|
|
|
|
Int tot_agc_recovered =0
|
|
|
|
|
|
|
|
//arrays.c
|
|
|
|
#if HAVE_MMAP
|
|
|
|
struct MMAP_ARRAY_BLOCK* mmap_arrays =NULL
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
//computils.c
|
|
|
|
char Option[20] void
|
|
|
|
YP_FILE* logfile void
|
|
|
|
//init.c
|
2011-06-20 14:49:24 +01:00
|
|
|
//int output_msg =FALSE
|
2011-05-25 16:40:36 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(COFF) || defined(A_OUT)
|
|
|
|
// loada_coff.c && load_aout.c
|
|
|
|
char Executable[YAP_FILENAME_MAX] void
|
|
|
|
#endif
|
|
|
|
|
2011-07-22 12:09:33 +01:00
|
|
|
int OpaqueHandlersCount =0
|
|
|
|
struct opaque_handler_struct* OpaqueHandlers =NULL
|
2011-05-25 16:40:36 +01:00
|
|
|
|
|
|
|
#if __simplescalar__
|
|
|
|
char pwd[YAP_FILENAME_MAX] void
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//udi.c
|
|
|
|
//struct udi_control_block RtreeCmd void
|
|
|
|
|
2013-01-18 14:29:41 +00:00
|
|
|
char* RestoreFile void
|
|
|
|
|
2013-02-08 20:38:04 +00:00
|
|
|
//gprof.c
|
|
|
|
Int ProfCalls void
|
|
|
|
Int ProfGCs void
|
|
|
|
Int ProfHGrows void
|
|
|
|
Int ProfSGrows void
|
|
|
|
Int ProfMallocs void
|
|
|
|
Int ProfIndexing void
|
|
|
|
Int ProfOn void
|
|
|
|
Int ProfOns void
|
|
|
|
struct RB_red_blk_node* ProfilerRoot void
|
|
|
|
struct RB_red_blk_node* ProfilerNil void
|
|
|
|
char* DIRNAME =NULL
|
|
|
|
#if LOW_PROF
|
|
|
|
int ProfilerOn =FALSE
|
|
|
|
FILE* FProf =NULL
|
|
|
|
FILE* FPreds =NULL
|
|
|
|
#endif /* LOW_PROF */
|
2011-05-25 16:40:36 +01:00
|
|
|
|
|
|
|
|
2011-03-25 18:01:17 +00:00
|
|
|
END_GLOBAL_DATA
|
2010-03-21 22:12:42 +00:00
|
|
|
|