Skip to content

Commit

Permalink
Integrate:
Browse files Browse the repository at this point in the history
[ 34132]
Test that formats can be dumped.

[ 34133]
PVFMs don't need to access the IVX any more. (as of change 32836, which
re-implemented SvOOK() to avoid using it)

[ 34167]
You can't (and shouldn't) use CvDEPTH on a PVFM.

[ 35022]
in Dump output, PV field of format may or not be displayed in 5.10.0

[ 35023]
whether DEPTH gets dumped in formats varies within 5.10.0
p4raw-link: @35023 on //depot/perl: c12100a
p4raw-link: @35022 on //depot/perl: 251a4af
p4raw-link: @34167 on //depot/perl: 5129b2c
p4raw-link: @34133 on //depot/perl: 30ec677
p4raw-link: @34132 on //depot/perl: bfe27a5

p4raw-id: //depot/maint-5.10/perl@35024
p4raw-integrated: from //depot/perl@35022 'ignore'
	ext/Devel/Peek/t/Peek.t (@34167..)
p4raw-integrated: from //depot/perl@34167 'edit in' dump.c (@34133..)
	'merge in' cv.h (@34030..)
p4raw-integrated: from //depot/perl@34133 'merge in' sv.h (@34038..)
  • Loading branch information
Dave Mitchell committed Dec 5, 2008
1 parent d72ded7 commit 5b7362a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cv.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ Returns the stash of the CV.
#define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv)))
#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
# define CvDEPTH(sv) (*({const CV *_cvdepth = (CV *)sv; \
assert(SvTYPE(_cvdepth) == SVt_PVCV || \
SvTYPE(_cvdepth) == SVt_PVFM); \
assert(SvTYPE(_cvdepth) == SVt_PVCV); \
&((XPVCV*)SvANY(_cvdepth))->xiv_u.xivu_i32; \
}))
#else
Expand Down
5 changes: 3 additions & 2 deletions dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
return;
}
if ((type >= SVt_PVIV && type != SVt_PVAV && type != SVt_PVHV
&& type != SVt_PVCV && !isGV_with_GP(sv))
&& type != SVt_PVCV && !isGV_with_GP(sv) && type != SVt_PVFM)
|| type == SVt_IV) {
if (SvIsUV(sv)
#ifdef PERL_OLD_COPY_ON_WRITE
Expand Down Expand Up @@ -1769,7 +1769,8 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
}
do_gvgv_dump(level, file, " GVGV::GV", CvGV(sv));
Perl_dump_indent(aTHX_ level, file, " FILE = \"%s\"\n", CvFILE(sv));
Perl_dump_indent(aTHX_ level, file, " DEPTH = %"IVdf"\n", (IV)CvDEPTH(sv));
if (type == SVt_PVCV)
Perl_dump_indent(aTHX_ level, file, " DEPTH = %"IVdf"\n", (IV)CvDEPTH(sv));
Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)CvFLAGS(sv));
Perl_dump_indent(aTHX_ level, file, " OUTSIDE_SEQ = %"UVuf"\n", (UV)CvOUTSIDE_SEQ(sv));
if (type == SVt_PVFM)
Expand Down
41 changes: 40 additions & 1 deletion ext/Devel/Peek/t/Peek.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@ BEGIN { require "./test.pl"; }

use Devel::Peek;

plan(50);
plan(52);

our $DEBUG = 0;
open(SAVERR, ">&STDERR") or die "Can't dup STDERR: $!";

# If I reference any lexicals in this, I get the entire outer subroutine (or
# MAIN) dumped too, which isn't really what I want, as it's a lot of faff to
# maintain that.
format PIE =
Pie @<<<<<
$::type
Good @>>>>>
$::mmmm
.

sub do_test {
my $todo = $_[3];
my $repeat_todo = $_[4];
Expand Down Expand Up @@ -624,3 +634,32 @@ do_test(25,
SUBPROCESS = 0 # $] < 5.009
TYPE = \'>\'
FLAGS = 0x0');

do_test(26,
*PIE{FORMAT},
'SV = $RV\\($ADDR\\) at $ADDR
REFCNT = 1
FLAGS = \\(ROK\\)
RV = $ADDR
SV = PVFM\\($ADDR\\) at $ADDR
REFCNT = 2
FLAGS = \\(\\)
IV = 0 # $] < 5.009
NV = 0 # $] < 5.009
(?: PV = 0
)? COMP_STASH = 0x0
START = $ADDR ===> \\d+
ROOT = $ADDR
XSUB = 0x0 # $] < 5.009
XSUBANY = 0 # $] < 5.009
GVGV::GV = $ADDR\\t"main" :: "PIE"
FILE = ".*\\b(?i:peek\\.t)"
(?: DEPTH = 0
MUTEXP = $ADDR
OWNER = $ADDR
)? FLAGS = 0x0
OUTSIDE_SEQ = \\d+
LINES = 0
PADLIST = $ADDR
PADNAME = $ADDR\\($ADDR\\) PAD = $ADDR\\($ADDR\\)
OUTSIDE = $ADDR \\(MAIN\\)');
2 changes: 2 additions & 0 deletions sv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,7 @@ the scalar's value cannot change unless written to.
assert(SvTYPE(_svivx) != SVt_PVAV); \
assert(SvTYPE(_svivx) != SVt_PVHV); \
assert(SvTYPE(_svivx) != SVt_PVCV); \
assert(SvTYPE(_svivx) != SVt_PVFM); \
assert(!isGV_with_GP(_svivx)); \
&(((XPVIV*) SvANY(_svivx))->xiv_iv); \
}))
Expand All @@ -1285,6 +1286,7 @@ the scalar's value cannot change unless written to.
assert(SvTYPE(_svuvx) != SVt_PVAV); \
assert(SvTYPE(_svuvx) != SVt_PVHV); \
assert(SvTYPE(_svuvx) != SVt_PVCV); \
assert(SvTYPE(_svuvx) != SVt_PVFM); \
assert(!isGV_with_GP(_svuvx)); \
&(((XPVUV*) SvANY(_svuvx))->xuv_uv); \
}))
Expand Down

0 comments on commit 5b7362a

Please sign in to comment.