The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Per-Interpreter Variables */

/* These variables are per-interpreter in threaded/multiplicity builds, * global otherwise.

 * Don't forget to re-run regen/embed.pl to propagate changes! */

/* New variables must be added to the very end for binary compatibility. */

/* DON'T FORGET to add your variable also to perl_clone()! (in sv.c) */

/* The 'I' prefix is only needed for vars that need appropriate #defines * generated when built with or without MULTIPLICITY. It is also used * to generate the appropriate export list for win32. If the variable * needs to be initialized, use PERLVARI. * * When building without MULTIPLICITY, these variables will be truly global. * * Important ones in the first cache line (if alignment is done right) */

PERLVAR(I, stack_sp, SV **) /* top of the stack */ PERLVAR(I, op, OP *) /* currently executing op */ PERLVAR(I, curpad, SV **) /* active pad (lexicals+tmps) */

PERLVAR(I, stack_base, SV **) PERLVAR(I, stack_max, SV **)

PERLVAR(I, savestack, ANY *) /* items that need to be restored when LEAVEing scopes we've ENTERed */ PERLVAR(I, savestack_ix, I32) PERLVAR(I, savestack_max, I32)

PERLVAR(I, scopestack, I32 *) /* scopes we've ENTERed */ PERLVAR(I, scopestack_ix, I32) PERLVAR(I, scopestack_max, I32)

PERLVAR(I, tmps_stack, SV **) /* mortals we've made */ PERLVARI(I, tmps_ix, SSize_t, -1) PERLVARI(I, tmps_floor, SSize_t, -1) PERLVAR(I, tmps_max, SSize_t) /* first unalloced slot in tmps stack */

PERLVARI(I, sub_generation, U32, 1) /* incr to invalidate method cache */

PERLVAR(I, markstack, I32 *) /* stack_sp locations we're remembering */ PERLVAR(I, markstack_ptr, I32 *) PERLVAR(I, markstack_max, I32 *)

#ifdef PERL_HASH_RANDOMIZE_KEYS #ifdef USE_PERL_PERTURB_KEYS PERLVARI(I, hash_rand_bits_enabled, U8, 1) /* used to randomize hash stuff 0 == no-random, 1 == random, 2 == determinsitic */ #endif PERLVARI(I, hash_rand_bits, UV, 0) /* used to randomize hash stuff */ #endif PERLVAR(I, strtab, HV *) /* shared string table */ /* prog counter for the currently executing OP_MULTIDEREF Used to signal * to S_find_uninit_var() where we are */ PERLVAR(I, multideref_pc, UNOP_AUX_item *)

/* Fields used by magic variables such as $@, $/ and so on */ PERLVAR(I, curpm, PMOP *) /* what to do \ interps in REs from */ PERLVAR(I, curpm_under, PMOP *) /* what to do \ interps in REs from */

PERLVAR(I, tainting, bool) /* doing taint checks */ PERLVARI(I, tainted, bool, FALSE) /* using variables controlled by $< */

/* PL_delaymagic is currently used for two purposes: to assure simultaneous * updates in ($<,$>) = ..., and to assure atomic update in push/unshift * @ISA, It works like this: a few places such as pp_push set the DM_DELAY * flag; then various places such as av_store() skip mg_set(ary) if this * flag is set, and various magic vtable methods set flags like * DM_ARRAY_ISA if they've seen something of that ilk. Finally when * control returns to pp_push or whatever, it sees if any of those flags * have been set, and if so finally calls mg_set(). * * NB: PL_delaymagic is automatically saved and restored by JUMPENV_PUSH * / POP. This removes the need to do ENTER/SAVEI16(PL_delaymagic)/LEAVE * in hot code like pp_push. */ PERLVAR(I, delaymagic, U16) /* ($<,$>) = ... */

PERLVAR(I, localizing, U8) /* are we processing a local() list? */ PERLVAR(I, in_eval, U8) /* trap "fatal" errors? */ PERLVAR(I, defgv, GV *) /* the *_ glob */ /*

The C variable that roughly corresponds to Perl's $^W warning variable. However, $^W is treated as a boolean, whereas PL_dowarn is a collection of flag bits.

A convenience variable which is typically used with SvPV when one doesn't care about the length of the string. It is usually more efficient to either declare a local variable and use that instead or to use the SvPV_nolen macro.

The input record separator - $/ in Perl space.

The GV which was last used for a filehandle input operation. (<FH>)

The glob containing the output field separator - *, in Perl space.

Pointer to the per-subroutine peephole optimiser. This is a function that gets called at the end of compilation of a Perl subroutine (or equivalently independent piece of Perl code) to perform fixups of some ops and to perform small-scale optimisations. The function is called once for each subroutine that is compiled, and is passed, as sole parameter, a pointer to the op that is the entry point to the subroutine. It modifies the op tree in place.

The peephole optimiser should never be completely replaced. Rather, add code to it by wrapping the existing optimiser. The basic way to do this can be seen in "Compile pass 3: peephole optimization" in perlguts. If the new code wishes to operate on ops throughout the subroutine's structure, rather than just at the top level, it is likely to be more convenient to wrap the "PL_rpeepp" hook.

Pointer to the recursive peephole optimiser. This is a function that gets called at the end of compilation of a Perl subroutine (or equivalently independent piece of Perl code) to perform fixups of some ops and to perform small-scale optimisations. The function is called once for each chain of ops linked through their op_next fields; it is recursively called to handle each side chain. It is passed, as sole parameter, a pointer to the op that is at the head of the chain. It modifies the op tree in place.

The peephole optimiser should never be completely replaced. Rather, add code to it by wrapping the existing optimiser. The basic way to do this can be seen in "Compile pass 3: peephole optimization" in perlguts. If the new code wishes to operate only on ops at a subroutine's top level, rather than throughout the structure, it is likely to be more convenient to wrap the "PL_peepp" hook.

When non-NULL, the function pointed by this variable will be called each time an OP is freed with the corresponding OP as the argument. This allows extensions to free any extra attribute they have locally attached to an OP. It is also assured to first fire for the parent OP and then for its kids.

When 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.

PL_modglobal is a general purpose, interpreter global HV for use by extensions that need to keep information on a per-interpreter basis. In a pinch, it can also be used as a symbol table for extensions to share data among each other. It is a good idea to use keys prefixed by the package name of the extension that owns the data.