Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / man / man1 / perlintern.1
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "PERLINTERN 1"
.TH PERLINTERN 1 "2006-01-07" "perl v5.8.8" "Perl Programmers Reference Guide"
.SH "NAME"
perlintern \- autogenerated documentation of purely \fBinternal\fR
Perl functions
.SH "DESCRIPTION"
.IX Xref "internal Perl functions interpreter functions"
.IX Header "DESCRIPTION"
This file is the autogenerated documentation of functions in the
Perl interpreter that are documented using Perl's internal documentation
format but are not marked as part of the Perl \s-1API\s0. In other words,
\&\fBthey are not for use in extensions\fR!
.SH "CV reference counts and CvOUTSIDE"
.IX Header "CV reference counts and CvOUTSIDE"
.IP "CvWEAKOUTSIDE" 8
.IX Xref "CvWEAKOUTSIDE"
.IX Item "CvWEAKOUTSIDE"
Each \s-1CV\s0 has a pointer, \f(CW\*(C`CvOUTSIDE()\*(C'\fR, to its lexically enclosing
\&\s-1CV\s0 (if any). Because pointers to anonymous sub prototypes are
stored in \f(CW\*(C`&\*(C'\fR pad slots, it is a possible to get a circular reference,
with the parent pointing to the child and vice\-versa. To avoid the
ensuing memory leak, we do not increment the reference count of the \s-1CV\s0
pointed to by \f(CW\*(C`CvOUTSIDE\*(C'\fR in the \fIone specific instance\fR that the parent
has a \f(CW\*(C`&\*(C'\fR pad slot pointing back to us. In this case, we set the
\&\f(CW\*(C`CvWEAKOUTSIDE\*(C'\fR flag in the child. This allows us to determine under what
circumstances we should decrement the refcount of the parent when freeing
the child.
.Sp
There is a further complication with non-closure anonymous subs (i.e. those
that do not refer to any lexicals outside that sub). In this case, the
anonymous prototype is shared rather than being cloned. This has the
consequence that the parent may be freed while there are still active
children, eg
.Sp
.Vb 1
\& BEGIN { $a = sub { eval '$x' } }
.Ve
.Sp
In this case, the \s-1BEGIN\s0 is freed immediately after execution since there
are no active references to it: the anon sub prototype has
\&\f(CW\*(C`CvWEAKOUTSIDE\*(C'\fR set since it's not a closure, and \f(CW$a\fR points to the same
\&\s-1CV\s0, so it doesn't contribute to \s-1BEGIN\s0's refcount either. When \f(CW$a\fR is
executed, the \f(CW\*(C`eval '$x'\*(C'\fR causes the chain of \f(CW\*(C`CvOUTSIDE\*(C'\fRs to be followed,
and the freed \s-1BEGIN\s0 is accessed.
.Sp
To avoid this, whenever a \s-1CV\s0 and its associated pad is freed, any
\&\f(CW\*(C`&\*(C'\fR entries in the pad are explicitly removed from the pad, and if the
refcount of the pointed-to anon sub is still positive, then that
child's \f(CW\*(C`CvOUTSIDE\*(C'\fR is set to point to its grandparent. This will only
occur in the single specific case of a non-closure anon prototype
having one or more active references (such as \f(CW$a\fR above).
.Sp
One other thing to consider is that a \s-1CV\s0 may be merely undefined
rather than freed, eg \f(CW\*(C`undef &foo\*(C'\fR. In this case, its refcount may
not have reached zero, but we still delete its pad and its \f(CW\*(C`CvROOT\*(C'\fR etc.
Since various children may still have their \f(CW\*(C`CvOUTSIDE\*(C'\fR pointing at this
undefined \s-1CV\s0, we keep its own \f(CW\*(C`CvOUTSIDE\*(C'\fR for the time being, so that
the chain of lexical scopes is unbroken. For example, the following
should print 123:
.Sp
.Vb 5
\& my $x = 123;
\& sub tmp { sub { eval '$x' } }
\& my $a = tmp();
\& undef &tmp;
\& print $a->();
.Ve
.Sp
.Vb 1
\& bool CvWEAKOUTSIDE(CV *cv)
.Ve
.SH "Functions in file pad.h"
.IX Header "Functions in file pad.h"
.IP "\s-1CX_CURPAD_SAVE\s0" 8
.IX Xref "CX_CURPAD_SAVE"
.IX Item "CX_CURPAD_SAVE"
Save the current pad in the given context block structure.
.Sp
.Vb 1
\& void CX_CURPAD_SAVE(struct context)
.Ve
.IP "\s-1CX_CURPAD_SV\s0" 8
.IX Xref "CX_CURPAD_SV"
.IX Item "CX_CURPAD_SV"
Access the \s-1SV\s0 at offset po in the saved current pad in the given
context block structure (can be used as an lvalue).
.Sp
.Vb 1
\& SV * CX_CURPAD_SV(struct context, PADOFFSET po)
.Ve
.IP "\s-1PAD_BASE_SV\s0" 8
.IX Xref "PAD_BASE_SV"
.IX Item "PAD_BASE_SV"
Get the value from slot \f(CW\*(C`po\*(C'\fR in the base (DEPTH=1) pad of a padlist
.Sp
.Vb 1
\& SV * PAD_BASE_SV(PADLIST padlist, PADOFFSET po)
.Ve
.IP "\s-1PAD_CLONE_VARS\s0" 8
.IX Xref "PAD_CLONE_VARS"
.IX Item "PAD_CLONE_VARS"
|CLONE_PARAMS* param
Clone the state variables associated with running and compiling pads.
.Sp
.Vb 1
\& void PAD_CLONE_VARS(PerlInterpreter *proto_perl \e)
.Ve
.IP "\s-1PAD_COMPNAME_FLAGS\s0" 8
.IX Xref "PAD_COMPNAME_FLAGS"
.IX Item "PAD_COMPNAME_FLAGS"
Return the flags for the current compiling pad name
at offset \f(CW\*(C`po\*(C'\fR. Assumes a valid slot entry.
.Sp
.Vb 1
\& U32 PAD_COMPNAME_FLAGS(PADOFFSET po)
.Ve
.IP "\s-1PAD_COMPNAME_GEN\s0" 8
.IX Xref "PAD_COMPNAME_GEN"
.IX Item "PAD_COMPNAME_GEN"
The generation number of the name at offset \f(CW\*(C`po\*(C'\fR in the current
compiling pad (lvalue). Note that \f(CW\*(C`SvCUR\*(C'\fR is hijacked for this purpose.
.Sp
.Vb 1
\& STRLEN PAD_COMPNAME_GEN(PADOFFSET po)
.Ve
.IP "PAD_COMPNAME_GEN_set" 8
.IX Xref "PAD_COMPNAME_GEN_set"
.IX Item "PAD_COMPNAME_GEN_set"
Sets the generation number of the name at offset \f(CW\*(C`po\*(C'\fR in the current
ling pad (lvalue) to \f(CW\*(C`gen\*(C'\fR. Note that \f(CW\*(C`SvCUR_set\*(C'\fR is hijacked for this purpose.
.Sp
.Vb 1
\& STRLEN PAD_COMPNAME_GEN_set(PADOFFSET po, int gen)
.Ve
.IP "\s-1PAD_COMPNAME_OURSTASH\s0" 8
.IX Xref "PAD_COMPNAME_OURSTASH"
.IX Item "PAD_COMPNAME_OURSTASH"
Return the stash associated with an \f(CW\*(C`our\*(C'\fR variable.
Assumes the slot entry is a valid \f(CW\*(C`our\*(C'\fR lexical.
.Sp
.Vb 1
\& HV * PAD_COMPNAME_OURSTASH(PADOFFSET po)
.Ve
.IP "\s-1PAD_COMPNAME_PV\s0" 8
.IX Xref "PAD_COMPNAME_PV"
.IX Item "PAD_COMPNAME_PV"
Return the name of the current compiling pad name
at offset \f(CW\*(C`po\*(C'\fR. Assumes a valid slot entry.
.Sp
.Vb 1
\& char * PAD_COMPNAME_PV(PADOFFSET po)
.Ve
.IP "\s-1PAD_COMPNAME_TYPE\s0" 8
.IX Xref "PAD_COMPNAME_TYPE"
.IX Item "PAD_COMPNAME_TYPE"
Return the type (stash) of the current compiling pad name at offset
\&\f(CW\*(C`po\*(C'\fR. Must be a valid name. Returns null if not typed.
.Sp
.Vb 1
\& HV * PAD_COMPNAME_TYPE(PADOFFSET po)
.Ve
.IP "\s-1PAD_DUP\s0" 8
.IX Xref "PAD_DUP"
.IX Item "PAD_DUP"
Clone a padlist.
.Sp
.Vb 1
\& void PAD_DUP(PADLIST dstpad, PADLIST srcpad, CLONE_PARAMS* param)
.Ve
.IP "\s-1PAD_RESTORE_LOCAL\s0" 8
.IX Xref "PAD_RESTORE_LOCAL"
.IX Item "PAD_RESTORE_LOCAL"
Restore the old pad saved into the local variable opad by \s-1\fIPAD_SAVE_LOCAL\s0()\fR
.Sp
.Vb 1
\& void PAD_RESTORE_LOCAL(PAD *opad)
.Ve
.IP "\s-1PAD_SAVE_LOCAL\s0" 8
.IX Xref "PAD_SAVE_LOCAL"
.IX Item "PAD_SAVE_LOCAL"
Save the current pad to the local variable opad, then make the
current pad equal to npad
.Sp
.Vb 1
\& void PAD_SAVE_LOCAL(PAD *opad, PAD *npad)
.Ve
.IP "\s-1PAD_SAVE_SETNULLPAD\s0" 8
.IX Xref "PAD_SAVE_SETNULLPAD"
.IX Item "PAD_SAVE_SETNULLPAD"
Save the current pad then set it to null.
.Sp
.Vb 1
\& void PAD_SAVE_SETNULLPAD()
.Ve
.IP "\s-1PAD_SETSV\s0" 8
.IX Xref "PAD_SETSV"
.IX Item "PAD_SETSV"
Set the slot at offset \f(CW\*(C`po\*(C'\fR in the current pad to \f(CW\*(C`sv\*(C'\fR
.Sp
.Vb 1
\& SV * PAD_SETSV(PADOFFSET po, SV* sv)
.Ve
.IP "\s-1PAD_SET_CUR\s0" 8
.IX Xref "PAD_SET_CUR"
.IX Item "PAD_SET_CUR"
Set the current pad to be pad \f(CW\*(C`n\*(C'\fR in the padlist, saving
the previous current pad. \s-1NB\s0 currently this macro expands to a string too
long for some compilers, so it's best to replace it with
.Sp
.Vb 2
\& SAVECOMPPAD();
\& PAD_SET_CUR_NOSAVE(padlist,n);
.Ve
.Sp
.Vb 1
\& void PAD_SET_CUR(PADLIST padlist, I32 n)
.Ve
.IP "\s-1PAD_SET_CUR_NOSAVE\s0" 8
.IX Xref "PAD_SET_CUR_NOSAVE"
.IX Item "PAD_SET_CUR_NOSAVE"
like \s-1PAD_SET_CUR\s0, but without the save
.Sp
.Vb 1
\& void PAD_SET_CUR_NOSAVE(PADLIST padlist, I32 n)
.Ve
.IP "\s-1PAD_SV\s0" 8
.IX Xref "PAD_SV"
.IX Item "PAD_SV"
Get the value at offset \f(CW\*(C`po\*(C'\fR in the current pad
.Sp
.Vb 1
\& void PAD_SV(PADOFFSET po)
.Ve
.IP "PAD_SVl" 8
.IX Xref "PAD_SVl"
.IX Item "PAD_SVl"
Lightweight and lvalue version of \f(CW\*(C`PAD_SV\*(C'\fR.
Get or set the value at offset \f(CW\*(C`po\*(C'\fR in the current pad.
Unlike \f(CW\*(C`PAD_SV\*(C'\fR, does not print diagnostics with \-DX.
For internal use only.
.Sp
.Vb 1
\& SV * PAD_SVl(PADOFFSET po)
.Ve
.IP "\s-1SAVECLEARSV\s0" 8
.IX Xref "SAVECLEARSV"
.IX Item "SAVECLEARSV"
Clear the pointed to pad value on scope exit. (i.e. the runtime action of 'my')
.Sp
.Vb 1
\& void SAVECLEARSV(SV **svp)
.Ve
.IP "\s-1SAVECOMPPAD\s0" 8
.IX Xref "SAVECOMPPAD"
.IX Item "SAVECOMPPAD"
save PL_comppad and PL_curpad
.Sp
.Vb 1
\& void SAVECOMPPAD()
.Ve
.IP "\s-1SAVEPADSV\s0" 8
.IX Xref "SAVEPADSV"
.IX Item "SAVEPADSV"
Save a pad slot (used to restore after an iteration)
.Sp
\&\s-1XXX\s0 \s-1DAPM\s0 it would make more sense to make the arg a \s-1PADOFFSET\s0
void \s-1SAVEPADSV\s0(\s-1PADOFFSET\s0 po)
.SH "Functions in file pp_ctl.c"
.IX Header "Functions in file pp_ctl.c"
.IP "find_runcv" 8
.IX Xref "find_runcv"
.IX Item "find_runcv"
Locate the \s-1CV\s0 corresponding to the currently executing sub or eval.
If db_seqp is non_null, skip CVs that are in the \s-1DB\s0 package and populate
*db_seqp with the cop sequence number at the point that the \s-1DB::\s0 code was
entered. (allows debuggers to eval in the scope of the breakpoint rather
than in the scope of the debugger itself).
.Sp
.Vb 1
\& CV* find_runcv(U32 *db_seqp)
.Ve
.SH "Global Variables"
.IX Header "Global Variables"
.IP "PL_DBsingle" 8
.IX Xref "PL_DBsingle"
.IX Item "PL_DBsingle"
When Perl is run in debugging mode, with the \fB\-d\fR switch, this \s-1SV\s0 is a
boolean which indicates whether subs are being single\-stepped.
Single-stepping is automatically turned on after every step. This is the C
variable which corresponds to Perl's \f(CW$DB::single\fR variable. See
\&\f(CW\*(C`PL_DBsub\*(C'\fR.
.Sp
.Vb 1
\& SV * PL_DBsingle
.Ve
.IP "PL_DBsub" 8
.IX Xref "PL_DBsub"
.IX Item "PL_DBsub"
When Perl is run in debugging mode, with the \fB\-d\fR switch, this \s-1GV\s0 contains
the \s-1SV\s0 which holds the name of the sub being debugged. This is the C
variable which corresponds to Perl's \f(CW$DB::sub\fR variable. See
\&\f(CW\*(C`PL_DBsingle\*(C'\fR.
.Sp
.Vb 1
\& GV * PL_DBsub
.Ve
.IP "PL_DBtrace" 8
.IX Xref "PL_DBtrace"
.IX Item "PL_DBtrace"
Trace variable used when Perl is run in debugging mode, with the \fB\-d\fR
switch. This is the C variable which corresponds to Perl's \f(CW$DB::trace\fR
variable. See \f(CW\*(C`PL_DBsingle\*(C'\fR.
.Sp
.Vb 1
\& SV * PL_DBtrace
.Ve
.IP "PL_dowarn" 8
.IX Xref "PL_dowarn"
.IX Item "PL_dowarn"
The C variable which corresponds to Perl's $^W warning variable.
.Sp
.Vb 1
\& bool PL_dowarn
.Ve
.IP "PL_last_in_gv" 8
.IX Xref "PL_last_in_gv"
.IX Item "PL_last_in_gv"
The \s-1GV\s0 which was last used for a filehandle input operation. (\f(CW\*(C`<FH>\*(C'\fR)
.Sp
.Vb 1
\& GV* PL_last_in_gv
.Ve
.IP "PL_ofs_sv" 8
.IX Xref "PL_ofs_sv"
.IX Item "PL_ofs_sv"
The output field separator \- \f(CW$,\fR in Perl space.
.Sp
.Vb 1
\& SV* PL_ofs_sv
.Ve
.IP "PL_rs" 8
.IX Xref "PL_rs"
.IX Item "PL_rs"
The input record separator \- \f(CW$/\fR in Perl space.
.Sp
.Vb 1
\& SV* PL_rs
.Ve
.SH "GV Functions"
.IX Header "GV Functions"
.IP "is_gv_magical" 8
.IX Xref "is_gv_magical"
.IX Item "is_gv_magical"
Returns \f(CW\*(C`TRUE\*(C'\fR if given the name of a magical \s-1GV\s0.
.Sp
Currently only useful internally when determining if a \s-1GV\s0 should be
created even in rvalue contexts.
.Sp
\&\f(CW\*(C`flags\*(C'\fR is not used at present but available for future extension to
allow selecting particular classes of magical variable.
.Sp
Currently assumes that \f(CW\*(C`name\*(C'\fR is \s-1NUL\s0 terminated (as well as len being valid).
This assumption is met by all callers within the perl core, which all pass
pointers returned by SvPV.
.Sp
.Vb 1
\& bool is_gv_magical(char *name, STRLEN len, U32 flags)
.Ve
.SH "IO Functions"
.IX Header "IO Functions"
.IP "start_glob" 8
.IX Xref "start_glob"
.IX Item "start_glob"
Function called by \f(CW\*(C`do_readline\*(C'\fR to spawn a glob (or do the glob inside
perl on \s-1VMS\s0). This code used to be inline, but now perl uses \f(CW\*(C`File::Glob\*(C'\fR
this glob starter is only used by miniperl during the build process.
Moving it away shrinks pp_hot.c; shrinking pp_hot.c helps speed perl up.
.Sp
.Vb 1
\& PerlIO* start_glob(SV* pattern, IO *io)
.Ve
.SH "Pad Data Structures"
.IX Header "Pad Data Structures"
.IP "CvPADLIST" 8
.IX Xref "CvPADLIST"
.IX Item "CvPADLIST"
\&\s-1CV\s0's can have CvPADLIST(cv) set to point to an \s-1AV\s0.
.Sp
For these purposes \*(L"forms\*(R" are a kind-of \s-1CV\s0, eval"\*(L"s are too (except they're
not callable at will and are always thrown away after the eval\*(R"" is done
executing).
.Sp
XSUBs don't have CvPADLIST set \- dXSTARG fetches values from PL_curpad,
but that is really the callers pad (a slot of which is allocated by
every entersub).
.Sp
The CvPADLIST \s-1AV\s0 has does not have AvREAL set, so \s-1REFCNT\s0 of component items
is managed \*(L"manual\*(R" (mostly in pad.c) rather than normal av.c rules.
The items in the \s-1AV\s0 are not SVs as for a normal \s-1AV\s0, but other AVs:
.Sp
0'th Entry of the CvPADLIST is an \s-1AV\s0 which represents the \*(L"names\*(R" or rather
the \*(L"static type information\*(R" for lexicals.
.Sp
The CvDEPTH'th entry of CvPADLIST \s-1AV\s0 is an \s-1AV\s0 which is the stack frame at that
depth of recursion into the \s-1CV\s0.
The 0'th slot of a frame \s-1AV\s0 is an \s-1AV\s0 which is \f(CW@_\fR.
other entries are storage for variables and op targets.
.Sp
During compilation:
\&\f(CW\*(C`PL_comppad_name\*(C'\fR is set to the names \s-1AV\s0.
\&\f(CW\*(C`PL_comppad\*(C'\fR is set to the frame \s-1AV\s0 for the frame CvDEPTH == 1.
\&\f(CW\*(C`PL_curpad\*(C'\fR is set to the body of the frame \s-1AV\s0 (i.e. AvARRAY(PL_comppad)).
.Sp
During execution, \f(CW\*(C`PL_comppad\*(C'\fR and \f(CW\*(C`PL_curpad\*(C'\fR refer to the live
frame of the currently executing sub.
.Sp
Iterating over the names \s-1AV\s0 iterates over all possible pad
items. Pad slots that are SVs_PADTMP (targets/GVs/constants) end up having
&PL_sv_undef \*(L"names\*(R" (see \fIpad_alloc()\fR).
.Sp
Only my/our variable (SVs_PADMY/SVs_PADOUR) slots get valid names.
The rest are op targets/GVs/constants which are statically allocated
or resolved at compile time. These don't have names by which they
can be looked up from Perl code at run time through eval"\*(L" like
my/our variables can be. Since they can't be looked up by \*(R"name"
but only by their index allocated at compile time (which is usually
in PL_op\->op_targ), wasting a name \s-1SV\s0 for them doesn't make sense.
.Sp
The SVs in the names \s-1AV\s0 have their \s-1PV\s0 being the name of the variable.
\&\s-1NV+1\s0..IV inclusive is a range of cop_seq numbers for which the name is
valid. For typed lexicals name \s-1SV\s0 is SVt_PVMG and SvSTASH points at the
type. For \f(CW\*(C`our\*(C'\fR lexicals, the type is SVt_PVGV, and GvSTASH points at the
stash of the associated global (so that duplicate \f(CW\*(C`our\*(C'\fR declarations in the
same package can be detected). SvCUR is sometimes hijacked to
store the generation number during compilation.
.Sp
If SvFAKE is set on the name \s-1SV\s0 then slot in the frame AVs are
a \s-1REFCNT\s0'ed references to a lexical from \*(L"outside\*(R". In this case,
the name \s-1SV\s0 does not have a cop_seq range, since it is in scope
throughout.
.Sp
If the 'name' is '&' the corresponding entry in frame \s-1AV\s0
is a \s-1CV\s0 representing a possible closure.
(SvFAKE and name of '&' is not a meaningful combination currently but could
become so if \f(CW\*(C`my sub foo {}\*(C'\fR is implemented.)
.Sp
The flag SVf_PADSTALE is cleared on lexicals each time the \fImy()\fR is executed,
and set on scope exit. This allows the 'Variable \f(CW$x\fR is not available' warning
to be generated in evals, such as
.Sp
.Vb 1
\& { my $x = 1; sub f { eval '$x'} } f();
.Ve
.Sp
.Vb 1
\& AV * CvPADLIST(CV *cv)
.Ve
.IP "cv_clone" 8
.IX Xref "cv_clone"
.IX Item "cv_clone"
Clone a \s-1CV:\s0 make a new \s-1CV\s0 which points to the same code etc, but which
has a newly-created pad built by copying the prototype pad and capturing
any outer lexicals.
.Sp
.Vb 1
\& CV* cv_clone(CV* proto)
.Ve
.IP "cv_dump" 8
.IX Xref "cv_dump"
.IX Item "cv_dump"
dump the contents of a \s-1CV\s0
.Sp
.Vb 1
\& void cv_dump(const CV *cv, const char *title)
.Ve
.IP "do_dump_pad" 8
.IX Xref "do_dump_pad"
.IX Item "do_dump_pad"
Dump the contents of a padlist
.Sp
.Vb 1
\& void do_dump_pad(I32 level, PerlIO *file, PADLIST *padlist, int full)
.Ve
.IP "intro_my" 8
.IX Xref "intro_my"
.IX Item "intro_my"
\&\*(L"Introduce\*(R" my variables to visible status.
.Sp
.Vb 1
\& U32 intro_my()
.Ve
.IP "pad_add_anon" 8
.IX Xref "pad_add_anon"
.IX Item "pad_add_anon"
Add an anon code entry to the current compiling pad
.Sp
.Vb 1
\& PADOFFSET pad_add_anon(SV* sv, OPCODE op_type)
.Ve
.IP "pad_add_name" 8
.IX Xref "pad_add_name"
.IX Item "pad_add_name"
Create a new name in the current pad at the specified offset.
If \f(CW\*(C`typestash\*(C'\fR is valid, the name is for a typed lexical; set the
name's stash to that value.
If \f(CW\*(C`ourstash\*(C'\fR is valid, it's an our lexical, set the name's
GvSTASH to that value
.Sp
Also, if the name is @.. or %.., create a new array or hash for that slot
.Sp
If fake, it means we're cloning an existing entry
.Sp
.Vb 1
\& PADOFFSET pad_add_name(char *name, HV* typestash, HV* ourstash, bool clone)
.Ve
.IP "pad_alloc" 8
.IX Xref "pad_alloc"
.IX Item "pad_alloc"
Allocate a new my or tmp pad entry. For a my, simply push a null \s-1SV\s0 onto
the end of PL_comppad, but for a tmp, scan the pad from PL_padix upwards
for a slot which has no name and no active value.
.Sp
.Vb 1
\& PADOFFSET pad_alloc(I32 optype, U32 tmptype)
.Ve
.IP "pad_block_start" 8
.IX Xref "pad_block_start"
.IX Item "pad_block_start"
Update the pad compilation state variables on entry to a new block
.Sp
.Vb 1
\& void pad_block_start(int full)
.Ve
.IP "pad_check_dup" 8
.IX Xref "pad_check_dup"
.IX Item "pad_check_dup"
Check for duplicate declarations: report any of:
* a my in the current scope with the same name;
* an our (anywhere in the pad) with the same name and the same stash
as \f(CW\*(C`ourstash\*(C'\fR
\&\f(CW\*(C`is_our\*(C'\fR indicates that the name to check is an 'our' declaration
.Sp
.Vb 1
\& void pad_check_dup(char* name, bool is_our, HV* ourstash)
.Ve
.IP "pad_findlex" 8
.IX Xref "pad_findlex"
.IX Item "pad_findlex"
Find a named lexical anywhere in a chain of nested pads. Add fake entries
in the inner pads if it's found in an outer one. innercv is the \s-1CV\s0 *inside*
the chain of outer CVs to be searched. If newoff is non\-null, this is a
run-time cloning: don't add fake entries, just find the lexical and add a
ref to it at newoff in the current pad.
.Sp
.Vb 1
\& PADOFFSET pad_findlex(const char* name, PADOFFSET newoff, const CV* innercv)
.Ve
.IP "pad_findmy" 8
.IX Xref "pad_findmy"
.IX Item "pad_findmy"
Given a lexical name, try to find its offset, first in the current pad,
or failing that, in the pads of any lexically enclosing subs (including
the complications introduced by eval). If the name is found in an outer pad,
then a fake entry is added to the current pad.
Returns the offset in the current pad, or \s-1NOT_IN_PAD\s0 on failure.
.Sp
.Vb 1
\& PADOFFSET pad_findmy(char* name)
.Ve
.IP "pad_fixup_inner_anons" 8
.IX Xref "pad_fixup_inner_anons"
.IX Item "pad_fixup_inner_anons"
For any anon CVs in the pad, change CvOUTSIDE of that \s-1CV\s0 from
old_cv to new_cv if necessary. Needed when a newly-compiled \s-1CV\s0 has to be
moved to a pre-existing \s-1CV\s0 struct.
.Sp
.Vb 1
\& void pad_fixup_inner_anons(PADLIST *padlist, CV *old_cv, CV *new_cv)
.Ve
.IP "pad_free" 8
.IX Xref "pad_free"
.IX Item "pad_free"
Free the \s-1SV\s0 at offset po in the current pad.
.Sp
.Vb 1
\& void pad_free(PADOFFSET po)
.Ve
.IP "pad_leavemy" 8
.IX Xref "pad_leavemy"
.IX Item "pad_leavemy"
Cleanup at end of scope during compilation: set the max seq number for
lexicals in this scope and warn of any lexicals that never got introduced.
.Sp
.Vb 1
\& void pad_leavemy()
.Ve
.IP "pad_new" 8
.IX Xref "pad_new"
.IX Item "pad_new"
Create a new compiling padlist, saving and updating the various global
vars at the same time as creating the pad itself. The following flags
can be \s-1OR\s0'ed together:
.Sp
.Vb 3
\& padnew_CLONE this pad is for a cloned CV
\& padnew_SAVE save old globals
\& padnew_SAVESUB also save extra stuff for start of sub
.Ve
.Sp
.Vb 1
\& PADLIST* pad_new(int flags)
.Ve
.IP "pad_push" 8
.IX Xref "pad_push"
.IX Item "pad_push"
Push a new pad frame onto the padlist, unless there's already a pad at
this depth, in which case don't bother creating a new one.
If has_args is true, give the new pad an \f(CW@_\fR in slot zero.
.Sp
.Vb 1
\& void pad_push(PADLIST *padlist, int depth, int has_args)
.Ve
.IP "pad_reset" 8
.IX Xref "pad_reset"
.IX Item "pad_reset"
Mark all the current temporaries for reuse
.Sp
.Vb 1
\& void pad_reset()
.Ve
.IP "pad_setsv" 8
.IX Xref "pad_setsv"
.IX Item "pad_setsv"
Set the entry at offset po in the current pad to sv.
Use the macro \s-1\fIPAD_SETSV\s0()\fR rather than calling this function directly.
.Sp
.Vb 1
\& void pad_setsv(PADOFFSET po, SV* sv)
.Ve
.IP "pad_swipe" 8
.IX Xref "pad_swipe"
.IX Item "pad_swipe"
Abandon the tmp in the current pad at offset po and replace with a
new one.
.Sp
.Vb 1
\& void pad_swipe(PADOFFSET po, bool refadjust)
.Ve
.IP "pad_tidy" 8
.IX Xref "pad_tidy"
.IX Item "pad_tidy"
Tidy up a pad after we've finished compiling it:
* remove most stuff from the pads of anonsub prototypes;
* give it a \f(CW@_\fR;
* mark tmps as such.
.Sp
.Vb 1
\& void pad_tidy(padtidy_type type)
.Ve
.IP "pad_undef" 8
.IX Xref "pad_undef"
.IX Item "pad_undef"
Free the padlist associated with a \s-1CV\s0.
If parts of it happen to be current, we null the relevant
PL_*pad* global vars so that we don't have any dangling references left.
We also repoint the CvOUTSIDE of any about-to-be-orphaned
inner subs to the outer of this cv.
.Sp
(This function should really be called pad_free, but the name was already
taken)
.Sp
.Vb 1
\& void pad_undef(CV* cv)
.Ve
.SH "Stack Manipulation Macros"
.IX Header "Stack Manipulation Macros"
.IP "djSP" 8
.IX Xref "djSP"
.IX Item "djSP"
Declare Just \f(CW\*(C`SP\*(C'\fR. This is actually identical to \f(CW\*(C`dSP\*(C'\fR, and declares
a local copy of perl's stack pointer, available via the \f(CW\*(C`SP\*(C'\fR macro.
See \f(CW\*(C`SP\*(C'\fR. (Available for backward source code compatibility with the
old (Perl 5.005) thread model.)
.Sp
.Vb 1
\& djSP;
.Ve
.IP "\s-1LVRET\s0" 8
.IX Xref "LVRET"
.IX Item "LVRET"
True if this op will be the return value of an lvalue subroutine
.SH "SV Manipulation Functions"
.IX Header "SV Manipulation Functions"
.IP "report_uninit" 8
.IX Xref "report_uninit"
.IX Item "report_uninit"
Print appropriate \*(L"Use of uninitialized variable\*(R" warning
.Sp
.Vb 1
\& void report_uninit()
.Ve
.IP "sv_add_arena" 8
.IX Xref "sv_add_arena"
.IX Item "sv_add_arena"
Given a chunk of memory, link it to the head of the list of arenas,
and split it into a list of free SVs.
.Sp
.Vb 1
\& void sv_add_arena(char* ptr, U32 size, U32 flags)
.Ve
.IP "sv_clean_all" 8
.IX Xref "sv_clean_all"
.IX Item "sv_clean_all"
Decrement the refcnt of each remaining \s-1SV\s0, possibly triggering a
cleanup. This function may have to be called multiple times to free
SVs which are in complex self-referential hierarchies.
.Sp
.Vb 1
\& I32 sv_clean_all()
.Ve
.IP "sv_clean_objs" 8
.IX Xref "sv_clean_objs"
.IX Item "sv_clean_objs"
Attempt to destroy all objects not yet freed
.Sp
.Vb 1
\& void sv_clean_objs()
.Ve
.IP "sv_free_arenas" 8
.IX Xref "sv_free_arenas"
.IX Item "sv_free_arenas"
Deallocate the memory used by all arenas. Note that all the individual \s-1SV\s0
heads and bodies within the arenas must already have been freed.
.Sp
.Vb 1
\& void sv_free_arenas()
.Ve
.SH "AUTHORS"
.IX Header "AUTHORS"
The autodocumentation system was originally added to the Perl core by
Benjamin Stuhl. Documentation is by whoever was kind enough to
document their functions.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIperlguts\fR\|(1), \fIperlapi\fR\|(1)