This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Copyright++. (Not all the toplevel *.h have one, it seems.)
[perl5.git] / thrdvar.h
CommitLineData
ccfc67b7
JH
1/*
2=head1 Global Variables
3*/
4
cb68f92d
GS
5/***********************************************/
6/* Global only to current thread */
7/***********************************************/
8
8b3be1d1
JP
9/* Don't forget to re-run embed.pl to propagate changes! */
10
cb68f92d 11/* The 'T' prefix is only needed for vars that need appropriate #defines
4d1ff10f 12 * generated when built with or without USE_5005THREADS. It is also used
cb68f92d
GS
13 * to generate the appropriate export list for win32.
14 *
4d1ff10f
AB
15 * When building without USE_5005THREADS, these variables will be truly global.
16 * When building without USE_5005THREADS but with MULTIPLICITY, these variables
14dd3ad8 17 * will be global per-interpreter. */
8b3be1d1 18
49f531da 19/* Important ones in the first cache line (if alignment is done right) */
d4cce5f1 20
4d1ff10f 21#ifdef USE_5005THREADS
c5be433b
GS
22PERLVAR(interp, PerlInterpreter*) /* thread owner */
23#endif
24
cb68f92d 25PERLVAR(Tstack_sp, SV **) /* top of the stack */
49f531da 26#ifdef OP_IN_REGISTER
cb68f92d 27PERLVAR(Topsave, OP *)
49f531da 28#else
cb68f92d 29PERLVAR(Top, OP *) /* currently executing op */
49f531da 30#endif
cb68f92d
GS
31PERLVAR(Tcurpad, SV **) /* active pad (lexicals+tmps) */
32
33PERLVAR(Tstack_base, SV **)
34PERLVAR(Tstack_max, SV **)
35
36PERLVAR(Tscopestack, I32 *) /* scopes we've ENTERed */
37PERLVAR(Tscopestack_ix, I32)
38PERLVAR(Tscopestack_max,I32)
49f531da 39
cb68f92d
GS
40PERLVAR(Tsavestack, ANY *) /* items that need to be restored
41 when LEAVEing scopes we've ENTERed */
42PERLVAR(Tsavestack_ix, I32)
43PERLVAR(Tsavestack_max, I32)
49f531da 44
cb68f92d
GS
45PERLVAR(Ttmps_stack, SV **) /* mortals we've made */
46PERLVARI(Ttmps_ix, I32, -1)
47PERLVARI(Ttmps_floor, I32, -1)
48PERLVAR(Ttmps_max, I32)
49f531da 49
cb68f92d
GS
50PERLVAR(Tmarkstack, I32 *) /* stack_sp locations we're remembering */
51PERLVAR(Tmarkstack_ptr, I32 *)
52PERLVAR(Tmarkstack_max, I32 *)
49f531da 53
cb68f92d
GS
54PERLVAR(Tretstack, OP **) /* OPs we have postponed executing */
55PERLVAR(Tretstack_ix, I32)
56PERLVAR(Tretstack_max, I32)
49f531da 57
cb68f92d
GS
58PERLVAR(TSv, SV *) /* used to hold temporary values */
59PERLVAR(TXpv, XPV *) /* used to hold temporary values */
954c1994
GS
60
61/*
62=for apidoc Amn|STRLEN|PL_na
63
64A convenience variable which is typically used with C<SvPV> when one
65doesn't care about the length of the string. It is usually more efficient
66to either declare a local variable and use that instead or to use the
67C<SvPV_nolen> macro.
68
69=cut
70*/
71
b099ddc0
GS
72PERLVAR(Tna, STRLEN) /* for use in SvPV when length is
73 Not Applicable */
49f531da 74
5c0ca799 75/* stat stuff */
cb68f92d 76PERLVAR(Tstatbuf, Stat_t)
5c0ca799
GS
77PERLVAR(Tstatcache, Stat_t) /* _ */
78PERLVAR(Tstatgv, GV *)
79PERLVARI(Tstatname, SV *, Nullsv)
80
49f531da 81#ifdef HAS_TIMES
cb68f92d 82PERLVAR(Ttimesbuf, struct tms)
49f531da 83#endif
49f531da
NIS
84
85/* Fields used by magic variables such as $@, $/ and so on */
d4cce5f1 86PERLVAR(Ttainted, bool) /* using variables controlled by $< */
cb68f92d 87PERLVAR(Tcurpm, PMOP *) /* what to do \ interps in REs from */
b7ac61fa 88PERLVAR(Tnrs, SV *) /* placeholder: unused since 5.8.0 (5.7.2 patch #12027 for bug ID 20010815.012) */
c155e47c
SC
89
90/*
2eb25c99 91=for apidoc mn|SV*|PL_rs
c155e47c
SC
92
93The input record separator - C<$/> in Perl space.
94
2eb25c99 95=for apidoc mn|GV*|PL_last_in_gv
c155e47c
SC
96
97The GV which was last used for a filehandle input operation. (C<< <FH> >>)
98
2eb25c99 99=for apidoc mn|SV*|PL_ofs_sv
c155e47c
SC
100
101The output field separator - C<$,> in Perl space.
102
103=cut
104*/
105
cb68f92d
GS
106PERLVAR(Trs, SV *) /* input record separator $/ */
107PERLVAR(Tlast_in_gv, GV *) /* GV used in last <FH> */
7889fe52 108PERLVAR(Tofs_sv, SV *) /* output field separator $, */
cb68f92d 109PERLVAR(Tdefoutgv, GV *) /* default FH for output */
d4cce5f1 110PERLVARI(Tchopset, char *, " \n-") /* $: */
cb68f92d
GS
111PERLVAR(Tformtarget, SV *)
112PERLVAR(Tbodytarget, SV *)
113PERLVAR(Ttoptarget, SV *)
49f531da 114
d4cce5f1
NIS
115/* Stashes */
116PERLVAR(Tdefstash, HV *) /* main symbol table */
117PERLVAR(Tcurstash, HV *) /* symbol table for current package */
49f531da 118
cb68f92d 119PERLVAR(Trestartop, OP *) /* propagating an error from croak? */
3280af22 120PERLVARI(Tcurcop, COP * VOL, &PL_compiling)
d4cce5f1
NIS
121PERLVAR(Tin_eval, VOL int) /* trap "fatal" errors? */
122PERLVAR(Tdelaymagic, int) /* ($<,$>) = ... */
24d3c518 123PERLVARI(Tdirty, bool, FALSE) /* in the middle of tearing things down? */
61bb5906 124PERLVAR(Tlocalizing, int) /* are we processing a local() list? */
49f531da 125
cb68f92d
GS
126PERLVAR(Tcurstack, AV *) /* THE STACK */
127PERLVAR(Tcurstackinfo, PERL_SI *) /* current stack + context */
128PERLVAR(Tmainstack, AV *) /* the stack when nothing funny is happening */
312caa8e 129
cb68f92d
GS
130PERLVAR(Ttop_env, JMPENV *) /* ptr. to current sigjmp() environment */
131PERLVAR(Tstart_env, JMPENV) /* empty startup sigjmp() environment */
14dd3ad8 132#ifdef PERL_FLEXIBLE_EXCEPTIONS
0b94c7bb 133PERLVARI(Tprotect, protect_proc_t, MEMBER_TO_FPTR(Perl_default_protect))
14dd3ad8 134#endif
5a844595 135PERLVARI(Terrors, SV *, Nullsv) /* outstanding queued errors */
49f531da 136
4e4c362e 137/* statics "owned" by various functions */
cb68f92d
GS
138PERLVAR(Tav_fetch_sv, SV *) /* owned by av_fetch() */
139PERLVAR(Thv_fetch_sv, SV *) /* owned by hv_fetch() */
140PERLVAR(Thv_fetch_ent_mh, HE) /* owned by hv_fetch_ent() */
141
142PERLVAR(Tmodcount, I32) /* how much mod()ification in assignment? */
4e4c362e 143
5c0ca799 144PERLVAR(Tlastgotoprobe, OP*) /* from pp_ctl.c */
3967c732 145PERLVARI(Tdumpindent, I32, 4) /* # of blanks per dump indentation level */
5c0ca799
GS
146
147/* sort stuff */
148PERLVAR(Tsortcop, OP *) /* user defined sort routine */
149PERLVAR(Tsortstash, HV *) /* which is in some package or other */
150PERLVAR(Tfirstgv, GV *) /* $a */
151PERLVAR(Tsecondgv, GV *) /* $b */
152PERLVAR(Tsortcxix, I32) /* from pp_ctl.c */
153
7d5ea4e7
GS
154/* float buffer */
155PERLVAR(Tefloatbuf, char*)
156PERLVAR(Tefloatsize, STRLEN)
157
5c0ca799
GS
158/* regex stuff */
159
160PERLVAR(Tscreamfirst, I32 *)
161PERLVAR(Tscreamnext, I32 *)
162PERLVARI(Tmaxscream, I32, -1)
163PERLVAR(Tlastscream, SV *)
164
165PERLVAR(Tregdummy, regnode) /* from regcomp.c */
166PERLVAR(Tregcomp_parse, char*) /* Input-scan pointer. */
167PERLVAR(Tregxend, char*) /* End of input for compile */
168PERLVAR(Tregcode, regnode*) /* Code-emit pointer; &regdummy = don't */
169PERLVAR(Tregnaughty, I32) /* How bad is this pattern? */
170PERLVAR(Tregsawback, I32) /* Did we see \1, ...? */
171PERLVAR(Tregprecomp, char *) /* uncompiled string. */
172PERLVAR(Tregnpar, I32) /* () count. */
173PERLVAR(Tregsize, I32) /* Code size. */
174PERLVAR(Tregflags, U16) /* are we folding, multilining? */
175PERLVAR(Tregseen, U32) /* from regcomp.c */
176PERLVAR(Tseen_zerolen, I32) /* from regcomp.c */
177PERLVAR(Tseen_evals, I32) /* from regcomp.c */
178PERLVAR(Tregcomp_rx, regexp *) /* from regcomp.c */
179PERLVAR(Textralen, I32) /* from regcomp.c */
180PERLVAR(Tcolorset, int) /* from regcomp.c */
51371543 181PERLVARA(Tcolors,6, char *) /* from regcomp.c */
82ba1be6 182PERLVAR(Treg_whilem_seen, I32) /* number of WHILEM in this expr */
5c0ca799
GS
183PERLVAR(Treginput, char *) /* String-input pointer. */
184PERLVAR(Tregbol, char *) /* Beginning of input, for ^ check. */
185PERLVAR(Tregeol, char *) /* End of input, for $ check. */
cf93c79d
IZ
186PERLVAR(Tregstartp, I32 *) /* Pointer to startp array. */
187PERLVAR(Tregendp, I32 *) /* Ditto for endp. */
5c0ca799 188PERLVAR(Treglastparen, U32 *) /* Similarly for lastparen. */
a01268b5 189PERLVAR(Treglastcloseparen, U32 *) /* Similarly for lastcloseparen. */
5c0ca799 190PERLVAR(Tregtill, char *) /* How far we are required to go. */
31376155 191PERLVAR(Tregcompat1, char) /* used to be regprev1 */
5c0ca799
GS
192PERLVAR(Treg_start_tmp, char **) /* from regexec.c */
193PERLVAR(Treg_start_tmpl,U32) /* from regexec.c */
194PERLVAR(Tregdata, struct reg_data *)
195 /* from regexec.c renamed was data */
196PERLVAR(Tbostr, char *) /* from regexec.c */
197PERLVAR(Treg_flags, U32) /* from regexec.c */
198PERLVAR(Treg_eval_set, I32) /* from regexec.c */
199PERLVAR(Tregnarrate, I32) /* from regexec.c */
200PERLVAR(Tregprogram, regnode *) /* from regexec.c */
201PERLVARI(Tregindent, int, 0) /* from regexec.c */
202PERLVAR(Tregcc, CURCUR *) /* from regexec.c */
0f5d15d6
IZ
203PERLVAR(Treg_call_cc, struct re_cc_state *) /* from regexec.c */
204PERLVAR(Treg_re, regexp *) /* from regexec.c */
22e551b9
IZ
205PERLVAR(Treg_ganch, char *) /* position of \G */
206PERLVAR(Treg_sv, SV *) /* what we match against */
9661b544
IZ
207PERLVAR(Treg_magic, MAGIC *) /* pos-magic of what we match */
208PERLVAR(Treg_oldpos, I32) /* old pos of what we match */
5c5e4c24
IZ
209PERLVARI(Treg_oldcurpm, PMOP*, NULL) /* curpm before match */
210PERLVARI(Treg_curpm, PMOP*, NULL) /* curpm during match */
cf93c79d
IZ
211PERLVAR(Treg_oldsaved, char*) /* old saved substr during match */
212PERLVAR(Treg_oldsavedlen, STRLEN) /* old length of saved substr during match */
82ba1be6
IZ
213PERLVAR(Treg_maxiter, I32) /* max wait until caching pos */
214PERLVAR(Treg_leftiter, I32) /* wait until caching pos */
215PERLVARI(Treg_poscache, char *, Nullch) /* cache of pos of WHILEM */
216PERLVAR(Treg_poscache_size, STRLEN) /* size of pos cache of WHILEM */
5c0ca799 217
a2efc822
SC
218PERLVARI(Tpeepp, peep_t, MEMBER_TO_FPTR(Perl_peep))
219 /* Pointer to peephole optimizer */
0b94c7bb 220PERLVARI(Tregcompp, regcomp_t, MEMBER_TO_FPTR(Perl_pregcomp))
f722798b 221 /* Pointer to REx compiler */
0b94c7bb 222PERLVARI(Tregexecp, regexec_t, MEMBER_TO_FPTR(Perl_regexec_flags))
f722798b 223 /* Pointer to REx executer */
0b94c7bb 224PERLVARI(Tregint_start, re_intuit_start_t, MEMBER_TO_FPTR(Perl_re_intuit_start))
f722798b 225 /* Pointer to optimized REx executer */
0b94c7bb 226PERLVARI(Tregint_string,re_intuit_string_t, MEMBER_TO_FPTR(Perl_re_intuit_string))
f722798b 227 /* Pointer to optimized REx string */
0b94c7bb 228PERLVARI(Tregfree, regfree_t, MEMBER_TO_FPTR(Perl_pregfree))
f722798b
IZ
229 /* Pointer to REx free()er */
230
57668c4d 231PERLVARI(Treginterp_cnt,int, 0) /* Whether `Regexp'
5c0ca799 232 was interpolated. */
364723c2 233PERLVARI(Treg_starttry, char *, 0) /* -Dr: where regtry was called. */
22c35a8c
GS
234PERLVARI(Twatchaddr, char **, 0)
235PERLVAR(Twatchok, char *)
d4cce5f1 236
8b3be1d1 237/* Note that the variables below are all explicitly referenced in the code
cb68f92d 238 * as thr->whatever and therefore don't need the 'T' prefix. */
8b3be1d1 239
4d1ff10f 240#ifdef USE_5005THREADS
49f531da 241
cb68f92d
GS
242PERLVAR(oursv, SV *)
243PERLVAR(cvcache, HV *)
244PERLVAR(self, perl_os_thread) /* Underlying thread object */
245PERLVAR(flags, U32)
246PERLVAR(threadsv, AV *) /* Per-thread SVs ($_, $@ etc.) */
247PERLVAR(threadsvp, SV **) /* AvARRAY(threadsv) */
248PERLVAR(specific, AV *) /* Thread-specific user data */
249PERLVAR(errsv, SV *) /* Backing SV for $@ */
cb68f92d
GS
250PERLVAR(mutex, perl_mutex) /* For the fields others can change */
251PERLVAR(tid, U32)
49f531da 252PERLVAR(prev, struct perl_thread *)
cb68f92d
GS
253PERLVAR(next, struct perl_thread *)
254 /* Circular linked list of threads */
49f531da
NIS
255
256#ifdef HAVE_THREAD_INTERN
cb68f92d
GS
257PERLVAR(i, struct thread_intern)
258 /* Platform-dependent internals */
49f531da
NIS
259#endif
260
cb68f92d 261PERLVAR(trailing_nul, char) /* For the sake of thrsv and oursv */
8dcd6f7b 262PERLVAR(thr_done, bool) /* True when the thread has finished */
d9f424b2 263
4d1ff10f 264#endif /* USE_5005THREADS */
d9f424b2 265
53c4c00c 266PERLVAR(Treg_match_utf8, bool) /* was what we matched against utf8 */
d9f424b2 267