Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / man / man1 / perlintern.1
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "PERLINTERN 1"
132.TH PERLINTERN 1 "2006-01-07" "perl v5.8.8" "Perl Programmers Reference Guide"
133.SH "NAME"
134perlintern \- autogenerated documentation of purely \fBinternal\fR
135 Perl functions
136.SH "DESCRIPTION"
137.IX Xref "internal Perl functions interpreter functions"
138.IX Header "DESCRIPTION"
139This file is the autogenerated documentation of functions in the
140Perl interpreter that are documented using Perl's internal documentation
141format but are not marked as part of the Perl \s-1API\s0. In other words,
142\&\fBthey are not for use in extensions\fR!
143.SH "CV reference counts and CvOUTSIDE"
144.IX Header "CV reference counts and CvOUTSIDE"
145.IP "CvWEAKOUTSIDE" 8
146.IX Xref "CvWEAKOUTSIDE"
147.IX Item "CvWEAKOUTSIDE"
148Each \s-1CV\s0 has a pointer, \f(CW\*(C`CvOUTSIDE()\*(C'\fR, to its lexically enclosing
149\&\s-1CV\s0 (if any). Because pointers to anonymous sub prototypes are
150stored in \f(CW\*(C`&\*(C'\fR pad slots, it is a possible to get a circular reference,
151with the parent pointing to the child and vice\-versa. To avoid the
152ensuing memory leak, we do not increment the reference count of the \s-1CV\s0
153pointed to by \f(CW\*(C`CvOUTSIDE\*(C'\fR in the \fIone specific instance\fR that the parent
154has a \f(CW\*(C`&\*(C'\fR pad slot pointing back to us. In this case, we set the
155\&\f(CW\*(C`CvWEAKOUTSIDE\*(C'\fR flag in the child. This allows us to determine under what
156circumstances we should decrement the refcount of the parent when freeing
157the child.
158.Sp
159There is a further complication with non-closure anonymous subs (i.e. those
160that do not refer to any lexicals outside that sub). In this case, the
161anonymous prototype is shared rather than being cloned. This has the
162consequence that the parent may be freed while there are still active
163children, eg
164.Sp
165.Vb 1
166\& BEGIN { $a = sub { eval '$x' } }
167.Ve
168.Sp
169In this case, the \s-1BEGIN\s0 is freed immediately after execution since there
170are no active references to it: the anon sub prototype has
171\&\f(CW\*(C`CvWEAKOUTSIDE\*(C'\fR set since it's not a closure, and \f(CW$a\fR points to the same
172\&\s-1CV\s0, so it doesn't contribute to \s-1BEGIN\s0's refcount either. When \f(CW$a\fR is
173executed, the \f(CW\*(C`eval '$x'\*(C'\fR causes the chain of \f(CW\*(C`CvOUTSIDE\*(C'\fRs to be followed,
174and the freed \s-1BEGIN\s0 is accessed.
175.Sp
176To avoid this, whenever a \s-1CV\s0 and its associated pad is freed, any
177\&\f(CW\*(C`&\*(C'\fR entries in the pad are explicitly removed from the pad, and if the
178refcount of the pointed-to anon sub is still positive, then that
179child's \f(CW\*(C`CvOUTSIDE\*(C'\fR is set to point to its grandparent. This will only
180occur in the single specific case of a non-closure anon prototype
181having one or more active references (such as \f(CW$a\fR above).
182.Sp
183One other thing to consider is that a \s-1CV\s0 may be merely undefined
184rather than freed, eg \f(CW\*(C`undef &foo\*(C'\fR. In this case, its refcount may
185not have reached zero, but we still delete its pad and its \f(CW\*(C`CvROOT\*(C'\fR etc.
186Since various children may still have their \f(CW\*(C`CvOUTSIDE\*(C'\fR pointing at this
187undefined \s-1CV\s0, we keep its own \f(CW\*(C`CvOUTSIDE\*(C'\fR for the time being, so that
188the chain of lexical scopes is unbroken. For example, the following
189should print 123:
190.Sp
191.Vb 5
192\& my $x = 123;
193\& sub tmp { sub { eval '$x' } }
194\& my $a = tmp();
195\& undef &tmp;
196\& print $a->();
197.Ve
198.Sp
199.Vb 1
200\& bool CvWEAKOUTSIDE(CV *cv)
201.Ve
202.SH "Functions in file pad.h"
203.IX Header "Functions in file pad.h"
204.IP "\s-1CX_CURPAD_SAVE\s0" 8
205.IX Xref "CX_CURPAD_SAVE"
206.IX Item "CX_CURPAD_SAVE"
207Save the current pad in the given context block structure.
208.Sp
209.Vb 1
210\& void CX_CURPAD_SAVE(struct context)
211.Ve
212.IP "\s-1CX_CURPAD_SV\s0" 8
213.IX Xref "CX_CURPAD_SV"
214.IX Item "CX_CURPAD_SV"
215Access the \s-1SV\s0 at offset po in the saved current pad in the given
216context block structure (can be used as an lvalue).
217.Sp
218.Vb 1
219\& SV * CX_CURPAD_SV(struct context, PADOFFSET po)
220.Ve
221.IP "\s-1PAD_BASE_SV\s0" 8
222.IX Xref "PAD_BASE_SV"
223.IX Item "PAD_BASE_SV"
224Get the value from slot \f(CW\*(C`po\*(C'\fR in the base (DEPTH=1) pad of a padlist
225.Sp
226.Vb 1
227\& SV * PAD_BASE_SV(PADLIST padlist, PADOFFSET po)
228.Ve
229.IP "\s-1PAD_CLONE_VARS\s0" 8
230.IX Xref "PAD_CLONE_VARS"
231.IX Item "PAD_CLONE_VARS"
232|CLONE_PARAMS* param
233Clone the state variables associated with running and compiling pads.
234.Sp
235.Vb 1
236\& void PAD_CLONE_VARS(PerlInterpreter *proto_perl \e)
237.Ve
238.IP "\s-1PAD_COMPNAME_FLAGS\s0" 8
239.IX Xref "PAD_COMPNAME_FLAGS"
240.IX Item "PAD_COMPNAME_FLAGS"
241Return the flags for the current compiling pad name
242at offset \f(CW\*(C`po\*(C'\fR. Assumes a valid slot entry.
243.Sp
244.Vb 1
245\& U32 PAD_COMPNAME_FLAGS(PADOFFSET po)
246.Ve
247.IP "\s-1PAD_COMPNAME_GEN\s0" 8
248.IX Xref "PAD_COMPNAME_GEN"
249.IX Item "PAD_COMPNAME_GEN"
250The generation number of the name at offset \f(CW\*(C`po\*(C'\fR in the current
251compiling pad (lvalue). Note that \f(CW\*(C`SvCUR\*(C'\fR is hijacked for this purpose.
252.Sp
253.Vb 1
254\& STRLEN PAD_COMPNAME_GEN(PADOFFSET po)
255.Ve
256.IP "PAD_COMPNAME_GEN_set" 8
257.IX Xref "PAD_COMPNAME_GEN_set"
258.IX Item "PAD_COMPNAME_GEN_set"
259Sets the generation number of the name at offset \f(CW\*(C`po\*(C'\fR in the current
260ling pad (lvalue) to \f(CW\*(C`gen\*(C'\fR. Note that \f(CW\*(C`SvCUR_set\*(C'\fR is hijacked for this purpose.
261.Sp
262.Vb 1
263\& STRLEN PAD_COMPNAME_GEN_set(PADOFFSET po, int gen)
264.Ve
265.IP "\s-1PAD_COMPNAME_OURSTASH\s0" 8
266.IX Xref "PAD_COMPNAME_OURSTASH"
267.IX Item "PAD_COMPNAME_OURSTASH"
268Return the stash associated with an \f(CW\*(C`our\*(C'\fR variable.
269Assumes the slot entry is a valid \f(CW\*(C`our\*(C'\fR lexical.
270.Sp
271.Vb 1
272\& HV * PAD_COMPNAME_OURSTASH(PADOFFSET po)
273.Ve
274.IP "\s-1PAD_COMPNAME_PV\s0" 8
275.IX Xref "PAD_COMPNAME_PV"
276.IX Item "PAD_COMPNAME_PV"
277Return the name of the current compiling pad name
278at offset \f(CW\*(C`po\*(C'\fR. Assumes a valid slot entry.
279.Sp
280.Vb 1
281\& char * PAD_COMPNAME_PV(PADOFFSET po)
282.Ve
283.IP "\s-1PAD_COMPNAME_TYPE\s0" 8
284.IX Xref "PAD_COMPNAME_TYPE"
285.IX Item "PAD_COMPNAME_TYPE"
286Return the type (stash) of the current compiling pad name at offset
287\&\f(CW\*(C`po\*(C'\fR. Must be a valid name. Returns null if not typed.
288.Sp
289.Vb 1
290\& HV * PAD_COMPNAME_TYPE(PADOFFSET po)
291.Ve
292.IP "\s-1PAD_DUP\s0" 8
293.IX Xref "PAD_DUP"
294.IX Item "PAD_DUP"
295Clone a padlist.
296.Sp
297.Vb 1
298\& void PAD_DUP(PADLIST dstpad, PADLIST srcpad, CLONE_PARAMS* param)
299.Ve
300.IP "\s-1PAD_RESTORE_LOCAL\s0" 8
301.IX Xref "PAD_RESTORE_LOCAL"
302.IX Item "PAD_RESTORE_LOCAL"
303Restore the old pad saved into the local variable opad by \s-1\fIPAD_SAVE_LOCAL\s0()\fR
304.Sp
305.Vb 1
306\& void PAD_RESTORE_LOCAL(PAD *opad)
307.Ve
308.IP "\s-1PAD_SAVE_LOCAL\s0" 8
309.IX Xref "PAD_SAVE_LOCAL"
310.IX Item "PAD_SAVE_LOCAL"
311Save the current pad to the local variable opad, then make the
312current pad equal to npad
313.Sp
314.Vb 1
315\& void PAD_SAVE_LOCAL(PAD *opad, PAD *npad)
316.Ve
317.IP "\s-1PAD_SAVE_SETNULLPAD\s0" 8
318.IX Xref "PAD_SAVE_SETNULLPAD"
319.IX Item "PAD_SAVE_SETNULLPAD"
320Save the current pad then set it to null.
321.Sp
322.Vb 1
323\& void PAD_SAVE_SETNULLPAD()
324.Ve
325.IP "\s-1PAD_SETSV\s0" 8
326.IX Xref "PAD_SETSV"
327.IX Item "PAD_SETSV"
328Set the slot at offset \f(CW\*(C`po\*(C'\fR in the current pad to \f(CW\*(C`sv\*(C'\fR
329.Sp
330.Vb 1
331\& SV * PAD_SETSV(PADOFFSET po, SV* sv)
332.Ve
333.IP "\s-1PAD_SET_CUR\s0" 8
334.IX Xref "PAD_SET_CUR"
335.IX Item "PAD_SET_CUR"
336Set the current pad to be pad \f(CW\*(C`n\*(C'\fR in the padlist, saving
337the previous current pad. \s-1NB\s0 currently this macro expands to a string too
338long for some compilers, so it's best to replace it with
339.Sp
340.Vb 2
341\& SAVECOMPPAD();
342\& PAD_SET_CUR_NOSAVE(padlist,n);
343.Ve
344.Sp
345.Vb 1
346\& void PAD_SET_CUR(PADLIST padlist, I32 n)
347.Ve
348.IP "\s-1PAD_SET_CUR_NOSAVE\s0" 8
349.IX Xref "PAD_SET_CUR_NOSAVE"
350.IX Item "PAD_SET_CUR_NOSAVE"
351like \s-1PAD_SET_CUR\s0, but without the save
352.Sp
353.Vb 1
354\& void PAD_SET_CUR_NOSAVE(PADLIST padlist, I32 n)
355.Ve
356.IP "\s-1PAD_SV\s0" 8
357.IX Xref "PAD_SV"
358.IX Item "PAD_SV"
359Get the value at offset \f(CW\*(C`po\*(C'\fR in the current pad
360.Sp
361.Vb 1
362\& void PAD_SV(PADOFFSET po)
363.Ve
364.IP "PAD_SVl" 8
365.IX Xref "PAD_SVl"
366.IX Item "PAD_SVl"
367Lightweight and lvalue version of \f(CW\*(C`PAD_SV\*(C'\fR.
368Get or set the value at offset \f(CW\*(C`po\*(C'\fR in the current pad.
369Unlike \f(CW\*(C`PAD_SV\*(C'\fR, does not print diagnostics with \-DX.
370For internal use only.
371.Sp
372.Vb 1
373\& SV * PAD_SVl(PADOFFSET po)
374.Ve
375.IP "\s-1SAVECLEARSV\s0" 8
376.IX Xref "SAVECLEARSV"
377.IX Item "SAVECLEARSV"
378Clear the pointed to pad value on scope exit. (i.e. the runtime action of 'my')
379.Sp
380.Vb 1
381\& void SAVECLEARSV(SV **svp)
382.Ve
383.IP "\s-1SAVECOMPPAD\s0" 8
384.IX Xref "SAVECOMPPAD"
385.IX Item "SAVECOMPPAD"
386save PL_comppad and PL_curpad
387.Sp
388.Vb 1
389\& void SAVECOMPPAD()
390.Ve
391.IP "\s-1SAVEPADSV\s0" 8
392.IX Xref "SAVEPADSV"
393.IX Item "SAVEPADSV"
394Save a pad slot (used to restore after an iteration)
395.Sp
396\&\s-1XXX\s0 \s-1DAPM\s0 it would make more sense to make the arg a \s-1PADOFFSET\s0
397 void \s-1SAVEPADSV\s0(\s-1PADOFFSET\s0 po)
398.SH "Functions in file pp_ctl.c"
399.IX Header "Functions in file pp_ctl.c"
400.IP "find_runcv" 8
401.IX Xref "find_runcv"
402.IX Item "find_runcv"
403Locate the \s-1CV\s0 corresponding to the currently executing sub or eval.
404If db_seqp is non_null, skip CVs that are in the \s-1DB\s0 package and populate
405*db_seqp with the cop sequence number at the point that the \s-1DB::\s0 code was
406entered. (allows debuggers to eval in the scope of the breakpoint rather
407than in the scope of the debugger itself).
408.Sp
409.Vb 1
410\& CV* find_runcv(U32 *db_seqp)
411.Ve
412.SH "Global Variables"
413.IX Header "Global Variables"
414.IP "PL_DBsingle" 8
415.IX Xref "PL_DBsingle"
416.IX Item "PL_DBsingle"
417When Perl is run in debugging mode, with the \fB\-d\fR switch, this \s-1SV\s0 is a
418boolean which indicates whether subs are being single\-stepped.
419Single-stepping is automatically turned on after every step. This is the C
420variable which corresponds to Perl's \f(CW$DB::single\fR variable. See
421\&\f(CW\*(C`PL_DBsub\*(C'\fR.
422.Sp
423.Vb 1
424\& SV * PL_DBsingle
425.Ve
426.IP "PL_DBsub" 8
427.IX Xref "PL_DBsub"
428.IX Item "PL_DBsub"
429When Perl is run in debugging mode, with the \fB\-d\fR switch, this \s-1GV\s0 contains
430the \s-1SV\s0 which holds the name of the sub being debugged. This is the C
431variable which corresponds to Perl's \f(CW$DB::sub\fR variable. See
432\&\f(CW\*(C`PL_DBsingle\*(C'\fR.
433.Sp
434.Vb 1
435\& GV * PL_DBsub
436.Ve
437.IP "PL_DBtrace" 8
438.IX Xref "PL_DBtrace"
439.IX Item "PL_DBtrace"
440Trace variable used when Perl is run in debugging mode, with the \fB\-d\fR
441switch. This is the C variable which corresponds to Perl's \f(CW$DB::trace\fR
442variable. See \f(CW\*(C`PL_DBsingle\*(C'\fR.
443.Sp
444.Vb 1
445\& SV * PL_DBtrace
446.Ve
447.IP "PL_dowarn" 8
448.IX Xref "PL_dowarn"
449.IX Item "PL_dowarn"
450The C variable which corresponds to Perl's $^W warning variable.
451.Sp
452.Vb 1
453\& bool PL_dowarn
454.Ve
455.IP "PL_last_in_gv" 8
456.IX Xref "PL_last_in_gv"
457.IX Item "PL_last_in_gv"
458The \s-1GV\s0 which was last used for a filehandle input operation. (\f(CW\*(C`<FH>\*(C'\fR)
459.Sp
460.Vb 1
461\& GV* PL_last_in_gv
462.Ve
463.IP "PL_ofs_sv" 8
464.IX Xref "PL_ofs_sv"
465.IX Item "PL_ofs_sv"
466The output field separator \- \f(CW$,\fR in Perl space.
467.Sp
468.Vb 1
469\& SV* PL_ofs_sv
470.Ve
471.IP "PL_rs" 8
472.IX Xref "PL_rs"
473.IX Item "PL_rs"
474The input record separator \- \f(CW$/\fR in Perl space.
475.Sp
476.Vb 1
477\& SV* PL_rs
478.Ve
479.SH "GV Functions"
480.IX Header "GV Functions"
481.IP "is_gv_magical" 8
482.IX Xref "is_gv_magical"
483.IX Item "is_gv_magical"
484Returns \f(CW\*(C`TRUE\*(C'\fR if given the name of a magical \s-1GV\s0.
485.Sp
486Currently only useful internally when determining if a \s-1GV\s0 should be
487created even in rvalue contexts.
488.Sp
489\&\f(CW\*(C`flags\*(C'\fR is not used at present but available for future extension to
490allow selecting particular classes of magical variable.
491.Sp
492Currently assumes that \f(CW\*(C`name\*(C'\fR is \s-1NUL\s0 terminated (as well as len being valid).
493This assumption is met by all callers within the perl core, which all pass
494pointers returned by SvPV.
495.Sp
496.Vb 1
497\& bool is_gv_magical(char *name, STRLEN len, U32 flags)
498.Ve
499.SH "IO Functions"
500.IX Header "IO Functions"
501.IP "start_glob" 8
502.IX Xref "start_glob"
503.IX Item "start_glob"
504Function called by \f(CW\*(C`do_readline\*(C'\fR to spawn a glob (or do the glob inside
505perl on \s-1VMS\s0). This code used to be inline, but now perl uses \f(CW\*(C`File::Glob\*(C'\fR
506this glob starter is only used by miniperl during the build process.
507Moving it away shrinks pp_hot.c; shrinking pp_hot.c helps speed perl up.
508.Sp
509.Vb 1
510\& PerlIO* start_glob(SV* pattern, IO *io)
511.Ve
512.SH "Pad Data Structures"
513.IX Header "Pad Data Structures"
514.IP "CvPADLIST" 8
515.IX Xref "CvPADLIST"
516.IX Item "CvPADLIST"
517\&\s-1CV\s0's can have CvPADLIST(cv) set to point to an \s-1AV\s0.
518.Sp
519For these purposes \*(L"forms\*(R" are a kind-of \s-1CV\s0, eval"\*(L"s are too (except they're
520not callable at will and are always thrown away after the eval\*(R"" is done
521executing).
522.Sp
523XSUBs don't have CvPADLIST set \- dXSTARG fetches values from PL_curpad,
524but that is really the callers pad (a slot of which is allocated by
525every entersub).
526.Sp
527The CvPADLIST \s-1AV\s0 has does not have AvREAL set, so \s-1REFCNT\s0 of component items
528is managed \*(L"manual\*(R" (mostly in pad.c) rather than normal av.c rules.
529The items in the \s-1AV\s0 are not SVs as for a normal \s-1AV\s0, but other AVs:
530.Sp
5310'th Entry of the CvPADLIST is an \s-1AV\s0 which represents the \*(L"names\*(R" or rather
532the \*(L"static type information\*(R" for lexicals.
533.Sp
534The CvDEPTH'th entry of CvPADLIST \s-1AV\s0 is an \s-1AV\s0 which is the stack frame at that
535depth of recursion into the \s-1CV\s0.
536The 0'th slot of a frame \s-1AV\s0 is an \s-1AV\s0 which is \f(CW@_\fR.
537other entries are storage for variables and op targets.
538.Sp
539During compilation:
540\&\f(CW\*(C`PL_comppad_name\*(C'\fR is set to the names \s-1AV\s0.
541\&\f(CW\*(C`PL_comppad\*(C'\fR is set to the frame \s-1AV\s0 for the frame CvDEPTH == 1.
542\&\f(CW\*(C`PL_curpad\*(C'\fR is set to the body of the frame \s-1AV\s0 (i.e. AvARRAY(PL_comppad)).
543.Sp
544During execution, \f(CW\*(C`PL_comppad\*(C'\fR and \f(CW\*(C`PL_curpad\*(C'\fR refer to the live
545frame of the currently executing sub.
546.Sp
547Iterating over the names \s-1AV\s0 iterates over all possible pad
548items. Pad slots that are SVs_PADTMP (targets/GVs/constants) end up having
549&PL_sv_undef \*(L"names\*(R" (see \fIpad_alloc()\fR).
550.Sp
551Only my/our variable (SVs_PADMY/SVs_PADOUR) slots get valid names.
552The rest are op targets/GVs/constants which are statically allocated
553or resolved at compile time. These don't have names by which they
554can be looked up from Perl code at run time through eval"\*(L" like
555my/our variables can be. Since they can't be looked up by \*(R"name"
556but only by their index allocated at compile time (which is usually
557in PL_op\->op_targ), wasting a name \s-1SV\s0 for them doesn't make sense.
558.Sp
559The SVs in the names \s-1AV\s0 have their \s-1PV\s0 being the name of the variable.
560\&\s-1NV+1\s0..IV inclusive is a range of cop_seq numbers for which the name is
561valid. For typed lexicals name \s-1SV\s0 is SVt_PVMG and SvSTASH points at the
562type. For \f(CW\*(C`our\*(C'\fR lexicals, the type is SVt_PVGV, and GvSTASH points at the
563stash of the associated global (so that duplicate \f(CW\*(C`our\*(C'\fR declarations in the
564same package can be detected). SvCUR is sometimes hijacked to
565store the generation number during compilation.
566.Sp
567If SvFAKE is set on the name \s-1SV\s0 then slot in the frame AVs are
568a \s-1REFCNT\s0'ed references to a lexical from \*(L"outside\*(R". In this case,
569the name \s-1SV\s0 does not have a cop_seq range, since it is in scope
570throughout.
571.Sp
572If the 'name' is '&' the corresponding entry in frame \s-1AV\s0
573is a \s-1CV\s0 representing a possible closure.
574(SvFAKE and name of '&' is not a meaningful combination currently but could
575become so if \f(CW\*(C`my sub foo {}\*(C'\fR is implemented.)
576.Sp
577The flag SVf_PADSTALE is cleared on lexicals each time the \fImy()\fR is executed,
578and set on scope exit. This allows the 'Variable \f(CW$x\fR is not available' warning
579to be generated in evals, such as
580.Sp
581.Vb 1
582\& { my $x = 1; sub f { eval '$x'} } f();
583.Ve
584.Sp
585.Vb 1
586\& AV * CvPADLIST(CV *cv)
587.Ve
588.IP "cv_clone" 8
589.IX Xref "cv_clone"
590.IX Item "cv_clone"
591Clone a \s-1CV:\s0 make a new \s-1CV\s0 which points to the same code etc, but which
592has a newly-created pad built by copying the prototype pad and capturing
593any outer lexicals.
594.Sp
595.Vb 1
596\& CV* cv_clone(CV* proto)
597.Ve
598.IP "cv_dump" 8
599.IX Xref "cv_dump"
600.IX Item "cv_dump"
601dump the contents of a \s-1CV\s0
602.Sp
603.Vb 1
604\& void cv_dump(const CV *cv, const char *title)
605.Ve
606.IP "do_dump_pad" 8
607.IX Xref "do_dump_pad"
608.IX Item "do_dump_pad"
609Dump the contents of a padlist
610.Sp
611.Vb 1
612\& void do_dump_pad(I32 level, PerlIO *file, PADLIST *padlist, int full)
613.Ve
614.IP "intro_my" 8
615.IX Xref "intro_my"
616.IX Item "intro_my"
617\&\*(L"Introduce\*(R" my variables to visible status.
618.Sp
619.Vb 1
620\& U32 intro_my()
621.Ve
622.IP "pad_add_anon" 8
623.IX Xref "pad_add_anon"
624.IX Item "pad_add_anon"
625Add an anon code entry to the current compiling pad
626.Sp
627.Vb 1
628\& PADOFFSET pad_add_anon(SV* sv, OPCODE op_type)
629.Ve
630.IP "pad_add_name" 8
631.IX Xref "pad_add_name"
632.IX Item "pad_add_name"
633Create a new name in the current pad at the specified offset.
634If \f(CW\*(C`typestash\*(C'\fR is valid, the name is for a typed lexical; set the
635name's stash to that value.
636If \f(CW\*(C`ourstash\*(C'\fR is valid, it's an our lexical, set the name's
637GvSTASH to that value
638.Sp
639Also, if the name is @.. or %.., create a new array or hash for that slot
640.Sp
641If fake, it means we're cloning an existing entry
642.Sp
643.Vb 1
644\& PADOFFSET pad_add_name(char *name, HV* typestash, HV* ourstash, bool clone)
645.Ve
646.IP "pad_alloc" 8
647.IX Xref "pad_alloc"
648.IX Item "pad_alloc"
649Allocate a new my or tmp pad entry. For a my, simply push a null \s-1SV\s0 onto
650the end of PL_comppad, but for a tmp, scan the pad from PL_padix upwards
651for a slot which has no name and no active value.
652.Sp
653.Vb 1
654\& PADOFFSET pad_alloc(I32 optype, U32 tmptype)
655.Ve
656.IP "pad_block_start" 8
657.IX Xref "pad_block_start"
658.IX Item "pad_block_start"
659Update the pad compilation state variables on entry to a new block
660.Sp
661.Vb 1
662\& void pad_block_start(int full)
663.Ve
664.IP "pad_check_dup" 8
665.IX Xref "pad_check_dup"
666.IX Item "pad_check_dup"
667Check for duplicate declarations: report any of:
668 * a my in the current scope with the same name;
669 * an our (anywhere in the pad) with the same name and the same stash
670 as \f(CW\*(C`ourstash\*(C'\fR
671\&\f(CW\*(C`is_our\*(C'\fR indicates that the name to check is an 'our' declaration
672.Sp
673.Vb 1
674\& void pad_check_dup(char* name, bool is_our, HV* ourstash)
675.Ve
676.IP "pad_findlex" 8
677.IX Xref "pad_findlex"
678.IX Item "pad_findlex"
679Find a named lexical anywhere in a chain of nested pads. Add fake entries
680in the inner pads if it's found in an outer one. innercv is the \s-1CV\s0 *inside*
681the chain of outer CVs to be searched. If newoff is non\-null, this is a
682run-time cloning: don't add fake entries, just find the lexical and add a
683ref to it at newoff in the current pad.
684.Sp
685.Vb 1
686\& PADOFFSET pad_findlex(const char* name, PADOFFSET newoff, const CV* innercv)
687.Ve
688.IP "pad_findmy" 8
689.IX Xref "pad_findmy"
690.IX Item "pad_findmy"
691Given a lexical name, try to find its offset, first in the current pad,
692or failing that, in the pads of any lexically enclosing subs (including
693the complications introduced by eval). If the name is found in an outer pad,
694then a fake entry is added to the current pad.
695Returns the offset in the current pad, or \s-1NOT_IN_PAD\s0 on failure.
696.Sp
697.Vb 1
698\& PADOFFSET pad_findmy(char* name)
699.Ve
700.IP "pad_fixup_inner_anons" 8
701.IX Xref "pad_fixup_inner_anons"
702.IX Item "pad_fixup_inner_anons"
703For any anon CVs in the pad, change CvOUTSIDE of that \s-1CV\s0 from
704old_cv to new_cv if necessary. Needed when a newly-compiled \s-1CV\s0 has to be
705moved to a pre-existing \s-1CV\s0 struct.
706.Sp
707.Vb 1
708\& void pad_fixup_inner_anons(PADLIST *padlist, CV *old_cv, CV *new_cv)
709.Ve
710.IP "pad_free" 8
711.IX Xref "pad_free"
712.IX Item "pad_free"
713Free the \s-1SV\s0 at offset po in the current pad.
714.Sp
715.Vb 1
716\& void pad_free(PADOFFSET po)
717.Ve
718.IP "pad_leavemy" 8
719.IX Xref "pad_leavemy"
720.IX Item "pad_leavemy"
721Cleanup at end of scope during compilation: set the max seq number for
722lexicals in this scope and warn of any lexicals that never got introduced.
723.Sp
724.Vb 1
725\& void pad_leavemy()
726.Ve
727.IP "pad_new" 8
728.IX Xref "pad_new"
729.IX Item "pad_new"
730Create a new compiling padlist, saving and updating the various global
731vars at the same time as creating the pad itself. The following flags
732can be \s-1OR\s0'ed together:
733.Sp
734.Vb 3
735\& padnew_CLONE this pad is for a cloned CV
736\& padnew_SAVE save old globals
737\& padnew_SAVESUB also save extra stuff for start of sub
738.Ve
739.Sp
740.Vb 1
741\& PADLIST* pad_new(int flags)
742.Ve
743.IP "pad_push" 8
744.IX Xref "pad_push"
745.IX Item "pad_push"
746Push a new pad frame onto the padlist, unless there's already a pad at
747this depth, in which case don't bother creating a new one.
748If has_args is true, give the new pad an \f(CW@_\fR in slot zero.
749.Sp
750.Vb 1
751\& void pad_push(PADLIST *padlist, int depth, int has_args)
752.Ve
753.IP "pad_reset" 8
754.IX Xref "pad_reset"
755.IX Item "pad_reset"
756Mark all the current temporaries for reuse
757.Sp
758.Vb 1
759\& void pad_reset()
760.Ve
761.IP "pad_setsv" 8
762.IX Xref "pad_setsv"
763.IX Item "pad_setsv"
764Set the entry at offset po in the current pad to sv.
765Use the macro \s-1\fIPAD_SETSV\s0()\fR rather than calling this function directly.
766.Sp
767.Vb 1
768\& void pad_setsv(PADOFFSET po, SV* sv)
769.Ve
770.IP "pad_swipe" 8
771.IX Xref "pad_swipe"
772.IX Item "pad_swipe"
773Abandon the tmp in the current pad at offset po and replace with a
774new one.
775.Sp
776.Vb 1
777\& void pad_swipe(PADOFFSET po, bool refadjust)
778.Ve
779.IP "pad_tidy" 8
780.IX Xref "pad_tidy"
781.IX Item "pad_tidy"
782Tidy up a pad after we've finished compiling it:
783 * remove most stuff from the pads of anonsub prototypes;
784 * give it a \f(CW@_\fR;
785 * mark tmps as such.
786.Sp
787.Vb 1
788\& void pad_tidy(padtidy_type type)
789.Ve
790.IP "pad_undef" 8
791.IX Xref "pad_undef"
792.IX Item "pad_undef"
793Free the padlist associated with a \s-1CV\s0.
794If parts of it happen to be current, we null the relevant
795PL_*pad* global vars so that we don't have any dangling references left.
796We also repoint the CvOUTSIDE of any about-to-be-orphaned
797inner subs to the outer of this cv.
798.Sp
799(This function should really be called pad_free, but the name was already
800taken)
801.Sp
802.Vb 1
803\& void pad_undef(CV* cv)
804.Ve
805.SH "Stack Manipulation Macros"
806.IX Header "Stack Manipulation Macros"
807.IP "djSP" 8
808.IX Xref "djSP"
809.IX Item "djSP"
810Declare Just \f(CW\*(C`SP\*(C'\fR. This is actually identical to \f(CW\*(C`dSP\*(C'\fR, and declares
811a local copy of perl's stack pointer, available via the \f(CW\*(C`SP\*(C'\fR macro.
812See \f(CW\*(C`SP\*(C'\fR. (Available for backward source code compatibility with the
813old (Perl 5.005) thread model.)
814.Sp
815.Vb 1
816\& djSP;
817.Ve
818.IP "\s-1LVRET\s0" 8
819.IX Xref "LVRET"
820.IX Item "LVRET"
821True if this op will be the return value of an lvalue subroutine
822.SH "SV Manipulation Functions"
823.IX Header "SV Manipulation Functions"
824.IP "report_uninit" 8
825.IX Xref "report_uninit"
826.IX Item "report_uninit"
827Print appropriate \*(L"Use of uninitialized variable\*(R" warning
828.Sp
829.Vb 1
830\& void report_uninit()
831.Ve
832.IP "sv_add_arena" 8
833.IX Xref "sv_add_arena"
834.IX Item "sv_add_arena"
835Given a chunk of memory, link it to the head of the list of arenas,
836and split it into a list of free SVs.
837.Sp
838.Vb 1
839\& void sv_add_arena(char* ptr, U32 size, U32 flags)
840.Ve
841.IP "sv_clean_all" 8
842.IX Xref "sv_clean_all"
843.IX Item "sv_clean_all"
844Decrement the refcnt of each remaining \s-1SV\s0, possibly triggering a
845cleanup. This function may have to be called multiple times to free
846SVs which are in complex self-referential hierarchies.
847.Sp
848.Vb 1
849\& I32 sv_clean_all()
850.Ve
851.IP "sv_clean_objs" 8
852.IX Xref "sv_clean_objs"
853.IX Item "sv_clean_objs"
854Attempt to destroy all objects not yet freed
855.Sp
856.Vb 1
857\& void sv_clean_objs()
858.Ve
859.IP "sv_free_arenas" 8
860.IX Xref "sv_free_arenas"
861.IX Item "sv_free_arenas"
862Deallocate the memory used by all arenas. Note that all the individual \s-1SV\s0
863heads and bodies within the arenas must already have been freed.
864.Sp
865.Vb 1
866\& void sv_free_arenas()
867.Ve
868.SH "AUTHORS"
869.IX Header "AUTHORS"
870The autodocumentation system was originally added to the Perl core by
871Benjamin Stuhl. Documentation is by whoever was kind enough to
872document their functions.
873.SH "SEE ALSO"
874.IX Header "SEE ALSO"
875\&\fIperlguts\fR\|(1), \fIperlapi\fR\|(1)