This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Combine expression into a macro
[perl5.git] / intrpvar.h
CommitLineData
907b3e23
DM
1/* intrpvar.h
2 *
3 * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
1129b882 4 * 2006, 2007, 2008 by Larry Wall and others
907b3e23
DM
5 *
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
8 *
9 */
10
e3d474b7
KW
11#include "handy.h"
12
907b3e23
DM
13/*
14=head1 Per-Interpreter Variables
15*/
49f531da 16
907b3e23
DM
17/* These variables are per-interpreter in threaded/multiplicity builds,
18 * global otherwise.
19
d7cb65f2 20 * Don't forget to re-run regen/embed.pl to propagate changes! */
cb68f92d 21
ab686ae8 22/* New variables must be added to the very end for binary compatibility. */
6537fe72 23
ba05a734 24/* Don't forget to add your variable also to perl_clone()! (in sv.c) */
02506efe 25
cb68f92d
GS
26/* The 'I' prefix is only needed for vars that need appropriate #defines
27 * generated when built with or without MULTIPLICITY. It is also used
97df044c
KW
28 * to generate the appropriate export list for win32. If the variable
29 * needs to be initialized, use PERLVARI.
cb68f92d 30 *
907b3e23
DM
31 * When building without MULTIPLICITY, these variables will be truly global.
32 *
33 * Important ones in the first cache line (if alignment is done right) */
34
115ff745 35PERLVAR(I, stack_sp, SV **) /* top of the stack */
115ff745 36PERLVAR(I, op, OP *) /* currently executing op */
115ff745 37PERLVAR(I, curpad, SV **) /* active pad (lexicals+tmps) */
907b3e23 38
115ff745
NC
39PERLVAR(I, stack_base, SV **)
40PERLVAR(I, stack_max, SV **)
907b3e23 41
115ff745 42PERLVAR(I, savestack, ANY *) /* items that need to be restored when
907b3e23 43 LEAVEing scopes we've ENTERed */
115ff745
NC
44PERLVAR(I, savestack_ix, I32)
45PERLVAR(I, savestack_max, I32)
46
19bc2726
DM
47PERLVAR(I, scopestack, I32 *) /* scopes we've ENTERed */
48PERLVAR(I, scopestack_ix, I32)
49PERLVAR(I, scopestack_max, I32)
50
115ff745 51PERLVAR(I, tmps_stack, SV **) /* mortals we've made */
e8eb279c
FC
52PERLVARI(I, tmps_ix, SSize_t, -1)
53PERLVARI(I, tmps_floor, SSize_t, -1)
ba367634 54PERLVAR(I, tmps_max, SSize_t) /* first unalloced slot in tmps stack */
19bc2726
DM
55
56PERLVARI(I, sub_generation, U32, 1) /* incr to invalidate method cache */
907b3e23 57
115ff745 58PERLVAR(I, markstack, I32 *) /* stack_sp locations we're
907b3e23 59 remembering */
115ff745
NC
60PERLVAR(I, markstack_ptr, I32 *)
61PERLVAR(I, markstack_max, I32 *)
907b3e23 62
6a5b4183
YO
63#ifdef PERL_HASH_RANDOMIZE_KEYS
64#ifdef USE_PERL_PERTURB_KEYS
65PERLVARI(I, hash_rand_bits_enabled, U8, 1) /* used to randomize hash stuff 0 == no-random, 1 == random, 2 == determinsitic */
66#endif
0e0ab621 67PERLVARI(I, hash_rand_bits, UV, 0) /* used to randomize hash stuff */
6a5b4183 68#endif
19bc2726 69PERLVAR(I, strtab, HV *) /* shared string table */
fedf30e1
DM
70/* prog counter for the currently executing OP_MULTIDEREF Used to signal
71 * to S_find_uninit_var() where we are */
72PERLVAR(I, multideref_pc, UNOP_AUX_item *)
19bc2726
DM
73
74/* Fields used by magic variables such as $@, $/ and so on */
75PERLVAR(I, curpm, PMOP *) /* what to do \ interps in REs from */
5585e758 76PERLVAR(I, curpm_under, PMOP *) /* what to do \ interps in REs from */
19bc2726
DM
77
78PERLVAR(I, tainting, bool) /* doing taint checks */
d48c660d 79PERLVARI(I, tainted, bool, FALSE) /* using variables controlled by $< */
a68090fe
DM
80
81/* PL_delaymagic is currently used for two purposes: to assure simultaneous
82 * updates in ($<,$>) = ..., and to assure atomic update in push/unshift
83 * @ISA, It works like this: a few places such as pp_push set the DM_DELAY
84 * flag; then various places such as av_store() skip mg_set(ary) if this
85 * flag is set, and various magic vtable methods set flags like
86 * DM_ARRAY_ISA if they've seen something of that ilk. Finally when
87 * control returns to pp_push or whatever, it sees if any of those flags
88 * have been set, and if so finally calls mg_set().
89 *
90 * NB: PL_delaymagic is automatically saved and restored by JUMPENV_PUSH
91 * / POP. This removes the need to do ENTER/SAVEI16(PL_delaymagic)/LEAVE
92 * in hot code like pp_push.
93 */
19bc2726 94PERLVAR(I, delaymagic, U16) /* ($<,$>) = ... */
a68090fe 95
19bc2726
DM
96PERLVAR(I, localizing, U8) /* are we processing a local() list? */
97PERLVAR(I, in_eval, U8) /* trap "fatal" errors? */
3f44dc81 98PERLVAR(I, defgv, GV *) /* the *_ glob */
19bc2726
DM
99/*
100
b5282d7c 101=for apidoc mn|U8|PL_dowarn
19bc2726 102
b5282d7c
AC
103The C variable that roughly corresponds to Perl's C<$^W> warning variable.
104However, C<$^W> is treated as a boolean, whereas C<PL_dowarn> is a
105collection of flag bits.
19bc2726
DM
106
107=cut
108*/
109
110PERLVAR(I, dowarn, U8)
111
112#if defined (PERL_UTF8_CACHE_ASSERT) || defined (DEBUGGING)
113# define PERL___I -1
114#else
115# define PERL___I 1
116#endif
117PERLVARI(I, utf8cache, I8, PERL___I) /* Is the utf8 caching code enabled? */
118#undef PERL___I
119
120
121/* Stashes */
122PERLVAR(I, defstash, HV *) /* main symbol table */
123PERLVAR(I, curstash, HV *) /* symbol table for current package */
124
125PERLVAR(I, curcop, COP *)
126PERLVAR(I, curstack, AV *) /* THE STACK */
127PERLVAR(I, curstackinfo, PERL_SI *) /* current stack + context */
128PERLVAR(I, mainstack, AV *) /* the stack when nothing funny is
129 happening */
130
131/* memory management */
132PERLVAR(I, sv_count, IV) /* how many SV* are currently allocated */
19bc2726
DM
133
134PERLVAR(I, sv_root, SV *) /* storage for SVs belonging to interp */
135PERLVAR(I, sv_arenaroot, SV *) /* list of areas for garbage collection */
136
f65e70f5
DM
137/* fake PMOP that PL_curpm points to while in (?{}) so $1 et al are visible */
138PERLVARI(I, reg_curpm, PMOP*, NULL)
139
19bc2726 140/* the currently active slab in a chain of slabs of regmatch states,
87c1d905
DM
141 * and the currently active state within that slab. This stack of states
142 * is shared amongst re-entrant calls to the regex engine */
19bc2726
DM
143
144PERLVARI(I, regmatch_slab, regmatch_slab *, NULL)
145PERLVAR(I, regmatch_state, regmatch_state *)
146
147PERLVAR(I, comppad, PAD *) /* storage for lexically scoped temporaries */
148
149/*
150=for apidoc Amn|SV|PL_sv_undef
151This is the C<undef> SV. Always refer to this as C<&PL_sv_undef>.
152
153=for apidoc Amn|SV|PL_sv_no
fbe13c60 154This is the C<false> SV. See C<L</PL_sv_yes>>. Always refer to this as
19bc2726
DM
155C<&PL_sv_no>.
156
157=for apidoc Amn|SV|PL_sv_yes
fbe13c60 158This is the C<true> SV. See C<L</PL_sv_no>>. Always refer to this as
19bc2726
DM
159C<&PL_sv_yes>.
160
5a6c2837
DM
161=for apidoc Amn|SV|PL_sv_zero
162This readonly SV has a zero numeric value and a C<"0"> string value. It's
163similar to C<L</PL_sv_no>> except for its string value. Can be used as a
164cheap alternative to C<mXPUSHi(0)> for example. Always refer to this as
165C<&PL_sv_zero>. Introduced in 5.28.
166
19bc2726
DM
167=cut
168*/
169
7c123f9d
DM
170#ifdef MULTIPLICITY
171PERLVAR(I, sv_yes, SV)
19bc2726
DM
172PERLVAR(I, sv_undef, SV)
173PERLVAR(I, sv_no, SV)
5a6c2837 174PERLVAR(I, sv_zero, SV)
7c123f9d
DM
175#else
176/* store the immortals as an array to ensure they are contiguous in
177 * memory: makes SvIMMORTAL_INTERP(sv) possible */
178PERLVARA(I, sv_immortals, 4, SV)
179#endif
5a6c2837 180
12d375ea
FC
181PERLVAR(I, padname_undef, PADNAME)
182PERLVAR(I, padname_const, PADNAME)
115ff745 183PERLVAR(I, Sv, SV *) /* used to hold temporary values */
19bc2726
DM
184
185PERLVAR(I, parser, yy_parser *) /* current parser state */
186
187PERLVAR(I, stashcache, HV *) /* Cache to speed up S_method_common */
188
907b3e23
DM
189
190/*
191=for apidoc Amn|STRLEN|PL_na
192
193A convenience variable which is typically used with C<SvPV> when one
194doesn't care about the length of the string. It is usually more efficient
195to either declare a local variable and use that instead or to use the
196C<SvPV_nolen> macro.
197
198=cut
199*/
200
115ff745 201PERLVAR(I, na, STRLEN) /* for use in SvPV when length is
907b3e23
DM
202 Not Applicable */
203
204/* stat stuff */
115ff745
NC
205PERLVAR(I, statcache, Stat_t) /* _ */
206PERLVAR(I, statgv, GV *)
207PERLVARI(I, statname, SV *, NULL)
907b3e23 208
907b3e23
DM
209/*
210=for apidoc mn|SV*|PL_rs
211
212The input record separator - C<$/> in Perl space.
213
214=for apidoc mn|GV*|PL_last_in_gv
215
154e47c8 216The GV which was last used for a filehandle input operation. (C<< <FH> >>)
907b3e23 217
e23d9e2f 218=for apidoc mn|GV*|PL_ofsgv
907b3e23 219
e23d9e2f 220The glob containing the output field separator - C<*,> in Perl space.
907b3e23
DM
221
222=cut
223*/
224
115ff745
NC
225PERLVAR(I, rs, SV *) /* input record separator $/ */
226PERLVAR(I, last_in_gv, GV *) /* GV used in last <FH> */
227PERLVAR(I, ofsgv, GV *) /* GV of output field separator *, */
228PERLVAR(I, defoutgv, GV *) /* default FH for output */
229PERLVARI(I, chopset, const char *, " \n-") /* $: */
230PERLVAR(I, formtarget, SV *)
231PERLVAR(I, bodytarget, SV *)
232PERLVAR(I, toptarget, SV *)
907b3e23 233
115ff745
NC
234
235PERLVAR(I, restartop, OP *) /* propagating an error from croak? */
236PERLVAR(I, restartjmpenv, JMPENV *) /* target frame for longjmp in die */
907b3e23 237
115ff745
NC
238PERLVAR(I, top_env, JMPENV *) /* ptr to current sigjmp environment */
239PERLVAR(I, start_env, JMPENV) /* empty startup sigjmp environment */
240PERLVARI(I, errors, SV *, NULL) /* outstanding queued errors */
907b3e23
DM
241
242/* statics "owned" by various functions */
115ff745 243PERLVAR(I, hv_fetch_ent_mh, HE*) /* owned by hv_fetch_ent() */
907b3e23 244
115ff745 245PERLVAR(I, lastgotoprobe, OP*) /* from pp_ctl.c */
907b3e23
DM
246
247/* sort stuff */
115ff745
NC
248PERLVAR(I, sortcop, OP *) /* user defined sort routine */
249PERLVAR(I, sortstash, HV *) /* which is in some package or other */
250PERLVAR(I, firstgv, GV *) /* $a */
251PERLVAR(I, secondgv, GV *) /* $b */
907b3e23
DM
252
253/* float buffer */
115ff745
NC
254PERLVAR(I, efloatbuf, char *)
255PERLVAR(I, efloatsize, STRLEN)
907b3e23 256
115ff745 257PERLVARI(I, dumpindent, U16, 4) /* number of blanks per dump
907b3e23
DM
258 indentation level */
259
e914d9bb 260PERLVAR(I, exit_flags, U8) /* was exit() unexpected, etc. */
157b3822 261
115ff745 262PERLVAR(I, utf8locale, bool) /* utf8 locale detected */
31f05a37 263PERLVAR(I, in_utf8_CTYPE_locale, bool)
165a1c52 264PERLVAR(I, in_utf8_COLLATE_locale, bool)
bffa51e2 265#if defined(USE_ITHREADS) && ! defined(USE_THREAD_SAFE_LOCALE)
49d7d366 266PERLVARI(I, lc_numeric_mutex_depth, int, 0) /* Emulate general semaphore */
bffa51e2 267#endif
47280b20
KW
268PERLVARA(I, locale_utf8ness, 256, char)
269
5b7de470
KW
270#ifdef USE_LOCALE_CTYPE
271 PERLVAR(I, warn_locale, SV *)
272#endif
907b3e23 273
87c1d905 274PERLVARA(I, colors,6, char *) /* values from PERL_RE_COLORS env var */
907b3e23 275
9ea12537
Z
276/*
277=for apidoc Amn|peep_t|PL_peepp
278
279Pointer to the per-subroutine peephole optimiser. This is a function
280that gets called at the end of compilation of a Perl subroutine (or
281equivalently independent piece of Perl code) to perform fixups of
282some ops and to perform small-scale optimisations. The function is
283called once for each subroutine that is compiled, and is passed, as sole
284parameter, a pointer to the op that is the entry point to the subroutine.
285It modifies the op tree in place.
286
287The peephole optimiser should never be completely replaced. Rather,
288add code to it by wrapping the existing optimiser. The basic way to do
289this can be seen in L<perlguts/Compile pass 3: peephole optimization>.
290If the new code wishes to operate on ops throughout the subroutine's
291structure, rather than just at the top level, it is likely to be more
292convenient to wrap the L</PL_rpeepp> hook.
293
294=cut
295*/
296
115ff745 297PERLVARI(I, peepp, peep_t, Perl_peep)
9ea12537
Z
298
299/*
300=for apidoc Amn|peep_t|PL_rpeepp
301
302Pointer to the recursive peephole optimiser. This is a function
303that gets called at the end of compilation of a Perl subroutine (or
304equivalently independent piece of Perl code) to perform fixups of some
305ops and to perform small-scale optimisations. The function is called
306once for each chain of ops linked through their C<op_next> fields;
307it is recursively called to handle each side chain. It is passed, as
308sole parameter, a pointer to the op that is at the head of the chain.
309It modifies the op tree in place.
310
311The peephole optimiser should never be completely replaced. Rather,
312add code to it by wrapping the existing optimiser. The basic way to do
313this can be seen in L<perlguts/Compile pass 3: peephole optimization>.
314If the new code wishes to operate only on ops at a subroutine's top level,
315rather than throughout the structure, it is likely to be more convenient
316to wrap the L</PL_peepp> hook.
317
318=cut
319*/
320
115ff745 321PERLVARI(I, rpeepp, peep_t, Perl_rpeep)
907b3e23 322
2f175318
VP
323/*
324=for apidoc Amn|Perl_ophook_t|PL_opfreehook
325
326When non-C<NULL>, the function pointed by this variable will be called each time an OP is freed with the corresponding OP as the argument.
327This allows extensions to free any extra attribute they have locally attached to an OP.
328It is also assured to first fire for the parent OP and then for its kids.
329
330When you replace this variable, it is considered a good practice to store the possibly previously installed hook and that you recall it inside your own.
331
332=cut
333*/
334
115ff745 335PERLVARI(I, opfreehook, Perl_ophook_t, 0) /* op_free() hook */
f37b8c3f 336
115ff745
NC
337PERLVARI(I, watchaddr, char **, 0)
338PERLVAR(I, watchok, char *)
907b3e23 339
115ff745 340PERLVAR(I, perldb, U32)
d95e864f 341
115ff745 342PERLVAR(I, signals, U32) /* Using which pre-5.8 signals */
30b0736d 343
79968a97
NC
344PERLVAR(I, reentrant_retint, int) /* Integer return value from reentrant functions */
345
49f531da 346/* pseudo environmental stuff */
115ff745
NC
347PERLVAR(I, origargc, int)
348PERLVAR(I, origargv, char **)
349PERLVAR(I, envgv, GV *)
350PERLVAR(I, incgv, GV *)
351PERLVAR(I, hintgv, GV *)
352PERLVAR(I, origfilename, char *)
9a189793 353PERLVARI(I, xsubfilename, const char *, NULL)
115ff745
NC
354PERLVAR(I, diehook, SV *)
355PERLVAR(I, warnhook, SV *)
1d7c1841
GS
356
357/* switches */
115ff745 358PERLVAR(I, patchlevel, SV *)
115ff745
NC
359PERLVAR(I, localpatches, const char * const *)
360PERLVARI(I, splitstr, const char *, " ")
361
362PERLVAR(I, minus_c, bool)
363PERLVAR(I, minus_n, bool)
364PERLVAR(I, minus_p, bool)
365PERLVAR(I, minus_l, bool)
366PERLVAR(I, minus_a, bool)
367PERLVAR(I, minus_F, bool)
368PERLVAR(I, doswitches, bool)
369PERLVAR(I, minus_E, bool)
954c1994 370
115ff745
NC
371PERLVAR(I, inplace, char *)
372PERLVAR(I, e_script, SV *)
49f531da 373
115ff745 374PERLVAR(I, basetime, Time_t) /* $^T */
d4cce5f1 375
115ff745 376PERLVARI(I, maxsysfd, I32, MAXSYSFD)
cb68f92d 377 /* top fd to pass to subprocesses */
115ff745 378PERLVAR(I, statusvalue, I32) /* $? */
49f531da 379#ifdef VMS
115ff745 380PERLVAR(I, statusvalue_vms, U32)
e5218da5 381#else
115ff745 382PERLVAR(I, statusvalue_posix, I32)
49f531da
NIS
383#endif
384
115ff745
NC
385PERLVARI(I, sig_pending, int, 0) /* Number if highest signal pending */
386PERLVAR(I, psig_pend, int *) /* per-signal "count" of pending */
157b3822 387
49f531da 388/* shortcuts to various I/O objects */
115ff745
NC
389PERLVAR(I, stdingv, GV *) /* *STDIN */
390PERLVAR(I, stderrgv, GV *) /* *STDERR */
115ff745
NC
391PERLVAR(I, argvgv, GV *) /* *ARGV */
392PERLVAR(I, argvoutgv, GV *) /* *ARGVOUT */
393PERLVAR(I, argvout_stack, AV *)
49f531da
NIS
394
395/* shortcuts to regexp stuff */
115ff745 396PERLVAR(I, replgv, GV *) /* *^R */
49f531da
NIS
397
398/* shortcuts to misc objects */
115ff745 399PERLVAR(I, errgv, GV *) /* *@ */
49f531da
NIS
400
401/* shortcuts to debugging objects */
115ff745
NC
402PERLVAR(I, DBgv, GV *) /* *DB::DB */
403PERLVAR(I, DBline, GV *) /* *DB::line */
954c1994
GS
404
405/*
2eb25c99 406=for apidoc mn|GV *|PL_DBsub
954c1994
GS
407When Perl is run in debugging mode, with the B<-d> switch, this GV contains
408the SV which holds the name of the sub being debugged. This is the C
409variable which corresponds to Perl's $DB::sub variable. See
fbe13c60 410C<L</PL_DBsingle>>.
954c1994 411
2eb25c99 412=for apidoc mn|SV *|PL_DBsingle
954c1994 413When Perl is run in debugging mode, with the B<-d> switch, this SV is a
7889fe52 414boolean which indicates whether subs are being single-stepped.
954c1994
GS
415Single-stepping is automatically turned on after every step. This is the C
416variable which corresponds to Perl's $DB::single variable. See
fbe13c60 417C<L</PL_DBsub>>.
954c1994 418
2eb25c99 419=for apidoc mn|SV *|PL_DBtrace
954c1994
GS
420Trace variable used when Perl is run in debugging mode, with the B<-d>
421switch. This is the C variable which corresponds to Perl's $DB::trace
fbe13c60 422variable. See C<L</PL_DBsingle>>.
954c1994
GS
423
424=cut
425*/
426
115ff745
NC
427PERLVAR(I, DBsub, GV *) /* *DB::sub */
428PERLVAR(I, DBsingle, SV *) /* $DB::single */
429PERLVAR(I, DBtrace, SV *) /* $DB::trace */
430PERLVAR(I, DBsignal, SV *) /* $DB::signal */
431PERLVAR(I, dbargs, AV *) /* args to call listed by caller function */
49f531da 432
a6d69523
TC
433PERLVARA(I, DBcontrol, DBVARMG_COUNT, IV) /* IV versions of $DB::single, trace, signal */
434
49f531da 435/* symbol tables */
115ff745
NC
436PERLVAR(I, debstash, HV *) /* symbol table for perldb package */
437PERLVAR(I, globalstash, HV *) /* global keyword overrides imported here */
438PERLVAR(I, curstname, SV *) /* name of current package */
439PERLVAR(I, beginav, AV *) /* names of BEGIN subroutines */
440PERLVAR(I, endav, AV *) /* names of END subroutines */
441PERLVAR(I, unitcheckav, AV *) /* names of UNITCHECK subroutines */
442PERLVAR(I, checkav, AV *) /* names of CHECK subroutines */
443PERLVAR(I, initav, AV *) /* names of INIT subroutines */
49f531da 444
49f531da 445/* subprocess state */
115ff745 446PERLVAR(I, fdpid, AV *) /* keep fd-to-pid mappings for my_popen */
49f531da
NIS
447
448/* internal state */
115ff745 449PERLVARI(I, op_mask, char *, NULL) /* masked operations for safe evals */
49f531da 450
49f531da 451/* current interpreter roots */
115ff745
NC
452PERLVAR(I, main_cv, CV *)
453PERLVAR(I, main_root, OP *)
454PERLVAR(I, main_start, OP *)
455PERLVAR(I, eval_root, OP *)
456PERLVAR(I, eval_start, OP *)
49f531da
NIS
457
458/* runtime control stuff */
115ff745 459PERLVARI(I, curcopdb, COP *, NULL)
49f531da 460
115ff745
NC
461PERLVAR(I, filemode, int) /* so nextargv() can preserve mode */
462PERLVAR(I, lastfd, int) /* what to preserve mode on */
463PERLVAR(I, oldname, char *) /* what to preserve mode on */
00accf8d
NC
464/* Elements in this array have ';' appended and are injected as a single line
465 into the tokeniser. You can't put any (literal) newlines into any program
466 you stuff in into this array, as the point where it's injected is expecting
467 a single physical line. */
115ff745
NC
468PERLVAR(I, preambleav, AV *)
469PERLVAR(I, mess_sv, SV *)
470PERLVAR(I, ors_sv, SV *) /* output record separator $\ */
19bc2726 471
79968a97
NC
472/* funky return mechanisms */
473PERLVAR(I, forkprocess, int) /* so do_open |- can return proc# */
474
71eebe1e 475/* statics moved here for shared library purposes */
115ff745
NC
476PERLVARI(I, gensym, I32, 0) /* next symbol for getsym() to define */
477PERLVARI(I, cv_has_eval, bool, FALSE) /* PL_compcv includes an entereval or similar */
478PERLVAR(I, taint_warn, bool) /* taint warns instead of dying */
479PERLVARI(I, laststype, U16, OP_STAT)
19bc2726 480
115ff745 481PERLVARI(I, laststatval, int, -1)
d4cce5f1 482
19bc2726
DM
483PERLVAR(I, modcount, I32) /* how much op_lvalue()ification in
484 assignment? */
485
4b556e6c 486/* interpreter atexit processing */
115ff745
NC
487PERLVARI(I, exitlistlen, I32, 0) /* length of same */
488PERLVARI(I, exitlist, PerlExitListEntry *, NULL)
cb68f92d 489 /* list of exit functions */
954c1994
GS
490
491/*
492=for apidoc Amn|HV*|PL_modglobal
493
7889fe52 494C<PL_modglobal> is a general purpose, interpreter global HV for use by
954c1994 495extensions that need to keep information on a per-interpreter basis.
7889fe52
NIS
496In a pinch, it can also be used as a symbol table for extensions
497to share data among each other. It is a good idea to use keys
954c1994
GS
498prefixed by the package name of the extension that owns the data.
499
500=cut
501*/
502
115ff745 503PERLVAR(I, modglobal, HV *) /* per-interp module data */
cb68f92d
GS
504
505/* these used to be in global before 5.004_68 */
115ff745 506PERLVARI(I, profiledata, U32 *, NULL) /* table of ops, counts */
cb68f92d 507
115ff745 508PERLVAR(I, compiling, COP) /* compiling/done executing marker */
cb68f92d 509
115ff745 510PERLVAR(I, compcv, CV *) /* currently compiling subroutine */
36c300bb 511PERLVAR(I, comppad_name, PADNAMELIST *) /* variable names for "my" variables */
d12be05d
DM
512PERLVAR(I, comppad_name_fill, PADOFFSET)/* last "introduced" variable offset */
513PERLVAR(I, comppad_name_floor, PADOFFSET)/* start of vars in innermost block */
4b556e6c
JD
514
515#ifdef HAVE_INTERP_INTERN
115ff745 516PERLVAR(I, sys_intern, struct interp_intern)
cb68f92d 517 /* platform internals */
4b556e6c
JD
518#endif
519
7fae4e64 520/* more statics moved here */
115ff745 521PERLVAR(I, DBcv, CV *) /* from perl.c */
75010704
DM
522PERLVARI(I, generation, int, 100) /* scan sequence# for OP_AASSIGN
523 compile-time common elem detection */
56953603 524
19bc2726
DM
525PERLVAR(I, unicode, U32) /* Unicode features: $ENV{PERL_UNICODE} or -C */
526
115ff745
NC
527PERLVARI(I, in_clean_objs,bool, FALSE) /* from sv.c */
528PERLVARI(I, in_clean_all, bool, FALSE) /* ptrs to freed SVs now legal */
529PERLVAR(I, nomemok, bool) /* let malloc context handle nomem */
530PERLVARI(I, savebegin, bool, FALSE) /* save BEGINs for compiler */
7fae4e64 531
19bc2726 532
985213f2
AB
533PERLVAR(I, delaymagic_uid, Uid_t) /* current real user id, only for delaymagic */
534PERLVAR(I, delaymagic_euid, Uid_t) /* current effective user id, only for delaymagic */
535PERLVAR(I, delaymagic_gid, Gid_t) /* current real group id, only for delaymagic */
536PERLVAR(I, delaymagic_egid, Gid_t) /* current effective group id, only for delaymagic */
115ff745 537PERLVARI(I, an, U32, 0) /* malloc sequence number */
be2b6a89 538
79968a97
NC
539/* Perl_Ibreakable_sub_generation_ptr was too long for VMS, hence "gen" */
540PERLVARI(I, breakable_sub_gen, U32, 0)
541
be2b6a89
DM
542#ifdef DEBUGGING
543 /* exercise wrap-around */
544 #define PERL_COP_SEQMAX (U32_MAX-50)
545#else
546 #define PERL_COP_SEQMAX 0
547#endif
115ff745 548PERLVARI(I, cop_seqmax, U32, PERL_COP_SEQMAX) /* statement sequence number */
be2b6a89
DM
549#undef PERL_COP_SEQMAX
550
115ff745
NC
551PERLVARI(I, evalseq, U32, 0) /* eval sequence number */
552PERLVAR(I, origalen, U32)
553PERLVAR(I, origenviron, char **)
ca0c25f6 554#ifdef PERL_USES_PL_PIDSTATUS
115ff745 555PERLVAR(I, pidstatus, HV *) /* pid-to-status mappings for waitpid */
ca0c25f6 556#endif
115ff745 557PERLVAR(I, osname, char *) /* operating system */
5c728af0 558
115ff745 559PERLVAR(I, sighandlerp, Sighandler_t)
0672f40e 560
115ff745 561PERLVARA(I, body_roots, PERL_ARENA_ROOTS_SIZE, void*) /* array of body roots */
93e68bfb 562
8162b70e 563PERLVAR(I, debug, volatile U32) /* flags given to -D switch */
79968a97 564
e897f2d7 565PERLVARI(I, padlist_generation, U32, 1) /* id to identify padlist clones */
9f7da6d5 566
115ff745 567PERLVARI(I, runops, runops_proc_t, RUNOPS_DEFAULT)
0672f40e 568
115ff745 569PERLVAR(I, subname, SV *) /* name of current subroutine */
0672f40e 570
115ff745 571PERLVAR(I, subline, I32) /* line this subroutine began on */
d12be05d 572PERLVAR(I, min_intro_pending, PADOFFSET)/* start of vars to introduce */
d95e864f 573
d12be05d
DM
574PERLVAR(I, max_intro_pending, PADOFFSET)/* end of vars to introduce */
575PERLVAR(I, padix, PADOFFSET) /* lowest unused index - 1
8ce2f624 576 in current "register" pad */
d12be05d 577PERLVAR(I, constpadix, PADOFFSET) /* lowest unused for constants */
d95e864f 578
d12be05d 579PERLVAR(I, padix_floor, PADOFFSET) /* how low may inner block reset padix */
0672f40e 580
e9bc6d6b
KW
581#if defined(USE_POSIX_2008_LOCALE) \
582 && defined(USE_THREAD_SAFE_LOCALE) \
583 && ! defined(HAS_QUERYLOCALE)
584
585PERLVARA(I, curlocales, 12, char *)
586
587#endif
0672f40e 588#ifdef USE_LOCALE_COLLATE
e9bc6d6b 589
115ff745
NC
590PERLVAR(I, collation_name, char *) /* Name of current collation */
591PERLVAR(I, collxfrm_base, Size_t) /* Basic overhead in *xfrm() */
592PERLVARI(I, collxfrm_mult,Size_t, 2) /* Expansion factor in *xfrm() */
593PERLVARI(I, collation_ix, U32, 0) /* Collation generation index */
f28f4d2a 594PERLVARI(I, strxfrm_NUL_replacement, U8, 0) /* Code point to replace NULs */
c664130f
KW
595PERLVARI(I, strxfrm_is_behaved, bool, TRUE)
596 /* Assume until proven otherwise that it works */
a4a439fb 597PERLVARI(I, strxfrm_max_cp, U8, 0) /* Highest collating cp in locale */
115ff745 598PERLVARI(I, collation_standard, bool, TRUE)
9f7da6d5 599 /* Assume simple collation */
0672f40e
GS
600#endif /* USE_LOCALE_COLLATE */
601
f7416781
KW
602PERLVARI(I, langinfo_buf, char *, NULL)
603PERLVARI(I, langinfo_bufsize, Size_t, 0)
9aac5db8
KW
604PERLVARI(I, setlocale_buf, char *, NULL)
605PERLVARI(I, setlocale_bufsize, Size_t, 0)
f7416781 606
19bc2726
DM
607#ifdef PERL_SAWAMPERSAND
608PERLVAR(I, sawampersand, U8) /* must save all match strings */
9f7da6d5 609#endif
95ca8690 610
19bc2726 611PERLVAR(I, unsafe, bool)
87c1d905 612PERLVAR(I, colorset, bool) /* PERL_RE_COLORS env var is in use */
19bc2726 613
79968a97
NC
614/* current phase the interpreter is in
615 for ordering this structure to remove holes, we're assuming that this is 4
616 bytes. */
617PERLVARI(I, phase, enum perl_phase, PERL_PHASE_CONSTRUCT)
618
619PERLVARI(I, in_load_module, bool, FALSE) /* to prevent recursions in PerlIO_find_layer */
620
621/* This value may be set when embedding for full cleanup */
622/* 0=none, 1=full, 2=full with checks */
623/* mod_perl is special, and also assigns a meaning -1 */
624PERLVARI(I, perl_destruct_level, signed char, 0)
9f7da6d5 625
0672f40e
GS
626#ifdef USE_LOCALE_NUMERIC
627
7738054c 628PERLVARI(I, numeric_standard, int, TRUE)
892e6465
KW
629 /* Assume C locale numerics */
630PERLVARI(I, numeric_underlying, bool, TRUE)
631 /* Assume underlying locale numerics */
4c68b815 632PERLVARI(I, numeric_underlying_is_standard, bool, TRUE)
115ff745
NC
633PERLVAR(I, numeric_name, char *) /* Name of current numeric locale */
634PERLVAR(I, numeric_radix_sv, SV *) /* The radix separator if not '.' */
f8115845 635
7e5377f7 636# ifdef HAS_POSIX_2008_LOCALE
e1aa2579
KW
637
638PERLVARI(I, underlying_numeric_obj, locale_t, NULL)
639
640# endif
0672f40e
GS
641#endif /* !USE_LOCALE_NUMERIC */
642
a3e1f3a6 643/* utf8 character class swashes */
34aeb2e9 644PERLVAR(I, seen_deprecated_macro, HV *)
cac6e0ca 645
115ff745
NC
646PERLVAR(I, last_swash_hv, HV *)
647PERLVAR(I, last_swash_tmps, U8 *)
648PERLVAR(I, last_swash_slen, STRLEN)
6c2f1a55 649PERLVARA(I, last_swash_key,UTF8_MAXBYTES-1, U8)
45d91b83 650PERLVAR(I, last_swash_klen, U8) /* Only needs to store 0-12 */
d95e864f
NC
651
652#ifdef FCRYPT
115ff745 653PERLVARI(I, cryptseen, bool, FALSE) /* has fast crypt() been initialized? */
79968a97
NC
654#else
655/* One byte hole in the interpreter structure. */
d95e864f
NC
656#endif
657
115ff745 658PERLVAR(I, pad_reset_pending, bool) /* reset pad on next attempted alloc */
e6b4660c 659PERLVAR(I, srand_called, bool)
12fbd33b 660
c4a30c8c
NC
661/* Array of signal handlers, indexed by signal number, through which the C
662 signal handler dispatches. */
115ff745 663PERLVAR(I, psig_ptr, SV **)
c4a30c8c 664/* Array of names of signals, indexed by signal number, for (re)use as the first
d525a7b2
NC
665 argument to a signal handler. Only one block of memory is allocated for
666 both psig_name and psig_ptr. */
115ff745 667PERLVAR(I, psig_name, SV **)
1d7c1841 668
c5be433b 669#if defined(PERL_IMPLICIT_SYS)
115ff745
NC
670PERLVAR(I, Mem, struct IPerlMem *)
671PERLVAR(I, MemShared, struct IPerlMem *)
672PERLVAR(I, MemParse, struct IPerlMem *)
673PERLVAR(I, Env, struct IPerlEnv *)
674PERLVAR(I, StdIO, struct IPerlStdIO *)
675PERLVAR(I, LIO, struct IPerlLIO *)
676PERLVAR(I, Dir, struct IPerlDir *)
677PERLVAR(I, Sock, struct IPerlSock *)
678PERLVAR(I, Proc, struct IPerlProc *)
76e3520e 679#endif
1d7c1841 680
115ff745
NC
681PERLVAR(I, ptr_table, PTR_TBL_t *)
682PERLVARI(I, beginav_save, AV *, NULL) /* save BEGIN{}s when compiling */
f180df80 683
115ff745 684PERLVAR(I, body_arenas, void *) /* pointer to list of body-arenas */
93e68bfb 685
d95e864f 686
1fcf4c12 687#if defined(USE_ITHREADS)
115ff745 688PERLVAR(I, regex_pad, SV **) /* Shortcut into the array of
e6853197 689 regex_padav */
115ff745 690PERLVAR(I, regex_padav, AV *) /* All regex objects, indexed via the
e6853197 691 values in op_pmoffset of pmop.
402d2eb1
NC
692 Entry 0 is an SV whose PV is a
693 "packed" list of IVs listing
e6853197 694 the now-free slots in the array */
d4d03940
FC
695PERLVAR(I, stashpad, HV **) /* for CopSTASH */
696PERLVARI(I, stashpadmax, PADOFFSET, 64)
697PERLVARI(I, stashpadix, PADOFFSET, 0)
1fcf4c12
AB
698#endif
699
ea68fd67 700#ifdef USE_REENTRANT_API
115ff745 701PERLVAR(I, reentrant_buffer, REENTR *) /* here we store the _r buffers */
f5a82810
JH
702#endif
703
115ff745
NC
704PERLVAR(I, custom_op_names, HV *) /* Names of user defined ops */
705PERLVAR(I, custom_op_descs, HV *) /* Descriptions of user defined ops */
19e8ce8e 706
a1ea730d 707#ifdef PERLIO_LAYERS
115ff745
NC
708PERLVARI(I, perlio, PerlIOl *, NULL)
709PERLVARI(I, known_layers, PerlIO_list_t *, NULL)
710PERLVARI(I, def_layerlist, PerlIO_list_t *, NULL)
a1ea730d
NIS
711#endif
712
115ff745 713PERLVAR(I, sort_RealCmp, SVCOMPARE_t)
147f47de 714
115ff745
NC
715PERLVARI(I, checkav_save, AV *, NULL) /* save CHECK{}s when compiling */
716PERLVARI(I, unitcheckav_save, AV *, NULL)
717 /* save UNITCHECK{}s when compiling */
ece599bd 718
115ff745 719PERLVARI(I, clocktick, long, 0) /* this many times() ticks in a second */
5311654c 720
15a5279a 721/* Hooks to shared SVs and locks. */
115ff745
NC
722PERLVARI(I, sharehook, share_proc_t, Perl_sv_nosharing)
723PERLVARI(I, lockhook, share_proc_t, Perl_sv_nosharing)
d0647d4e
NC
724#ifdef NO_MATHOMS
725# define PERL_UNLOCK_HOOK Perl_sv_nosharing
726#else
727/* This reference ensures that the mathoms are linked with perl */
728# define PERL_UNLOCK_HOOK Perl_sv_nounlocking
729#endif
115ff745 730PERLVARI(I, unlockhook, share_proc_t, PERL_UNLOCK_HOOK)
d0647d4e 731
115ff745 732PERLVARI(I, threadhook, thrhook_proc_t, Perl_nothreadhook)
15a5279a 733
9e08d3a4 734/* Can shared object be destroyed */
115ff745 735PERLVARI(I, destroyhook, destroyable_proc_t, Perl_sv_destroyable)
9e08d3a4 736
01d65469 737#ifndef PERL_MICRO
115ff745 738PERLVARI(I, signalhook, despatch_signals_proc_t, Perl_despatch_signals)
01d65469 739#endif
92f022bb 740
115ff745 741PERLVARI(I, isarev, HV *, NULL) /* Reverse map of @ISA dependencies */
f16dd614 742
9e08d3a4
NC
743/* Register of known Method Resolution Orders.
744 What this actually points to is an implementation detail (it may change to
745 a structure incorporating a reference count - use mro_get_from_name to
746 retrieve a C<struct mro_alg *> */
115ff745 747PERLVAR(I, registered_mros, HV *)
9e08d3a4
NC
748
749/* Compile-time block start/end hooks */
115ff745 750PERLVAR(I, blockhooks, AV *)
9e08d3a4 751
115ff745 752PERLVAR(I, custom_ops, HV *) /* custom op registrations */
9e08d3a4 753
19bc2726
DM
754PERLVAR(I, Xpv, XPV *) /* (unused) held temporary value */
755
756/* name of the scopes we've ENTERed. Only used with -DDEBUGGING, but needs to be
757 present always, as -DDEBUGGING must be binary compatible with non. */
758PERLVARI(I, scopestack_name, const char * *, NULL)
759
760PERLVAR(I, debug_pad, struct perl_debug_pad) /* always needed because of the re extension */
761
d67594ff
FC
762/* Hook for File::Glob */
763PERLVARI(I, globhook, globhook_t, NULL)
764
436227c7 765/* The last unconditional member of the interpreter structure when 5.18.0 was
ffee3ff6
NC
766 released. The offset of the end of this is baked into a global variable in
767 any shared perl library which will allow a sanity test in future perl
768 releases. */
d399cf59 769#define PERL_LAST_5_18_0_INTERP_MEMBER Iglobhook
ffee3ff6 770
f16dd614 771#ifdef PERL_IMPLICIT_CONTEXT
115ff745 772PERLVARI(I, my_cxt_list, void **, NULL) /* per-module array of MY_CXT pointers */
817b0f24 773PERLVARI(I, my_cxt_size, int, 0) /* size of PL_my_cxt_list */
ba6d381e 774# ifdef PERL_GLOBAL_STRUCT_PRIVATE
115ff745 775PERLVARI(I, my_cxt_keys, const char **, NULL) /* per-module array of pointers to MY_CXT_KEY constants */
ba6d381e 776# endif
f16dd614
DM
777#endif
778
0419d978 779#if defined(PERL_IMPLICIT_CONTEXT) || defined(PERL_DEBUG_READONLY_COW)
5ca5a628 780/* For use with the memory debugging code in util.c. This is used only in
0419d978
AC
781 * DEBUGGING builds (as long as the relevant structure is defined), but
782 * defining it in non-debug builds too means that we retain binary
783 * compatibility between otherwise-compatible plain and debug builds. */
115ff745 784PERLVAR(I, memory_debug_header, struct perl_memory_debug_header)
0419d978 785#endif
7cb608b5 786
ba6d381e
NC
787#ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
788/* File descriptor to talk to the child which dumps scalars. */
115ff745 789PERLVARI(I, dumper_fd, int, -1)
ba6d381e
NC
790#endif
791
ba6d381e 792
d7a2c63c 793#ifdef DEBUG_LEAKING_SCALARS
115ff745 794PERLVARI(I, sv_serial, U32, 0) /* SV serial number, used in sv.c */
d7a2c63c
MHM
795#endif
796
a38ab475
RZ
797PERLVARA(I, sv_consts, SV_CONSTS_COUNT, SV*) /* constant SVs with precomputed hash value */
798
75d476e2
S
799#ifdef PERL_TRACE_OPS
800PERLVARA(I, op_exec_cnt, OP_max+2, UV) /* Counts of executed OPs of the given type.
801 If PERL_TRACE_OPS is enabled, we'll dump
802 a summary count of all ops executed in the
803 program at perl_destruct time. For
804 profiling/debugging only. Works only if
805 DEBUGGING is enabled, too. */
806#endif
807
3be8f094
TC
808PERLVAR(I, random_state, PL_RANDOM_STATE_TYPE)
809
eecd4d11 810PERLVARI(I, dump_re_max_len, STRLEN, 60)
2bfbbbaf 811
f26b33bd
TC
812/* For internal uses of randomness, this ensures the sequence of
813 * random numbers returned by rand() isn't modified by perl's internal
814 * use of randomness.
815 * This is important if the user has called srand() with a seed.
816 */
817
818PERLVAR(I, internal_random_state, PL_RANDOM_STATE_TYPE)
819
157b3822
NC
820/* If you are adding a U8 or U16, check to see if there are 'Space' comments
821 * above on where there are gaps which currently will be structure padding. */
d95e864f
NC
822
823/* Within a stable branch, new variables must be added to the very end, before
824 * this comment, for binary compatibility (the offsets of the old members must
825 * not change).
b83cd129 826 * (Don't forget to add your variable also to perl_clone()!)
e3acbfda 827 * XSUB.h provides wrapper functions via perlapi.h that make this
b83cd129
JH
828 * irrelevant, but not all code may be expected to #include XSUB.h.
829 */