This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PL_malloc_mutex needs to be global, not per-interpreter
[perl5.git] / intrpvar.h
CommitLineData
49f531da
NIS
1/***********************************************/
2/* Global only to current interpreter instance */
3/***********************************************/
4
cb68f92d
GS
5/* Don't forget to re-run embed.pl to propagate changes! */
6
7/* The 'I' prefix is only needed for vars that need appropriate #defines
8 * generated when built with or without MULTIPLICITY. It is also used
9 * to generate the appropriate export list for win32.
10 *
11 * When building without MULTIPLICITY, these variables will be truly global.
12 *
13 * Avoid build-specific #ifdefs here, like DEBUGGING. That way,
14 * we can keep binary compatibility of the curinterp structure */
15
49f531da 16/* pseudo environmental stuff */
cb68f92d
GS
17PERLVAR(Iorigargc, int)
18PERLVAR(Iorigargv, char **)
19PERLVAR(Ienvgv, GV *)
20PERLVAR(Isiggv, GV *)
21PERLVAR(Iincgv, GV *)
b3ac6de7 22PERLVAR(Ihintgv, GV *)
cb68f92d
GS
23PERLVAR(Iorigfilename, char *)
24PERLVAR(Idiehook, SV *)
25PERLVAR(Iwarnhook, SV *)
d4cce5f1 26PERLVAR(Icddir, char *) /* switches */
cb68f92d 27PERLVAR(Iminus_c, bool)
51371543 28PERLVARA(Ipatchlevel,10,char)
cb68f92d
GS
29PERLVAR(Ilocalpatches, char **)
30PERLVARI(Isplitstr, char *, " ")
31PERLVAR(Ipreprocess, bool)
32PERLVAR(Iminus_n, bool)
33PERLVAR(Iminus_p, bool)
34PERLVAR(Iminus_l, bool)
35PERLVAR(Iminus_a, bool)
36PERLVAR(Iminus_F, bool)
37PERLVAR(Idoswitches, bool)
38PERLVAR(Idowarn, bool)
39PERLVAR(Idoextract, bool)
49f531da
NIS
40PERLVAR(Isawampersand, bool) /* must save all match strings */
41PERLVAR(Isawstudy, bool) /* do fbm_instr on all strings */
cb68f92d
GS
42PERLVAR(Isawvec, bool)
43PERLVAR(Iunsafe, bool)
44PERLVAR(Iinplace, char *)
45PERLVAR(Ie_script, SV *)
46PERLVAR(Iperldb, U32)
d4cce5f1
NIS
47
48/* This value may be raised by extensions for testing purposes */
49/* 0=none, 1=full, 2=full with checks */
cb68f92d 50PERLVARI(Iperl_destruct_level, int, 0)
49f531da
NIS
51
52/* magical thingies */
53PERLVAR(Ibasetime, Time_t) /* $^T */
54PERLVAR(Iformfeed, SV *) /* $^L */
d4cce5f1
NIS
55
56
cb68f92d
GS
57PERLVARI(Imaxsysfd, I32, MAXSYSFD)
58 /* top fd to pass to subprocesses */
49f531da
NIS
59PERLVAR(Imultiline, int) /* $*--do strings hold >1 line? */
60PERLVAR(Istatusvalue, I32) /* $? */
61#ifdef VMS
cb68f92d 62PERLVAR(Istatusvalue_vms,U32)
49f531da
NIS
63#endif
64
49f531da 65/* shortcuts to various I/O objects */
cb68f92d 66PERLVAR(Istdingv, GV *)
bf49b057 67PERLVAR(Istderrgv, GV *)
cb68f92d
GS
68PERLVAR(Idefgv, GV *)
69PERLVAR(Iargvgv, GV *)
70PERLVAR(Iargvoutgv, GV *)
49f531da
NIS
71
72/* shortcuts to regexp stuff */
5c0ca799 73/* XXX these three aren't used anywhere */
cb68f92d
GS
74PERLVAR(Ileftgv, GV *)
75PERLVAR(Iampergv, GV *)
76PERLVAR(Irightgv, GV *)
5c0ca799
GS
77
78/* this one needs to be moved to thrdvar.h and accessed via
79 * find_threadsv() when USE_THREADS */
cb68f92d 80PERLVAR(Ireplgv, GV *)
49f531da
NIS
81
82/* shortcuts to misc objects */
cb68f92d 83PERLVAR(Ierrgv, GV *)
49f531da
NIS
84
85/* shortcuts to debugging objects */
cb68f92d
GS
86PERLVAR(IDBgv, GV *)
87PERLVAR(IDBline, GV *)
88PERLVAR(IDBsub, GV *)
89PERLVAR(IDBsingle, SV *)
90PERLVAR(IDBtrace, SV *)
91PERLVAR(IDBsignal, SV *)
49f531da
NIS
92PERLVAR(Ilineary, AV *) /* lines of script for debugger */
93PERLVAR(Idbargs, AV *) /* args to call listed by caller function */
94
95/* symbol tables */
49f531da
NIS
96PERLVAR(Idebstash, HV *) /* symbol table for perldb package */
97PERLVAR(Iglobalstash, HV *) /* global keyword overrides imported here */
98PERLVAR(Icurstname, SV *) /* name of current package */
99PERLVAR(Ibeginav, AV *) /* names of BEGIN subroutines */
d4cce5f1 100PERLVAR(Iendav, AV *) /* names of END subroutines */
49f531da
NIS
101PERLVAR(Iinitav, AV *) /* names of INIT subroutines */
102PERLVAR(Istrtab, HV *) /* shared string table */
005a453c 103PERLVARI(Isub_generation,U32,1) /* incr to invalidate method cache */
49f531da
NIS
104
105/* memory management */
49f531da
NIS
106PERLVAR(Isv_count, I32) /* how many SV* are currently allocated */
107PERLVAR(Isv_objcount, I32) /* how many objects are currently allocated */
108PERLVAR(Isv_root, SV*) /* storage for SVs belonging to interp */
109PERLVAR(Isv_arenaroot, SV*) /* list of areas for garbage collection */
110
111/* funky return mechanisms */
cb68f92d
GS
112PERLVAR(Ilastspbase, I32)
113PERLVAR(Ilastsize, I32)
49f531da
NIS
114PERLVAR(Iforkprocess, int) /* so do_open |- can return proc# */
115
116/* subprocess state */
d4cce5f1 117PERLVAR(Ifdpid, AV *) /* keep fd-to-pid mappings for my_popen */
49f531da
NIS
118
119/* internal state */
49f531da
NIS
120PERLVAR(Itainting, bool) /* doing taint checks */
121PERLVARI(Iop_mask, char *, NULL) /* masked operations for safe evals */
122
123/* trace state */
cb68f92d
GS
124PERLVAR(Idlevel, I32)
125PERLVARI(Idlmax, I32, 128)
126PERLVAR(Idebname, char *)
127PERLVAR(Idebdelim, char *)
49f531da
NIS
128
129/* current interpreter roots */
cb68f92d
GS
130PERLVAR(Imain_cv, CV *)
131PERLVAR(Imain_root, OP *)
132PERLVAR(Imain_start, OP *)
133PERLVAR(Ieval_root, OP *)
134PERLVAR(Ieval_start, OP *)
49f531da
NIS
135
136/* runtime control stuff */
cb68f92d
GS
137PERLVARI(Icurcopdb, COP *, NULL)
138PERLVARI(Icopline, line_t, NOLINE)
49f531da
NIS
139
140/* statics moved here for shared library purposes */
141PERLVAR(Istrchop, SV) /* return value from chop */
142PERLVAR(Ifilemode, int) /* so nextargv() can preserve mode */
143PERLVAR(Ilastfd, int) /* what to preserve mode on */
144PERLVAR(Ioldname, char *) /* what to preserve mode on */
d4cce5f1
NIS
145PERLVAR(IArgv, char **) /* stuff to free from do_aexec, vfork safe */
146PERLVAR(ICmd, char *) /* stuff to free from do_aexec, vfork safe */
49f531da 147PERLVAR(Imystrk, SV *) /* temp key string for do_each() */
cb68f92d 148PERLVAR(Ioldlastpm, PMOP *) /* for saving regexp context in debugger */
49f531da 149PERLVAR(Igensym, I32) /* next symbol for getsym() to define */
cb68f92d
GS
150PERLVAR(Ipreambled, bool)
151PERLVAR(Ipreambleav, AV *)
152PERLVARI(Ilaststatval, int, -1)
153PERLVARI(Ilaststype, I32, OP_STAT)
154PERLVAR(Imess_sv, SV *)
49f531da 155
cb68f92d
GS
156/* XXX shouldn't these be per-thread? --GSAR */
157PERLVAR(Iors, char *) /* output record separator $\ */
158PERLVAR(Iorslen, STRLEN)
159PERLVAR(Iofmt, char *) /* output format for numbers $# */
d4cce5f1 160
4b556e6c 161/* interpreter atexit processing */
cb68f92d
GS
162PERLVARI(Iexitlist, PerlExitListEntry *, NULL)
163 /* list of exit functions */
164PERLVARI(Iexitlistlen, I32, 0) /* length of same */
165PERLVAR(Imodglobal, HV *) /* per-interp module data */
166
167/* these used to be in global before 5.004_68 */
168PERLVARI(Iprofiledata, U32 *, NULL) /* table of ops, counts */
169PERLVARI(Irsfp, PerlIO * VOL, Nullfp) /* current source file pointer */
170PERLVARI(Irsfp_filters, AV *, Nullav) /* keeps active source filters */
171
172PERLVAR(Icompiling, COP) /* compiling/done executing marker */
173
174PERLVAR(Icompcv, CV *) /* currently compiling subroutine */
175PERLVAR(Icomppad, AV *) /* storage for lexically scoped temporaries */
176PERLVAR(Icomppad_name, AV *) /* variable names for "my" variables */
177PERLVAR(Icomppad_name_fill, I32) /* last "introduced" variable offset */
178PERLVAR(Icomppad_name_floor, I32) /* start of vars in innermost block */
4b556e6c
JD
179
180#ifdef HAVE_INTERP_INTERN
cb68f92d
GS
181PERLVAR(Isys_intern, struct interp_intern)
182 /* platform internals */
4b556e6c
JD
183#endif
184
7fae4e64 185/* more statics moved here */
7fae4e64
GS
186PERLVARI(Igeneration, int, 100) /* from op.c */
187PERLVAR(IDBcv, CV *) /* from perl.c */
188PERLVAR(Iarchpat_auto, char*) /* from perl.c */
56953603 189
cb68f92d
GS
190PERLVARI(Iin_clean_objs,bool, FALSE) /* from sv.c */
191PERLVARI(Iin_clean_all, bool, FALSE) /* from sv.c */
7fae4e64
GS
192
193PERLVAR(Ilinestart, char *) /* beg. of most recently read line */
194PERLVAR(Ipending_ident, char) /* pending identifier lookup */
195PERLVAR(Isublex_info, SUBLEXINFO) /* from toke.c */
196
49f531da 197#ifdef USE_THREADS
cb68f92d 198PERLVAR(Ithrsv, SV *) /* struct perl_thread for main thread */
940cb80d 199PERLVARI(Ithreadnum, U32, 0) /* incremented each thread creation */
5f08fbcd 200PERLVAR(Istrtab_mutex, perl_mutex) /* Mutex for string table access */
49f531da 201#endif /* USE_THREADS */
76e3520e 202
d8eceb89
JH
203PERLVAR(Iuid, Uid_t) /* current real user id */
204PERLVAR(Ieuid, Uid_t) /* current effective user id */
205PERLVAR(Igid, Gid_t) /* current real group id */
206PERLVAR(Iegid, Gid_t) /* current effective group id */
0672f40e
GS
207PERLVAR(Inomemok, bool) /* let malloc context handle nomem */
208PERLVAR(Ian, U32) /* malloc sequence number */
209PERLVAR(Icop_seqmax, U32) /* statement sequence number */
210PERLVAR(Iop_seqmax, U16) /* op sequence number */
211PERLVAR(Ievalseq, U32) /* eval sequence number */
212PERLVAR(Iorigenviron, char **)
213PERLVAR(Iorigalen, U32)
214PERLVAR(Ipidstatus, HV *) /* pid-to-status mappings for waitpid */
215PERLVARI(Imaxo, int, MAXO) /* maximum number of ops */
216PERLVAR(Iosname, char *) /* operating system */
217PERLVARI(Ish_path, char *, SH_PATH)/* full path of shell */
218PERLVAR(Isighandlerp, Sighandler_t)
219
220PERLVAR(Ixiv_arenaroot, XPV*) /* list of allocated xiv areas */
221PERLVAR(Ixiv_root, IV *) /* free xiv list--shared by interpreters */
cad2e5aa 222PERLVAR(Ixnv_root, NV *) /* free xnv list--shared by interpreters */
0672f40e
GS
223PERLVAR(Ixrv_root, XRV *) /* free xrv list--shared by interpreters */
224PERLVAR(Ixpv_root, XPV *) /* free xpv list--shared by interpreters */
932e9ff9
VB
225PERLVAR(Ixpviv_root, XPVIV *) /* free xpviv list--shared by interpreters */
226PERLVAR(Ixpvnv_root, XPVNV *) /* free xpvnv list--shared by interpreters */
227PERLVAR(Ixpvcv_root, XPVCV *) /* free xpvcv list--shared by interpreters */
228PERLVAR(Ixpvav_root, XPVAV *) /* free xpvav list--shared by interpreters */
229PERLVAR(Ixpvhv_root, XPVHV *) /* free xpvhv list--shared by interpreters */
230PERLVAR(Ixpvmg_root, XPVMG *) /* free xpvmg list--shared by interpreters */
231PERLVAR(Ixpvlv_root, XPVLV *) /* free xpvlv list--shared by interpreters */
232PERLVAR(Ixpvbm_root, XPVBM *) /* free xpvbm list--shared by interpreters */
0672f40e
GS
233PERLVAR(Ihe_root, HE *) /* free he list--shared by interpreters */
234PERLVAR(Inice_chunk, char *) /* a nice chunk of memory to reuse */
235PERLVAR(Inice_chunk_size, U32) /* how nice the chunk of memory is */
236
0b94c7bb 237PERLVARI(Irunops, runops_proc_t, MEMBER_TO_FPTR(RUNOPS_DEFAULT))
0672f40e 238
51371543 239PERLVARA(Itokenbuf,256, char)
0672f40e
GS
240
241PERLVAR(Isv_undef, SV)
242PERLVAR(Isv_no, SV)
243PERLVAR(Isv_yes, SV)
244
245#ifdef CSH
246PERLVARI(Icshname, char *, CSH)
247PERLVAR(Icshlen, I32)
248#endif
249
250PERLVAR(Ilex_state, U32) /* next token is determined */
251PERLVAR(Ilex_defer, U32) /* state after determined token */
252PERLVAR(Ilex_expect, expectation) /* expect after determined token */
253PERLVAR(Ilex_brackets, I32) /* bracket count */
254PERLVAR(Ilex_formbrack, I32) /* bracket count at outer format level */
255PERLVAR(Ilex_fakebrack, I32) /* outer bracket is mere delimiter */
256PERLVAR(Ilex_casemods, I32) /* casemod count */
257PERLVAR(Ilex_dojoin, I32) /* doing an array interpolation */
258PERLVAR(Ilex_starts, I32) /* how many interps done on level */
259PERLVAR(Ilex_stuff, SV *) /* runtime pattern from m// or s/// */
260PERLVAR(Ilex_repl, SV *) /* runtime replacement from s/// */
261PERLVAR(Ilex_op, OP *) /* extra info to pass back on op */
262PERLVAR(Ilex_inpat, OP *) /* in pattern $) and $| are special */
263PERLVAR(Ilex_inwhat, I32) /* what kind of quoting are we in */
264PERLVAR(Ilex_brackstack,char *) /* what kind of brackets to pop */
265PERLVAR(Ilex_casestack, char *) /* what kind of case mods in effect */
266
267/* What we know when we're in LEX_KNOWNEXT state. */
51371543
GS
268PERLVARA(Inextval,5, YYSTYPE) /* value of next token, if any */
269PERLVARA(Inexttype,5, I32) /* type of next token */
0672f40e
GS
270PERLVAR(Inexttoke, I32)
271
272PERLVAR(Ilinestr, SV *)
273PERLVAR(Ibufptr, char *)
274PERLVAR(Ioldbufptr, char *)
275PERLVAR(Ioldoldbufptr, char *)
276PERLVAR(Ibufend, char *)
277PERLVARI(Iexpect,expectation, XSTATE) /* how to interpret ambiguous tokens */
278
279PERLVAR(Imulti_start, I32) /* 1st line of multi-line string */
280PERLVAR(Imulti_end, I32) /* last line of multi-line string */
281PERLVAR(Imulti_open, I32) /* delimiter of said string */
282PERLVAR(Imulti_close, I32) /* delimiter of said string */
283
284PERLVAR(Ierror_count, I32) /* how many errors so far, max 10 */
285PERLVAR(Isubline, I32) /* line this subroutine began on */
286PERLVAR(Isubname, SV *) /* name of current subroutine */
287
288PERLVAR(Imin_intro_pending, I32) /* start of vars to introduce */
289PERLVAR(Imax_intro_pending, I32) /* end of vars to introduce */
290PERLVAR(Ipadix, I32) /* max used index in current "register" pad */
291PERLVAR(Ipadix_floor, I32) /* how low may inner block reset padix */
292PERLVAR(Ipad_reset_pending, I32) /* reset pad on next attempted alloc */
293
294PERLVAR(Ithisexpr, I32) /* name id for nothing_in_common() */
295PERLVAR(Ilast_uni, char *) /* position of last named-unary op */
296PERLVAR(Ilast_lop, char *) /* position of last list operator */
297PERLVAR(Ilast_lop_op, OPCODE) /* last list operator */
77ca0c92 298PERLVAR(Iin_my, I32) /* we're compiling a "my" (or "our") declaration */
0672f40e
GS
299PERLVAR(Iin_my_stash, HV *) /* declared class of this "my" declaration */
300#ifdef FCRYPT
301PERLVAR(Icryptseen, I32) /* has fast crypt() been initialized? */
302#endif
303
304PERLVAR(Ihints, U32) /* pragma-tic compile-time flags */
305
306PERLVAR(Idebug, VOL U32) /* flags given to -D switch */
307
308PERLVAR(Iamagic_generation, long)
309
310#ifdef USE_LOCALE_COLLATE
311PERLVAR(Icollation_ix, U32) /* Collation generation index */
312PERLVAR(Icollation_name,char *) /* Name of current collation */
313PERLVARI(Icollation_standard, bool, TRUE)
314 /* Assume simple collation */
315PERLVAR(Icollxfrm_base, Size_t) /* Basic overhead in *xfrm() */
316PERLVARI(Icollxfrm_mult,Size_t, 2) /* Expansion factor in *xfrm() */
317#endif /* USE_LOCALE_COLLATE */
318
319#ifdef USE_LOCALE_NUMERIC
320
321PERLVAR(Inumeric_name, char *) /* Name of current numeric locale */
322PERLVARI(Inumeric_standard, bool, TRUE)
323 /* Assume simple numerics */
324PERLVARI(Inumeric_local, bool, TRUE)
325 /* Assume local numerics */
097ee67d
JH
326PERLVAR(Inumeric_radix, char)
327 /* The radix character if not '.' */
0672f40e
GS
328
329#endif /* !USE_LOCALE_NUMERIC */
330
331/* utf8 character classes */
332PERLVAR(Iutf8_alnum, SV *)
b8c5462f
JH
333PERLVAR(Iutf8_alnumc, SV *)
334PERLVAR(Iutf8_ascii, SV *)
0672f40e
GS
335PERLVAR(Iutf8_alpha, SV *)
336PERLVAR(Iutf8_space, SV *)
b8c5462f
JH
337PERLVAR(Iutf8_cntrl, SV *)
338PERLVAR(Iutf8_graph, SV *)
0672f40e
GS
339PERLVAR(Iutf8_digit, SV *)
340PERLVAR(Iutf8_upper, SV *)
341PERLVAR(Iutf8_lower, SV *)
342PERLVAR(Iutf8_print, SV *)
b8c5462f
JH
343PERLVAR(Iutf8_punct, SV *)
344PERLVAR(Iutf8_xdigit, SV *)
0672f40e
GS
345PERLVAR(Iutf8_mark, SV *)
346PERLVAR(Iutf8_toupper, SV *)
347PERLVAR(Iutf8_totitle, SV *)
348PERLVAR(Iutf8_tolower, SV *)
349PERLVAR(Ilast_swash_hv, HV *)
350PERLVAR(Ilast_swash_klen, U32)
51371543 351PERLVARA(Ilast_swash_key,10, U8)
0672f40e
GS
352PERLVAR(Ilast_swash_tmps, U8 *)
353PERLVAR(Ilast_swash_slen, STRLEN)
354
355/* perly.c globals */
356PERLVAR(Iyydebug, int)
357PERLVAR(Iyynerrs, int)
358PERLVAR(Iyyerrflag, int)
359PERLVAR(Iyychar, int)
360PERLVAR(Iyyval, YYSTYPE)
361PERLVAR(Iyylval, YYSTYPE)
362
363PERLVAR(Iglob_index, int)
0672f40e 364PERLVAR(Isrand_called, bool)
51371543 365PERLVARA(Iuudmap,256, char)
0672f40e
GS
366PERLVAR(Ibitcount, char *)
367PERLVAR(Ifilter_debug, int)
368
43165c05
GS
369#ifdef USE_THREADS
370PERLVAR(Ithr_key, perl_key) /* For per-thread struct perl_thread* */
371PERLVAR(Isv_mutex, perl_mutex) /* Mutex for allocating SVs in sv.c */
43165c05
GS
372PERLVAR(Ieval_mutex, perl_mutex) /* Mutex for doeval */
373PERLVAR(Ieval_cond, perl_cond) /* Condition variable for doeval */
374PERLVAR(Ieval_owner, struct perl_thread *)
375 /* Owner thread for doeval */
376PERLVAR(Inthreads, int) /* Number of threads currently */
377PERLVAR(Ithreads_mutex, perl_mutex) /* Mutex for nthreads and thread list */
378PERLVAR(Inthreads_cond, perl_cond) /* Condition variable for nthreads */
379PERLVAR(Isvref_mutex, perl_mutex) /* Mutex for SvREFCNT_{inc,dec} */
380PERLVARI(Ithreadsv_names,char *, THREADSV_NAMES)
381#ifdef FAKE_THREADS
382PERLVAR(Icurthr, struct perl_thread *)
383 /* Currently executing (fake) thread */
384#endif
385
386PERLVAR(Icred_mutex, perl_mutex) /* altered credentials in effect */
387
388#endif /* USE_THREADS */
389
c5be433b 390#if defined(PERL_IMPLICIT_SYS)
32e30700
GS
391PERLVAR(IMem, struct IPerlMem*)
392PERLVAR(IEnv, struct IPerlEnv*)
393PERLVAR(IStdIO, struct IPerlStdIO*)
394PERLVAR(ILIO, struct IPerlLIO*)
395PERLVAR(IDir, struct IPerlDir*)
396PERLVAR(ISock, struct IPerlSock*)
397PERLVAR(IProc, struct IPerlProc*)
76e3520e 398#endif