YAP 7.1.0
globals.h
1//
2// File defining fields in the Yap_GLOBAL global structure
3//
4// these fields used to spread all over the place, because they must be used in
5// 3 ways:
6// - they must be defined somewhere
7// - they have an #ifdef to get a shorter name
8// - they must be initialised somewhere
9// - they may be of interest to restore
10//
11// The defs include 3+ components:
12// Type
13// name in structured / global name
14// init code (optional);
15// restore code (optional);
16//
17
18// Stuff that must be shared by all threads or workers
19// START_GLOBAL_DATA
20
21// initialization: tell whether the system has been initialised and by whom.
22GLOBAL_INIT(int, Initialised, FALSE);
23GLOBAL_INIT(int, InitialisedFromPL, FALSE);
24GLOBAL_INIT(int, PL_Argc, 0);
25GLOBAL_INIT(char **, PL_Argv, NULL);
26GLOBAL_INIT(bool, FAST_BOOT_FLAG, false);
27
28// halt hooks
29GLOBAL_INIT(struct halt_hook *, HaltHooks, NULL);
30GLOBAL_INIT(fptr_t, JIT_finalizer, NULL);
31
32// stack overflow expansion/gc control
33GLOBAL_INIT(int, AllowLocalExpansion, TRUE);
34GLOBAL_INIT(int, AllowGlobalExpansion, TRUE);
35GLOBAL_INIT(int, AllowTrailExpansion, TRUE);
36GLOBAL_INIT(UInt, SizeOfOverflow, 0);
37
38// amount of space recovered in all garbage collections
39GLOBAL_INIT(UInt, AGcThreshold, 10000);
40GLOBAL_INIT(Agc_hook, AGCHook, NULL);
41
42/* multi-thread support */
43#if THREADS
44/* number of threads and processes in system */
45GLOBAL_INIT(UInt, NOfThreads, 1);
46/* number of threads created since start */
47GLOBAL_INIT(UInt, NOfThreadsCreated, 1);
48/* total run time for dead threads */
49GLOBAL_INIT(UInt, ThreadsTotalTime, 0L);
50// Threads Array
51GLOBAL_INITF(lockvar, ThreadHandlesLock, MkLock);
52#endif
53
54#if defined(YAPOR) || defined(THREADS);
55// protect long critical regions
56GLOBAL_INITF(lockvar, BGL, MkLock);
57#endif
58
59#if defined(YAPOR) || defined(TABLING);
60GLOBAL(struct global_optyap_data, optyap_data);
61#endif /* YAPOR || TABLING */
62
63// whether Yap is responsible for signal handling
64
65GLOBAL(int, PrologShouldHandleInterrupts);
66
67/* This is the guy who actually started the system, and who has the correct
68 * registers */
69#if defined(THREADS);
70GLOBAL(pthread_t, master_thread);
71GLOBAL_INIT(struct thread_mbox *, named_mboxes, NULL);
72GLOBAL_INITF(lockvar, mboxq_lock, MkLock);
73GLOBAL_INIT(UInt, mbox_count, 0);
74GLOBAL(struct swi_mutex *, WithMutex);
75#endif /* THREADS */
76
77// streams
78GLOBAL(struct stream_desc *, Stream);
79#if defined(THREADS) || defined(YAPOR);
80GLOBAL_INITF(lockvar, StreamDescLock, MkLock);
81#endif
82
83// access to yap initial arguments
84GLOBAL(char **, argv);
85GLOBAL(int, argc);
86
87// extensions to Terms
88#ifdef COROUTINING
89/* array with the ops for your favourite extensions */
90GLOBAL_ARRAY(ext_op, attas, attvars_ext + 1);
91#endif
92
93// agc.c
94GLOBAL(int, agc_calls);
95GLOBAL(YAP_ULONG_LONG, agc_collected);
96/* total time spent in GC */
97GLOBAL_INIT(Int, tot_agc_time, 0);
98/* number of heap objects in all garbage collections */
99GLOBAL_INIT(Int, tot_agc_recovered, 0);
100
101// arrays.c
102#if HAVE_MMAP
103GLOBAL_INIT(struct MMAP_ARRAY_BLOCK *, mmap_arrays, NULL);
104#endif
105
106#ifdef DEBUG
107// computils.c
108GLOBAL_ARRAY(char, Option, 20);
109GLOBAL(YP_FILE *, logfile);
110// init.c
111// int output_msg
112// =FALSE
113#endif
114
115#if defined(COFF) || defined(A_OUT);
116// loada_coff.c && load_aout.c
117GLOBAL_ARRAY(char, Executable, MAX_PATH);
118#endif
119
120GLOBAL_INIT(int, OpaqueHandlersCount, 0);
121GLOBAL_INIT(struct YAP_opaque_handler_struct *, OpaqueHandlers, NULL);
122
123#if __simplescalar__
124GLOBAL_ARRAY(char, pwd, MAX_PATH);
125#endif
126
127// udi.c
128// struct udi_control_block RtreeCmd void
129
130GLOBAL(const char *, RestoreFile);
131
132// gprof.c
133GLOBAL(Int, ProfCalls);
134GLOBAL(Int, ProfGCs);
135GLOBAL(Int, ProfHGrows);
136GLOBAL(Int, ProfSGrows);
137GLOBAL(Int, ProfMallocs);
138GLOBAL(Int, ProfIndexing);
139GLOBAL(Int, ProfOn);
140GLOBAL(Int, ProfOns);
141GLOBAL(struct RB_red_blk_node *, ProfilerRoot);
142GLOBAL(struct RB_red_blk_node *, ProfilerNil);
143GLOBAL_INIT(char *, DIRNAME, NULL);
144#if LOW_PROF
145GLOBAL_INIT(int, ProfilerOn, FALSE);
146GLOBAL_INIT(FILE *, FProf, NULL);
147GLOBAL_INIT(FILE *, FPreds, NULL);
148#endif /* LOW_PROF */
149
150// Mutexes
151#if THREADS
152GLOBAL_INIT(struct swi_mutex *, FreeMutexes, NULL);
153GLOBAL_INIT(struct swi_mutex *, mutex_backbone, NULL);
154GLOBAL_INITF(lockvar, MUT_ACCESS, MkLock);
155#endif
156
157GLOBAL_INIT(char *, Home, NULL);
158
159/* ISO char conversion: I will make no comments */
160GLOBAL_INIT(char *, CharConversionTable, NULL);
161GLOBAL_INIT(char *, CharConversionTable2, NULL);
162
163/* max priority */
164GLOBAL_INIT(int, MaxPriority, 1200);
165
167GLOBAL_INIT(struct AliasDescS *, FileAliases, Yap_InitStandardAliases());
168GLOBAL(int, NOfFileAliases);
169GLOBAL(int, SzOfFileAliases);
170
171GLOBAL_INIT(struct vfs *, VFS, Yap_InitAssetManager());
172
173END_GLOBAL_DATA
VFS_t * Yap_InitAssetManager(void)
Definition: assets.c:231
@ argv
read-only atom, it describes the list with all arguments received by YAP at boot
Definition: YapGFlagInfo.h:89
opaque variables can interact with the system
Definition: YapDefs.h:229
Definition: TermExt.h:99
Definition: VFS.h:74