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
|
|
|
|
//
|
|
|
|
// The defs include 4+ components:
|
|
|
|
// Type
|
|
|
|
// name in structured
|
|
|
|
// global name
|
|
|
|
// init code (optional)
|
|
|
|
// restore code (optional)
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stuff that must be shared by all threads or workers
|
|
|
|
START_WORKER_SHARED
|
|
|
|
|
|
|
|
/* multi-thread support */
|
|
|
|
#if THREADS
|
|
|
|
/* number of threads and processes in system */
|
|
|
|
UInt n_of_threads NOfThreads =1
|
|
|
|
/* number of threads created since start */
|
|
|
|
UInt n_of_threads_created NOfThreadsCreated =1
|
|
|
|
/* total run time for dead threads */
|
|
|
|
UInt threads_total_time ThreadsTotalTime =0L
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// multi-thread/ORP support
|
|
|
|
#if defined(YAPOR) || defined(THREADS)
|
|
|
|
// protect long critical regions
|
|
|
|
lockvar bgl BGL MkLock
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// stack overflow expansion/gc control
|
|
|
|
int allow_local_expansion Yap_AllowLocalExpansion =TRUE
|
|
|
|
int allow_global_expansion Yap_AllowGlobalExpansion =TRUE
|
|
|
|
int allow_trail_expansion Yap_AllowTrailExpansion =TRUE
|
|
|
|
UInt size_of_overflow SizeOfOverflow =0
|
|
|
|
// amount of space recovered in all garbage collections
|
|
|
|
UInt agc_last_call AGcLastCall =0
|
|
|
|
// amount of space recovered in all garbage collections
|
|
|
|
UInt agc_threshold AGcThreshold =10000
|
|
|
|
Agc_hook agc_hook AGCHook =NULL
|
|
|
|
|
|
|
|
// readline
|
|
|
|
#if HAVE_LIBREADLINE
|
|
|
|
char *readline_buf ReadlineBuf =NULL
|
|
|
|
char *readline_pos ReadlinePos =0L
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Threads Array
|
|
|
|
#ifdef THREADS
|
|
|
|
lockvar thread_handles_lock ThreadHandlesLock MkLock
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Ricardo's stuff
|
|
|
|
#if defined(YAPOR) || defined(TABLING)
|
|
|
|
struct global_data global GLOBAL void
|
|
|
|
struct local_data remote[MAX_WORKERS] REMOTE void
|
|
|
|
#endif
|
|
|
|
|
2010-04-13 00:31:48 +01:00
|
|
|
// initialization: tell whether the system has been initialised and by whom.
|
|
|
|
int initialised Yap_Initialised =FALSE
|
|
|
|
int initialised_from_pl Yap_InitialisedFromPL =FALSE
|
|
|
|
int pl_argc Yap_PL_Argc =0
|
|
|
|
char **pl_argv Yap_PL_Argv =NULL
|
|
|
|
|
2010-11-29 18:08:29 +00:00
|
|
|
// halt hooks
|
|
|
|
struct halt_hook *yap_halt_hook Yap_HaltHooks =NULL
|
|
|
|
|
2010-03-21 22:12:42 +00:00
|
|
|
END_WORKER_SHARED
|
|
|
|
|