Skip to content

Commit

Permalink
import optimize 0.03 from CPAN
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Artur Bergman authored and Reini Urban committed Feb 27, 2011
1 parent 5fa9f78 commit 5d7db4a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion META.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ requires:
Hook::Scope: 0.02
optimizer: 0.02
perl: 5.8
version: 0.02
version: 0.03
26 changes: 7 additions & 19 deletions lib/optimize.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -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') &&
Expand Down

0 comments on commit 5d7db4a

Please sign in to comment.