Skip to content
Browse files

0.41 update IV >= 5.10, added arena

  • Loading branch information...
1 parent ad73f25 commit fcfb96d84e3397f0d9fef8ccdaca42174352a3cf @rurban committed Apr 5, 2012
Showing with 107 additions and 53 deletions.
  1. +5 −0 Changes
  2. +1 −1 META.yml
  3. +3 −1 Makefile
  4. +1 −1 VERSION
  5. BIN box.ps
  6. +4 −4 eps2png
  7. BIN illguts.chm
  8. +4 −0 illguts.hhk
  9. +1 −1 illguts.hhp
  10. BIN illguts.pdf
  11. +39 −20 index-work.html
  12. +26 −12 sviv-10.epsx
  13. +23 −13 sviv-14.epsx
View
5 Changes
@@ -1,3 +1,8 @@
+0.41 2012-04-05 rurban@cpan.org
+ * index: update IV,NV >= 5.10,
+ added arena
+ * iv-10,14: updated
+
0.40 2012-04-04 rurban@cpan.org
* index: finalize 5.16
* hv-14: replace NAME chararray by hek
View
2 META.yml
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: illguts
-version: 0.40
+version: 0.41
abstract: illustrated perl guts
author:
- Gisle Aas <gisle@aas.no>
View
4 Makefile
@@ -16,7 +16,8 @@ png=svhead.png \
opsamp2.png \
stack.png \
context.png \
- eval.png
+ eval.png \
+ arena.png
png-8=av-8.png \
cv-8.png \
@@ -152,6 +153,7 @@ dist: all VERSION test_rel
./make_dist
# deps
+arena.png: sv.ps box.ps
av-8.png: av-8.epsx sv-8.ps common.ps rect.ps ptr.ps box.ps mws.ps break.ps
av-10.png: av-10.epsx sv.ps common.ps rect.ps ptr.ps box.ps mws.ps break.ps
av-14.png: av-14.epsx sv.ps common.ps rect.ps ptr.ps box.ps mws.ps break.ps
View
2 VERSION
@@ -1 +1 @@
-0.40
+0.41
View
BIN box.ps
Binary file not shown.
View
8 eps2png
@@ -1,9 +1,9 @@
#!/bin/sh
-./eps2ppm $1 > _err
-sleep 0.01
-if $(grep "Error:" _err >/dev/null); then
+./eps2ppm $1 > _err$$
+sleep 0.3
+if $(grep "Error:" _err$$ >/dev/null); then
rm $1
exit
fi
-cat _err | (rm _err; pnmscale 0.4) | ppmquant 32 | pnmtopng -compression 9
+cat _err$$ | (rm _err$$; pnmscale 0.4) | ppmquant 32 | pnmtopng -compression 9
View
BIN illguts.chm
Binary file not shown.
View
4 illguts.hhk
@@ -250,6 +250,10 @@
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
+ <param name="Keyword" value="Arena">
+ <param name="Local" value="index.html#arena">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
<param name="Keyword" value="RV">
<param name="Local" value="index.html#svrv">
</OBJECT>
View
2 illguts.hhp
@@ -7,7 +7,7 @@ Display compile progress=No
Full-text search=Yes
Index file=illguts.hhk
Language=0x409 Englisch (USA)
-Title=illguts-0.40
+Title=illguts-0.41
[FILES]
index.html
View
BIN illguts.pdf
Binary file not shown.
View
59 index-work.html
@@ -22,7 +22,7 @@
<body bgcolor="#FFFFFF" text="#000000" link="#000055" vlink="#550000" alink="#000000" topmargin="0">
<h1 align="center" name="top">PerlGuts Illustrated<br><br>
-<small>Version 0.40, for perl 5.16 and older</small></h1>
+<small>Version 0.41, for perl 5.16 and older</small></h1>
<p>This document is meant to supplement the <i><a href="http://perldoc.perl.org/perlguts.html">perlguts(1)</a></i> manual
page that comes with Perl. It contains commented illustrations of all major internal Perl data structures.
@@ -150,10 +150,10 @@ <h1 align="center" name="top">PerlGuts Illustrated<br><br>
<p>The third word contains a <b>FLAGS</b> field and a <b>TYPE</b> field as 32 bit
unsigned integer.
-<p>Since 5.10 the forth and last word contains the <b>sv_u union</b>, which
-contains a pointer to another SV (a RV), the <a href="#svpv">PV</a>
-string, the <a href="#av">AV</a> svu_array, a <a href="#he">HE</a>
-hash or a <a href="#gp">GP</a> struct.
+<p>Since 5.10 the forth and last HEAD word contains the <b>sv_u union</b>, which
+contains a pointer to another SV (a RV), the <a href="#sviv">IV</a>
+value, the <a href="#svpv">PV</a> string, the <a href="#av">AV</a> svu_array,
+a <a href="#he">HE</a> hash or a <a href="#gp">GP</a> struct.
<a name="flags">The TYPE field contains a small number (0-127, mask <code>0xff</code>) that
represents one of the <code>SVt_</code> types shown in the type hierarchy figure
@@ -378,15 +378,33 @@ <h1 align="center" name="top">PerlGuts Illustrated<br><br>
arrays or hashes have <code>AV*</code> or <code>HV*</code>
respectively in their parameter list. Likewise for the rest.
+<h2><a name="arena">Arena</a></h2>
+
+<p>Since 5.10 SV heads and bodies are allocated in 4K arenas chunks.
+Heads need 4 fields, bodies are kept in uneequal sized arena sets.
+Some types need no body (<i>NULL, IV, RV</i>), and some allocate
+only partial bodies with <i>"ghost"</i> fields.</p>
+
+<p><b>PL_sv_arenaroot</b> points to the first reserved SV arena head with
+some private arena data, a link to the next arena, some flags,
+number of frees slots.<br>
+<b>PL_sv_root</b> points to the chained list of free SV head slots.
+When this becomes empty a new arena is allocated.</p>
+
+<b>PL_body_arenas</b> is the head of the uneven sized linked-list of body arenas.<br>
+<b>PL_body_roots[]</b> contains pointers to the list of free SV bodies per svtype.
+
+<p><center><img src="arena.png"></center>
+
<h2><a name="svpv">SvPV</a></h2>
<p>A scalar that can hold a string value is called an
<i>SvPV</i>. In addition to the <i>SV</i> struct of SvNULL,
-an <i>xpv</i> struct is allocated and it contains 3-4 fields.
+an <i>xpv</i> struct ("body") is allocated and it contains 3-4 fields.
<b>svu_pv</b> was formerly called <b>PVX</b> and before 5.10
it was the first field of xpv. svu_pv/PVX is the pointer to
an allocated char array. All old field names <b>must</b> be
-accessed through the old macros, which is called SvPVX().
+accessed through the old macros, which is called SvPVX().
<b>CUR</b> is an integer giving the current length of the string.
@@ -433,28 +451,29 @@ <h1 align="center" name="top">PerlGuts Illustrated<br><br>
<p><center><img src="ook.png"></center>
-<h2><a name="sviv">SvIV</a> and <a name="svnv">SvNV</a></h2>
+<h2><a name="sviv">SvIV</a></h2>
-<i>SvIVX</i> uses the xiv_u .xiv_iv slot in the xiv_u union
-(don't be fooled by the convenience shortcut xiv_iv),
-<i>SvNVX</i> uses the xnv_u.xnv_nv slot in the xnv_u union.
+Since 5.10 for a raw IV (without PV) the IVX slot is in the HEAD,
+there is no xpviv struct ("body") allocated.
-<!-- <p>As a special case we also have <i>SvIV</i> and <i>SvNV</i> types
-that only have room for a single integer or a single double value.
-These are special in that the PVX/CUR/LEN fields are not present even
-if the ANY pointer actually points to the ghostual incarnation of
-them. This arrangement makes it possible for code to always access
-the IVX/NVX fields at a fixed offset from where the SV field ANY
-points. -->
+The <i>SvIVX</i> macro abuses sv_any pointer arithmethic to point
+to a compile-time calculated negative offset from HEAD->sv_u.svu_iv
+to SvANY(xiv_u.xivu_iv), so that PVIV and IV can use the same SvIVX
+macro.
<p><center><img src="sviv.png"></center>
+<h2><a name="svnv">SvNV</a></h2>
+
+Since 5.10 for a raw NV (without PV) the xpvnv struct is not fully allocated,
+only the needed body size.
+
<p><center><img src="svnv.png"></center>
<h2><a name="svrv">SvRV</a></h2>
-<p>The <i>SvRV</i> type uses the fourth word sv_u.svu_rv as pointer to an SV
-(which can be any of the SvNULL subtypes), AV or HV.
+<p>The <i>SvRV</i> type uses the fourth HEAD word sv_u.svu_rv as pointer to an SV
+(which can be any of the SvNULL subtypes), AV or HV.
A SvRV object with ROK flag off represents an undefined value.
<p><center><img src="svrv.png"></center>
View
38 sviv-10.epsx
@@ -1,34 +1,48 @@
%!PS-Adobe-2.0 EPSF-1.2
-%%BoundingBox: -5 235 110 305
-%%Creator: Gisle Aas (Copyright 1998), Reini Urban (Copyright 2009)
+%%BoundingBox: -15 -80 150 20
+%%Creator: Gisle Aas (Copyright 1998), Reini Urban (Copyright 2009,2012)
%require "common.ps"
%require "sv.ps"
%require "box.ps"
-0 300 sv
+55 7.5 70 7.5 70 -52.5 60 -52.5 ptrn % *ANY -> IVX
-/Helvetica 9 SF
-20 262 M (svu_pv) cshow
+gsave
+ 1.5 dup scale
+ 0 0 sv2
+ /Helvetica 9 SF
+ 20 -38 M (IVX) cshow
+ 20 2 M (*ANY) cshow
+ 20 -8 M (ANY) cshow
+
+ 0.7 setgray
+ [3 2] 0 setdash
+ 0 11 40 1 rect S % ANY
+grestore
+0 setgray
+[1 0] 0 setdash
+5 -7.5 -10 -7.5 -10 7.5 0 7.5 ptrn % ANY -> *ANY
gsave
0.7 setgray
[3 2] 0 setdash
- 55 300 4 box
+ 85 0 5 box
+ 130 -7.5 145 -7.5 145 -67.5 135 -67.5 ptrn % -> xiv_iv
grestore
-55 300 45 sub 1 box
+gsave
+ 1 setgray % strike out xnv_u line (2 boxes)
+ 85 -14 135 -16 rect F
+grestore
/Helvetica 11 SF
-60 303 15 sub M
-
+90 3 15 sub M
0.7 setgray
-[(xnv_u) (cur) (len)] {
+[(xnv_u) () (cur) (len) (xivu_iv)] {
gsave
show
grestore
0 -15 rmoveto
} forall
0 setgray
-/Helvetica 12 SF
-(xiv_iv) show
View
36 sviv-14.epsx
@@ -1,34 +1,44 @@
%!PS-Adobe-2.0 EPSF-1.2
-%%BoundingBox: -5 220 110 305
-%%Creator: Gisle Aas (Copyright 1998), Reini Urban (Copyright 2009, 2010)
+%%BoundingBox: -15 -80 150 20
+%%Creator: Gisle Aas (Copyright 1998), Reini Urban (Copyright 2009,2010,2012)
%require "common.ps"
%require "sv.ps"
%require "box.ps"
-0 300 sv
+55 7.5 70 7.5 70 -52.5 60 -52.5 ptrn % *ANY -> IVX
-/Helvetica 9 SF
-20 262 M (svu_pv) cshow
+gsave
+ 1.5 dup scale
+ 0 0 sv2
+ /Helvetica 9 SF
+ 20 -38 M (IVX) cshow
+ 20 2 M (*ANY) cshow
+ 20 -8 M (ANY) cshow
+
+ 0.7 setgray
+ [3 2] 0 setdash
+ 0 11 40 1 rect S % ANY
+grestore
+0 setgray
+[1 0] 0 setdash
+5 -7.5 -10 -7.5 -10 7.5 0 7.5 ptrn % ANY -> *ANY
gsave
0.7 setgray
[3 2] 0 setdash
- 55 300 5 box
+ 85 0 5 box
+ 130 -7.5 145 -7.5 145 -67.5 135 -67.5 ptrn % -> xiv_iv
grestore
-55 300 60 sub 1 box
+%85 0 60 sub 1 box
/Helvetica 11 SF
-60 303 15 sub M
-
+90 3 15 sub M
0.7 setgray
-[(STASH) (MAGIC) (cur) (len)] {
+[(STASH) (MAGIC) (cur) (len) (xiv_iv)] {
gsave
show
grestore
0 -15 rmoveto
} forall
-0 setgray
-/Helvetica 12 SF
-(xiv_iv) show

0 comments on commit fcfb96d

Please sign in to comment.
Something went wrong with that request. Please try again.