Skip Menu |

This queue is for tickets about the Devel-Size CPAN distribution.

Report information
The Basics
Id: 73998
Status: resolved
Priority: 0/
Queue: Devel-Size

People
Owner: Nobody in particular
Requestors: d.thomas [...] its.uq.edu.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: t/globs.t fails under bleadperl 5.15.6
Devel-Size-0.77, perl-5.15.6, RHEL6 this is first time I tried building under any 5.15.x root@minneola# make test PERL_DL_NONLAZY=1 /opt/perl/uq.is.perl.rhel6-5.15.6-20120115/bin/perl5.15.6 "- MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/basic.t ..... ok t/code.t ...... ok t/globs.t ..... 1/44 # Failed test 'CV grew by expected amount for SCALAR' # at t/globs.t line 132. # got: '56626' # expected: '56586' # Looks like you failed 1 test of 44. t/globs.t ..... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/44 subtests t/magic.t ..... ok t/pod.t ....... ok t/pod_cov.t ... ok t/pvbm.t ...... ok t/recurse.t ... ok t/warnings.t .. skipped: no Test::PerlRun found
I have a patch for that but I do not fully understand why suddenly with 5.15.6 the CV shared 5 pointers less. Nick should now and adjust it. -- Reini Urban
Subject: Devel-Size-0.77.patch
diff -bu Devel-Size-0.77/CHANGES~ Devel-Size-0.77/CHANGES --- Devel-Size-0.77/CHANGES~ 2012-02-09 15:28:04.968333400 -0600 +++ Devel-Size-0.77/CHANGES 2012-02-09 16:28:22.979078901 -0600 @@ -1,5 +1,8 @@ Revision history for Perl extension Devel::Size. +0.78 2012-02-09 rurban + * 5.15.6 CV shares now 5 pointers with GvGP (? rurban thinks so). [CPAN #73998] + 0.77 2011-05-16 nicholas [no changes] diff -bu Devel-Size-0.77/t/globs.t~ Devel-Size-0.77/t/globs.t --- Devel-Size-0.77/t/globs.t~ 2012-02-09 15:28:04.972333362 -0600 +++ Devel-Size-0.77/t/globs.t 2012-02-09 16:24:57.552966767 -0600 @@ -129,6 +129,8 @@ cmp_ok($gv_now_total_size, '>', $gv_was_total_size, "GV total size grew for $type"); } else { + #diag "$cv_now_size, $cv_was_size, $new_thing_size" if $type eq 'SCALAR'; + $cv_now_size -= $Config{ptrsize}*5 if $type eq 'SCALAR' and $] > 5.015006; is($cv_now_size, $cv_was_size + $new_thing_size, "CV grew by expected amount for $type") unless $Config{useithreads};
Subject: Re: [rt.cpan.org #73998] t/globs.t fails under bleadperl 5.15.6
Date: Thu, 9 Feb 2012 23:20:03 +0000
To: "<bug-Devel-Size [...] rt.cpan.org>" <bug-Devel-Size [...] rt.cpan.org>
From: Danny Thomas <d.thomas [...] its.uq.edu.au>
On 10/02/2012, at 9:08 AM, Reini Urban via RT wrote: Show quoted text
> I have a patch for that but I do not fully understand why suddenly with > 5.15.6 the CV shared 5 pointers less. Nick should now and adjust it.
so it looks like an issue with the test which is reassuring rather than something more fundamental. BTW I only started building against bleadperl with 5.15.5 so it might have been there earlier. Along with other updates including YAML, I think there's very few of modules I built with still having a problem. thanks Danny
On Thu Feb 09 18:08:07 2012, RURBAN wrote: Show quoted text
> I have a patch for that but I do not fully understand why suddenly with > 5.15.6 the CV shared 5 pointers less. Nick should now and adjust it.
Nope, this version failed on 32bit use64bitint. And the explanation is now a bit weirder. Revised patch attached -- Reini Urban
Subject: Devel-Size-0.77.patch
difforig Devel-Size-0.77 diff -u Devel-Size-0.77/CHANGES.orig --- Devel-Size-0.77/CHANGES.orig 2012-02-09 17:35:47.988927215 -0600 +++ Devel-Size-0.77/CHANGES 2012-02-09 17:36:45.224378224 -0600 @@ -1,5 +1,8 @@ Revision history for Perl extension Devel::Size. +0.78 2012-02-09 16:27:55 rurban + * 5.15.6 CV shares now 4 IV and a pointer with GvGP [CPAN #73998] (? rurban thinks so) + 0.77 2011-05-16 nicholas [no changes] diff -u Devel-Size-0.77/t/globs.t.orig --- Devel-Size-0.77/t/globs.t.orig 2012-02-09 17:35:21.901177419 -0600 +++ Devel-Size-0.77/t/globs.t 2012-02-09 17:23:57.803732742 -0600 @@ -129,9 +129,15 @@ cmp_ok($gv_now_total_size, '>', $gv_was_total_size, "GV total size grew for $type"); } else { - is($cv_now_size, $cv_was_size + $new_thing_size, - "CV grew by expected amount for $type") - unless $Config{useithreads}; + unless ($Config{useithreads}) { + diag "$cv_now_size, $cv_was_size, $new_thing_size" if $type eq 'SCALAR'; + if ($type eq 'SCALAR' and $] > 5.015006) { + $cv_now_size -= $Config{ptrsize}*5 ; + $cv_now_size -= 4 if $Config{ptrsize} == 4 and $Config{ivsize} == 8; + } + is($cv_now_size, $cv_was_size + $new_thing_size, + "CV grew by expected amount for $type") + } is($io_now_size, $io_was_size + $new_thing_size, "IO total_size grew by expected amount for $type"); is($gv_now_size, $gv_was_size + $new_thing_size,
On Thu Feb 09 18:53:29 2012, RURBAN wrote: Show quoted text
> On Thu Feb 09 18:08:07 2012, RURBAN wrote:
> > I have a patch for that but I do not fully understand why suddenly with > > 5.15.6 the CV shared 5 pointers less. Nick should now and adjust it.
> > > Nope, this version failed on 32bit use64bitint. And the explanation is > now a bit weirder. > > Revised patch attached
Thanks for trying to nail it. I had a long look, and the explanation seems to be much much stranger than this. If one changes the order of these three in globs.t: gv_grew('glipp', 'zok', 'no strict "vars"; $zok = undef; 1', 'SCALAR'); gv_grew('bang', 'boff', 'no strict "vars"; @boff = (); 1', 'ARRAY'); gv_grew('clange', 'sock', 'no strict "vars"; %sock = (); 1', 'HASH'); then it's always the *first* one that fails. I bisected the blead commit that caused the failure using this shell script to unpack Devel::Size into the perl tree before building perl: #!/bin/sh git clean -dxf # If you get './makedepend: 1: Syntax error: Unterminated quoted # string' when bisecting versions of perl older than 5.9.5 this hack # will work around the bug in makedepend.SH which was fixed in # version 96a8704c. Make sure to comment out 'git checkout makedepend.SH' # below too. git show blead:makedepend.SH > makedepend.SH (cd ext && tar xfz /Volumes/Nonsense/cpan/authors/id/N/NW/NWCLARK/Devel-Size-0.77.tar.gz && mv Devel-Size-0.77 Devel-Size) # If you can use ccache, add -Dcc=ccache\ gcc -Dld=gcc to the Configure line # if Encode is not needed for the test, you can speed up the bisect by # excluding it from the runs with -Dnoextensions=Encode ./Configure -Dusedevel -Dcc=ccache\ gcc -Dld=gcc -Dnoextensions=Encode -de test -f config.sh || exit 125 # Correct makefile for newer GNU gcc perl -ni -we 'print unless /<(?:built-in|command)/' makefile x2p/makefile # if you just need miniperl, replace test_prep with miniperl make -j3 test_prep [ -x ./perl ] || exit 125 ./perl -Ilib ext/Devel-Size/t/globs.t ret=$? [ $ret -gt 127 ] && ret=127 # git checkout makedepend.SH git clean -dxf exit $ret Turns out that it's this commit http://perl5.git.perl.org/perl.git/commit/b50b20584a1bbc1a author Father Chrysostomos <sprout@cpan.org> Wed, 7 Dec 2011 02:12:14 +0000 (18:12 -0800) Implement new ‘use 5.xxx' plan • Version declarations now unload all features before loading the specified feature bundle. • Explicit use/no strict overrides any implicit strict-loading done by version declarations, whether before or after use of strict.pm. • ‘use 5.01’ or earlier disables any implicitly-enabled strictures. which really wasn't what I expected. After a fair amount of grovelling with gdb, the extra 40 bytes turns out to be sizeof(struct xpvhv_aux), added by line 766: st->total_size += sizeof(struct xpvhv_aux); After a lot more head scratching, this is because that commit changes things so that use strict; will assign to %^H. Before: $ /Users/nick/Sandpit/snap-v5.15.5-305*/bin/perl5.15.5 -le 'use strict; BEGIN {print foreach keys %^H}' After: $ /Users/nick/Sandpit/snap-v5.15.5-306*/bin/perl5.15.5 -le 'use strict; BEGIN {print foreach keys %^H}' strict/subs strict/refs strict/vars This in turn matters, because the eval in gv_grew() in globs.t: eval $code or die "For $type, can't execute q{$code}: $@"; a: now has a private copy of %^H in the optree b: now copies that at runtime onto the stack for the eval and to copy a hash requires a hash iterator, so the *first* time the hash is copied its size is increased to hold the iterator. Which happens after this line: my $cv_was_size = size(do {no strict 'refs'; \&$sub}); This makes a difference because the total size of anything that can reach \&gv_grew will include this extra size. In this case, this means that if the code for generate_glob() is within gv_grew() [as it used to be], then the generated subroutine's CvOUTSIDE points to an anon sub whose CvOUTSIDE points to gv_grew(). Which means that the generated subroutine gets "bigger" simply as a side effect of the eval executing. The solution is to put the eval that creates the subroutine into a different scope, so that its outside pointer chain doesn't include gv_grew(). Hence it's now broken out into generate_glob I was about to roll up a dev release with a changed t/globs.t, but I've found that I'm getting an assertion failure from t/magic.t in 5.8.0-5.8.2, which I'm going to see if I can fix too.
Subject: globs.t.patch
diff --git a/t/globs.t b/t/globs.t index ae32309..11c0441 100644 --- a/t/globs.t +++ b/t/globs.t @@ -74,12 +74,35 @@ $SIG{__WARN__} = sub { - $shared_gvname, 'GV copies point back to the real GV'); } -sub gv_grew { - my ($sub, $glob, $code, $type) = @_; +# As of blead commit b50b20584a1bbc1a, Implement new 'use 5.xxx' plan, +# use strict; will write to %^H. In turn, this causes the eval $code below +# to have compile with a pp_hintseval with a private copy of %^H in the +# optree. In turn, this private value is copied on op execution and put on +# the stack. The act of copying requires a hash iterator, and the *first* +# time the op is encountered its private HV doesn't have space for one, so +# it's expanded to hold one. Which happens after $cv_was_size is assigned to. +# Which matters, because it means that the total size of anything that can +# reach \&gv_grew will include this extra size. In this case, this means that +# if the code for generate_glob() is within gv_grew() [as it used to be], +# then the generated subroutine's CvOUTSIDE points to an anon sub whose +# CvOUTSIDE points to gv_grew(). Which means that the generated subroutine +# gets "bigger" simply as a side effect of the eval executing. + +# The solution is to put the eval that creates the subroutine into a different +# scope, so that its outside pointer chain doesn't include gv_grew(). Hence +# it's now broken out into generate_glob(): + +sub generate_glob { + my ($sub, $glob) = @_; # unthreaded, this gives us a way of getting to sv_size() from one of the # other *_size() functions, with a GV that has nothing allocated from its # GP: eval "sub $sub { *$glob }; 1" or die $@; +} + +sub gv_grew { + my ($sub, $glob, $code, $type) = @_; + generate_glob($sub, $glob); # Assigning to IoFMT_GV() also provides this, threaded and unthreaded: $~ = $glob;
On Sat Jan 14 18:31:45 2012, d.thomas@its.uq.edu.au wrote: Show quoted text
> Devel-Size-0.77, perl-5.15.6, RHEL6 > this is first time I tried building under any 5.15.x > > > root@minneola# make test > PERL_DL_NONLAZY=1 /opt/perl/uq.is.perl.rhel6-5.15.6- > 20120115/bin/perl5.15.6 "- > MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', > 'blib/arch')" t/*.t > t/basic.t ..... ok > t/code.t ...... ok > t/globs.t ..... 1/44 > # Failed test 'CV grew by expected amount for SCALAR' > # at t/globs.t line 132. > # got: '56626' > # expected: '56586' > # Looks like you failed 1 test of 44. > t/globs.t ..... Dubious, test returned 1 (wstat 256, 0x100) > Failed 1/44 subtests
Thanks for the report. I've just uploaded a dev release, 0.77_50, which I think should fix this. Nicholas Clark
On Fri Feb 10 15:08:01 2012, NWCLARK wrote: Show quoted text
> On Sat Jan 14 18:31:45 2012, d.thomas@its.uq.edu.au wrote:
> > Devel-Size-0.77, perl-5.15.6, RHEL6 > > this is first time I tried building under any 5.15.x > > > > > > root@minneola# make test > > PERL_DL_NONLAZY=1 /opt/perl/uq.is.perl.rhel6-5.15.6- > > 20120115/bin/perl5.15.6 "- > > MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', > > 'blib/arch')" t/*.t > > t/basic.t ..... ok > > t/code.t ...... ok > > t/globs.t ..... 1/44 > > # Failed test 'CV grew by expected amount for SCALAR' > > # at t/globs.t line 132. > > # got: '56626' > > # expected: '56586' > > # Looks like you failed 1 test of 44. > > t/globs.t ..... Dubious, test returned 1 (wstat 256, 0x100) > > Failed 1/44 subtests
> > Thanks for the report. I've just uploaded a dev release, 0.77_50, which > I think should fix this.
* t/globs.t was failing on 5.15.6 and later due to side effects of a change to strict.pm [CPAN #73998] Tests pass for me now, probably because the strict hints were moved from %^H to $^H, for Safe(ty)’s sake.
On Thu Apr 19 01:38:52 2012, SPROUT wrote: Show quoted text
> On Fri Feb 10 15:08:01 2012, NWCLARK wrote:
> > On Sat Jan 14 18:31:45 2012, d.thomas@its.uq.edu.au wrote:
> > > Devel-Size-0.77, perl-5.15.6, RHEL6 > > > this is first time I tried building under any 5.15.x > > > > > > > > > root@minneola# make test > > > PERL_DL_NONLAZY=1 /opt/perl/uq.is.perl.rhel6-5.15.6- > > > 20120115/bin/perl5.15.6 "- > > > MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', > > > 'blib/arch')" t/*.t > > > t/basic.t ..... ok > > > t/code.t ...... ok > > > t/globs.t ..... 1/44 > > > # Failed test 'CV grew by expected amount for SCALAR' > > > # at t/globs.t line 132. > > > # got: '56626' > > > # expected: '56586' > > > # Looks like you failed 1 test of 44. > > > t/globs.t ..... Dubious, test returned 1 (wstat 256, 0x100) > > > Failed 1/44 subtests
> > > > Thanks for the report. I've just uploaded a dev release, 0.77_50,
> which
> > I think should fix this.
> > * t/globs.t was failing on 5.15.6 and later due to side effects of a > change > to strict.pm [CPAN #73998] > > Tests pass for me now,
I meant with 0.77 and perl 5.15.9. Show quoted text
> probably because the strict hints were moved > from %^H to $^H, for > Safe(ty)’s sake.
Test results look good so I'm closing this. Great work. Tim [just being a janitor]