This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
provide SvPV_nolen(sv) to avoid use of PL_na
[perl5.git] / thrdvar.h
1 /***********************************************/
2 /* Global only to current thread               */
3 /***********************************************/
4
5 /* Don't forget to re-run embed.pl to propagate changes! */
6
7 /* The 'T' prefix is only needed for vars that need appropriate #defines
8  * generated when built with or without USE_THREADS.  It is also used
9  * to generate the appropriate export list for win32.
10  *
11  * When building without USE_THREADS, these variables will be truly global.
12  * When building without USE_THREADS but with MULTIPLICITY, these variables
13  * will be global per-interpreter.
14  *
15  * Avoid build-specific #ifdefs here, like DEBUGGING.  That way,
16  * we can keep binary compatibility of the curinterp structure */
17
18 /* Important ones in the first cache line (if alignment is done right) */
19
20 PERLVAR(Tstack_sp,      SV **)          /* top of the stack */
21 #ifdef OP_IN_REGISTER
22 PERLVAR(Topsave,        OP *)
23 #else
24 PERLVAR(Top,            OP *)           /* currently executing op */
25 #endif
26 PERLVAR(Tcurpad,        SV **)          /* active pad (lexicals+tmps) */
27
28 PERLVAR(Tstack_base,    SV **)
29 PERLVAR(Tstack_max,     SV **)
30
31 PERLVAR(Tscopestack,    I32 *)          /* scopes we've ENTERed */
32 PERLVAR(Tscopestack_ix, I32)
33 PERLVAR(Tscopestack_max,I32)
34
35 PERLVAR(Tsavestack,     ANY *)          /* items that need to be restored
36                                            when LEAVEing scopes we've ENTERed */
37 PERLVAR(Tsavestack_ix,  I32)
38 PERLVAR(Tsavestack_max, I32)
39
40 PERLVAR(Ttmps_stack,    SV **)          /* mortals we've made */
41 PERLVARI(Ttmps_ix,      I32,    -1)
42 PERLVARI(Ttmps_floor,   I32,    -1)
43 PERLVAR(Ttmps_max,      I32)
44
45 PERLVAR(Tmarkstack,     I32 *)          /* stack_sp locations we're remembering */
46 PERLVAR(Tmarkstack_ptr, I32 *)
47 PERLVAR(Tmarkstack_max, I32 *)
48
49 PERLVAR(Tretstack,      OP **)          /* OPs we have postponed executing */
50 PERLVAR(Tretstack_ix,   I32)
51 PERLVAR(Tretstack_max,  I32)
52
53 PERLVAR(TSv,            SV *)           /* used to hold temporary values */
54 PERLVAR(TXpv,           XPV *)          /* used to hold temporary values */
55 PERLVAR(Tna,            STRLEN)         /* for use in SvPV when length is
56                                            Not Applicable */
57
58 /* stat stuff */
59 PERLVAR(Tstatbuf,       Stat_t)
60 PERLVAR(Tstatcache,     Stat_t)         /* _ */
61 PERLVAR(Tstatgv,        GV *)
62 PERLVARI(Tstatname,     SV *,   Nullsv)
63
64 #ifdef HAS_TIMES
65 PERLVAR(Ttimesbuf,      struct tms)
66 #endif
67
68 /* Fields used by magic variables such as $@, $/ and so on */
69 PERLVAR(Ttainted,       bool)           /* using variables controlled by $< */
70 PERLVAR(Tcurpm,         PMOP *)         /* what to do \ interps in REs from */
71 PERLVAR(Tnrs,           SV *)
72 PERLVAR(Trs,            SV *)           /* input record separator $/ */
73 PERLVAR(Tlast_in_gv,    GV *)           /* GV used in last <FH> */
74 PERLVAR(Tofs,           char *)         /* output field separator $, */
75 PERLVAR(Tofslen,        STRLEN)
76 PERLVAR(Tdefoutgv,      GV *)           /* default FH for output */
77 PERLVARI(Tchopset,      char *, " \n-") /* $: */
78 PERLVAR(Tformtarget,    SV *)
79 PERLVAR(Tbodytarget,    SV *)
80 PERLVAR(Ttoptarget,     SV *)
81
82 /* Stashes */
83 PERLVAR(Tdefstash,      HV *)           /* main symbol table */
84 PERLVAR(Tcurstash,      HV *)           /* symbol table for current package */
85
86 PERLVAR(Trestartop,     OP *)           /* propagating an error from croak? */
87 PERLVARI(Tcurcop,       COP * VOL,      &PL_compiling)
88 PERLVAR(Tin_eval,       VOL int)        /* trap "fatal" errors? */
89 PERLVAR(Tdelaymagic,    int)            /* ($<,$>) = ... */
90 PERLVARI(Tdirty,        bool, FALSE)    /* in the middle of tearing things down? */
91 PERLVAR(Tlocalizing,    int)            /* are we processing a local() list? */
92
93 PERLVAR(Tcurstack,      AV *)           /* THE STACK */
94 PERLVAR(Tcurstackinfo,  PERL_SI *)      /* current stack + context */
95 PERLVAR(Tmainstack,     AV *)           /* the stack when nothing funny is happening */
96 PERLVAR(Ttop_env,       JMPENV *)       /* ptr. to current sigjmp() environment */
97 PERLVAR(Tstart_env,     JMPENV)         /* empty startup sigjmp() environment */
98
99 /* statics "owned" by various functions */
100 PERLVAR(Tav_fetch_sv,   SV *)           /* owned by av_fetch() */
101 PERLVAR(Thv_fetch_sv,   SV *)           /* owned by hv_fetch() */
102 PERLVAR(Thv_fetch_ent_mh, HE)           /* owned by hv_fetch_ent() */
103
104 PERLVAR(Tmodcount,      I32)            /* how much mod()ification in assignment? */
105
106 PERLVAR(Tlastgotoprobe, OP*)            /* from pp_ctl.c */
107 PERLVARI(Tdumpindent,   I32, 4)         /* # of blanks per dump indentation level */
108
109 /* sort stuff */
110 PERLVAR(Tsortcop,       OP *)           /* user defined sort routine */
111 PERLVAR(Tsortstash,     HV *)           /* which is in some package or other */
112 PERLVAR(Tfirstgv,       GV *)           /* $a */
113 PERLVAR(Tsecondgv,      GV *)           /* $b */
114 PERLVAR(Tsortcxix,      I32)            /* from pp_ctl.c */
115
116 /* regex stuff */
117
118 PERLVAR(Tscreamfirst,   I32 *)
119 PERLVAR(Tscreamnext,    I32 *)
120 PERLVARI(Tmaxscream,    I32,    -1)
121 PERLVAR(Tlastscream,    SV *)
122
123 PERLVAR(Tregdummy,      regnode)        /* from regcomp.c */
124 PERLVAR(Tregcomp_parse, char*)          /* Input-scan pointer. */
125 PERLVAR(Tregxend,       char*)          /* End of input for compile */
126 PERLVAR(Tregcode,       regnode*)       /* Code-emit pointer; &regdummy = don't */
127 PERLVAR(Tregnaughty,    I32)            /* How bad is this pattern? */
128 PERLVAR(Tregsawback,    I32)            /* Did we see \1, ...? */
129 PERLVAR(Tregprecomp,    char *)         /* uncompiled string. */
130 PERLVAR(Tregnpar,       I32)            /* () count. */
131 PERLVAR(Tregsize,       I32)            /* Code size. */
132 PERLVAR(Tregflags,      U16)            /* are we folding, multilining? */
133 PERLVAR(Tregseen,       U32)            /* from regcomp.c */
134 PERLVAR(Tseen_zerolen,  I32)            /* from regcomp.c */
135 PERLVAR(Tseen_evals,    I32)            /* from regcomp.c */
136 PERLVAR(Tregcomp_rx,    regexp *)       /* from regcomp.c */
137 PERLVAR(Textralen,      I32)            /* from regcomp.c */
138 PERLVAR(Tcolorset,      int)            /* from regcomp.c */
139 PERLVAR(Tcolors[6],     char *)         /* from regcomp.c */
140 PERLVAR(Treginput,      char *)         /* String-input pointer. */
141 PERLVAR(Tregbol,        char *)         /* Beginning of input, for ^ check. */
142 PERLVAR(Tregeol,        char *)         /* End of input, for $ check. */
143 PERLVAR(Tregstartp,     char **)        /* Pointer to startp array. */
144 PERLVAR(Tregendp,       char **)        /* Ditto for endp. */
145 PERLVAR(Treglastparen,  U32 *)          /* Similarly for lastparen. */
146 PERLVAR(Tregtill,       char *)         /* How far we are required to go. */
147 PERLVAR(Tregprev,       char)           /* char before regbol, \n if none */
148 PERLVAR(Treg_start_tmp, char **)        /* from regexec.c */
149 PERLVAR(Treg_start_tmpl,U32)            /* from regexec.c */
150 PERLVAR(Tregdata,       struct reg_data *)
151                                         /* from regexec.c renamed was data */
152 PERLVAR(Tbostr,         char *)         /* from regexec.c */
153 PERLVAR(Treg_flags,     U32)            /* from regexec.c */
154 PERLVAR(Treg_eval_set,  I32)            /* from regexec.c */
155 PERLVAR(Tregnarrate,    I32)            /* from regexec.c */
156 PERLVAR(Tregprogram,    regnode *)      /* from regexec.c */
157 PERLVARI(Tregindent,    int,        0)  /* from regexec.c */
158 PERLVAR(Tregcc,         CURCUR *)       /* from regexec.c */
159 PERLVAR(Treg_call_cc,   struct re_cc_state *)   /* from regexec.c */
160 PERLVAR(Treg_re,        regexp *)       /* from regexec.c */
161 PERLVAR(Treg_ganch,     char *)         /* position of \G */
162 PERLVAR(Treg_sv,        SV *)           /* what we match against */
163 PERLVAR(Treg_magic,     MAGIC *)        /* pos-magic of what we match */
164 PERLVAR(Treg_oldpos,    I32)            /* old pos of what we match */
165 PERLVARI(Treg_oldcurpm, PMOP*, NULL)    /* curpm before match */
166 PERLVARI(Treg_curpm,    PMOP*, NULL)    /* curpm during match */
167
168 PERLVARI(Tregcompp,     regcomp_t, FUNC_NAME_TO_PTR(pregcomp))
169                                         /* Pointer to RE compiler */
170 PERLVARI(Tregexecp,     regexec_t, FUNC_NAME_TO_PTR(regexec_flags))
171                                         /* Pointer to RE executer */
172 PERLVARI(Treginterp_cnt,int,        0)  /* Whether `Regexp'
173                                                    was interpolated. */
174 PERLVARI(Treg_starttry, char *,     0)  /* -Dr: where regtry was called. */
175 #ifdef DEBUGGING
176 PERLVARI(Twatchaddr,    char **,    0)
177 PERLVAR(Twatchok,       char *)
178 #endif
179
180 /* Note that the variables below are all explicitly referenced in the code
181  * as thr->whatever and therefore don't need the 'T' prefix. */
182
183 #ifdef USE_THREADS
184
185 PERLVAR(oursv,          SV *)
186 PERLVAR(cvcache,        HV *)
187 PERLVAR(self,           perl_os_thread) /* Underlying thread object */
188 PERLVAR(flags,          U32)
189 PERLVAR(threadsv,       AV *)           /* Per-thread SVs ($_, $@ etc.) */
190 PERLVAR(threadsvp,      SV **)          /* AvARRAY(threadsv) */
191 PERLVAR(specific,       AV *)           /* Thread-specific user data */
192 PERLVAR(errsv,          SV *)           /* Backing SV for $@ */
193 PERLVAR(errhv,          HV *)           /* HV for what was %@ in pp_ctl.c */
194 PERLVAR(mutex,          perl_mutex)     /* For the fields others can change */
195 PERLVAR(tid,            U32)
196 PERLVAR(prev,           struct perl_thread *)
197 PERLVAR(next,           struct perl_thread *)
198                                         /* Circular linked list of threads */
199
200 #ifdef HAVE_THREAD_INTERN
201 PERLVAR(i,              struct thread_intern)
202                                         /* Platform-dependent internals */
203 #endif
204
205 PERLVAR(trailing_nul,   char)           /* For the sake of thrsv and oursv */
206
207 #endif /* USE_THREADS */