diff options
author | David Mitchell <davem@iabyn.com> | 2009-08-16 12:57:52 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2009-08-16 12:57:52 +0100 |
commit | ef0c5631d3726db9e58eed6125725518548e47cd (patch) | |
tree | d3b8a0c5729625da24e8889ccfcea59720cfbf32 | |
parent | 0bd1c8c5e0428f0a7e4ed1da202a144ce822b0c2 (diff) | |
download | perl-ef0c5631d3726db9e58eed6125725518548e47cd.tar.gz |
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.
-rw-r--r-- | ext/B/B/Deparse.pm | 26 | ||||
-rw-r--r-- | ext/B/t/deparse.t | 25 |
2 files changed, 1 insertions, 50 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 5685d0914f..85c4ef039e 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 d2e65d9cb6..921cecaed8 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; |