From 5d7db4ae77637b44e052a2e0dc409a1cc81adcc0 Mon Sep 17 00:00:00 2001 From: Artur Bergman Date: Mon, 12 Aug 2002 14:21:14 +0100 Subject: [PATCH] import optimize 0.03 from CPAN git-cpan-module: optimize git-cpan-version: 0.03 git-cpan-authorid: ABERGMAN git-cpan-file: authors/id/A/AB/ABERGMAN/optimize-0.03.tar.gz --- Changes | 5 +++++ META.yaml | 2 +- lib/optimize.pm | 26 +++++++------------------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Changes b/Changes index c0d9b61..8974d19 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for Perl extension optimize +0.03 Sun Aug 11 23:45:10 CEST 2002 + - Fixed bug when a constant was a AV in which we would get bizare + copy of Array + + 0.02 Fri Jun 28 00:22:01 CEST 2002 - Added register() and unregister() functions to allow third party modules to hook into diff --git a/META.yaml b/META.yaml index 52a9575..79033a4 100644 --- a/META.yaml +++ b/META.yaml @@ -10,4 +10,4 @@ requires: Hook::Scope: 0.02 optimizer: 0.02 perl: 5.8 -version: 0.02 +version: 0.03 diff --git a/lib/optimize.pm b/lib/optimize.pm index 2d9e5ec..8de3355 100644 --- a/lib/optimize.pm +++ b/lib/optimize.pm @@ -8,7 +8,7 @@ use B::Utils qw(walkallops_simple); use B qw(OPf_KIDS OPf_MOD OPf_PARENS OPf_WANT_SCALAR OPf_STACKED); use Attribute::Handlers; use Hook::Scope qw(POST); -our $VERSION = 0.02; +our $VERSION = 0.03; our %pads; our $state; @@ -18,13 +18,13 @@ our $stash; our %register; use optimizer "extend-c" => sub { my $op = shift; - POST { $old_op = $op }; + POST { $old_op = $op; return () }; if($op->name eq 'nextstate') { $state = $op; $stash = $state->stash->NAME; # print $state->file . ":" . $state->line . "-" . $state->stash->NAME . "\n";; } - if($stash =~/^(optimize|B::|type|float|int)/) { + if($stash =~/^(optimize|B::|type|float|int|^O$)/) { # print "Don't optimize ourself\n"; return; } @@ -36,27 +36,15 @@ use optimizer "extend-c" => sub { }; if($@) { $@ =~s/\n//; -# print "$@ in " . $state->file . ":" . $state->line . "\n";; + print "$@ in " . $state->file . ":" . $state->line . "\n";; return; } - if($op->name eq 'const' && - $op->sv->sv eq 'attributes') { -# print $op->name . "-" . $op->seq . "\n"; -# my $oop = $op->next; -# while(1) { -# print "$oop - " . $oop->name; -# if($oop->can('sv') && $oop->sv) { -# print " - " . $oop->sv->sv; -# } -# print "\n"; -# last if(ref($oop->next) eq 'B::NULL'); -# $oop = $oop->next; -# } -## print $op->next->next->next->next->name ."\n"; - } + + if($op->name eq 'const' && + ref($op->sv) eq 'B::PV' && $op->sv->sv eq 'attributes' && $op->can('next') && $op->next->can('next') &&