In perl.git, the branch maint-5.10 has been updated <http://perl5.git.perl.org/perl.git/commitdiff/9cc1a8e3162a220874abefd543952e2e193d1f61?hp=0bd1c8c5e0428f0a7e4ed1da202a144ce822b0c2>
- Log ----------------------------------------------------------------- commit 9cc1a8e3162a220874abefd543952e2e193d1f61 Author: David Mitchell <[email protected]> Date: Sun Aug 16 13:00:08 2009 +0100 Remove constant deparsing from perldelta M pod/perl5101delta.pod commit ef0c5631d3726db9e58eed6125725518548e47cd Author: David Mitchell <[email protected]> Date: Sun Aug 16 12:57:52 2009 +0100 Remove constant deparsing from 5.10.1 This was added post-5.10.0, but adds a significant perfomance penalty to all deparsing. Remove for now, and maybe add back in a later 5.10.x if it can be fixed. The original code was added to blead with 2990415a4519bc3988d7224ae15100c3e9e901ee with a lot of follow-up tweaks. M ext/B/B/Deparse.pm M ext/B/t/deparse.t ----------------------------------------------------------------------- Summary of changes: ext/B/B/Deparse.pm | 26 -------------------------- ext/B/t/deparse.t | 25 +------------------------ pod/perl5101delta.pod | 3 +-- 3 files changed, 2 insertions(+), 52 deletions(-) diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 5685d09..85c4ef0 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -606,25 +606,6 @@ sub new { } } -sub scan_for_constants { - my ($self) = @_; - my %ret; - - B::walksymtable(\%::, sub { - my ($gv) = @_; - - my $cv = $gv->CV; - return if !$cv || class($cv) ne 'CV'; - - my $const = $cv->const_sv; - return if !$const || class($const) eq 'SPECIAL'; - - $ret{ 0 + $const->object_2svref } = $gv->NAME; - }, sub { 1 }); - - return \%ret; -} - # Initialise the contextual information, either from # defaults provided with the ambient_pragmas method, # or from perl's own defaults otherwise. @@ -3658,13 +3639,6 @@ sub const { if (class($sv) eq "NULL") { return 'undef'; } - if ($cx) { - unless ($self->{'inlined_constants'}) { - $self->{'inlined_constants'} = $self->scan_for_constants; - } - my $const = $self->{'inlined_constants'}->{ 0 + $sv->object_2svref }; - return $const if $const; - } # convert a version object into the "v1.2.3" string in its V magic if ($sv->FLAGS & SVs_RMG) { for (my $mg = $sv->MAGIC; $mg; $mg = $mg->MOREMAGIC) { diff --git a/ext/B/t/deparse.t b/ext/B/t/deparse.t index d2e65d9..921ceca 100644 --- a/ext/B/t/deparse.t +++ b/ext/B/t/deparse.t @@ -27,7 +27,7 @@ BEGIN { require feature; feature->import(':5.10'); } -use Test::More tests => 77; +use Test::More tests => 71; use Config (); use B::Deparse; @@ -519,29 +519,6 @@ if ($a == 1) { x(); } elsif ($b == 2) { z(); } if (do { foo(); GLIPP }) { x(); } if (do { ++$a; GLIPP }) { x(); } #### -# 62 tests for deparsing constants -warn PI; -#### -# 63 tests for deparsing imported constants -warn O_TRUNC; -#### -# 64 tests for deparsing re-exported constants -warn O_CREAT; -#### -# 65 tests for deparsing imported constants that got deleted from the original namespace -warn O_APPEND; -#### -# TODO ? $Config::Config{useithreads} && "doesn't work with threads" -# 66 tests for deparsing constants which got turned into full typeglobs -# It might be fundamentally impossible to make this work on ithreads, in which -# case the TODO should become a SKIP -warn O_EXCL; -eval '@Fcntl::O_EXCL = qw/affe tiger/;'; -warn O_EXCL; -#### -# 67 tests for deparsing of blessed constant with overloaded numification -warn OVERLOADED_NUMIFICATION; -#### # TODO Only strict 'refs' currently supported # 68 strict no strict; diff --git a/pod/perl5101delta.pod b/pod/perl5101delta.pod index 3818d1f..a88050b 100644 --- a/pod/perl5101delta.pod +++ b/pod/perl5101delta.pod @@ -1201,8 +1201,7 @@ greater than 255 [RT #59908]. C<B::Deparse> failed to correctly deparse various constructs: C<readpipe STRING> [RT #62428], C<CORE::require(STRING)> [RT #62488], -C<sub foo(_)> [RT #62484]. Also, constant subroutines were deparsed as -their values. +C<sub foo(_)> [RT #62484]. =item * -- Perl5 Master Repository
