sub fma { add mul($_[0], $_[1]), $_[2] }
sub wut { fma $_[0], 2, $_[1] }
-my @br_args = ('', '-sCi0v1');
+my @bd_args = ('', '-sCi0v1');
my @brd_args = ({ }, { deparse => undef }, { deparse => { } }, { deparse => [ ] });
-my $br = B::Deparse->new();
-my $reference = $br->coderef2text(\&wut);
+my $bd = B::Deparse->new();
+my $reference = $bd->coderef2text(\&wut);
my $i = 1;
for (@brd_args) {
my $brd = B::RecDeparse->new(%$_, level => 0);
++$i;
}
-my $br_opts = '-sCi0v1';
-@brd_args = ({ deparse => $br_opts }, { deparse => [ $br_opts ] });
+my $bd_opts = '-sCi0v1';
+@brd_args = ({ deparse => $bd_opts }, { deparse => [ $bd_opts ] });
for (@brd_args) {
- $br = B::Deparse->new($br_opts);
+ $bd = B::Deparse->new($bd_opts);
my $brd = B::RecDeparse->new(%$_, level => 0);
my $code = $brd->coderef2text(\&wut);
- is($code, $br->coderef2text(\&wut), "B::RecDeparse->new(deparse => '$br_opts' ), level => 0) does the same thing as B::Deparse->new('$br_opts') ($i)");
+ is($code, $bd->coderef2text(\&wut), "B::RecDeparse->new(deparse => '$bd_opts' ), level => 0) does the same thing as B::Deparse->new('$bd_opts') ($i)");
$code = eval 'sub ' . $code;
is($@, '', "result compiles ($i)");
is_deeply( [ defined $code, ref $code ], [ 1, 'CODE' ], "result compiles to a code reference ($i)");
is($code->(1, 3), wut(1, 3), "result compiles to the good thing at level $l");
}
-my $br_args = '-sCi0v1';
+my $bd_args = '-sCi0v1';
-my $brd = B::RecDeparse->new(deparse => [ $br_args ], level => -1);
+my $brd = B::RecDeparse->new(deparse => [ $bd_args ], level => -1);
which $brd, [ ], [ qw<add mul fma> ], -1;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 0);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 0);
which $brd, [ qw<fma> ], [ qw<add mul> ], 0;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 1);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 1);
which $brd, [ qw<add mul> ], [ qw<fma> ], 1;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 2);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 2);
which $brd, [ ], [ qw<add mul fma> ], 2;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 3);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 3);
which $brd, [ ], [ qw<add mul fma> ], 2;
sub fakegv { return @_ }
is($code->(1, 3), wut(1, 3), "result compiles to the good thing at level $l");
}
-my $br_args = '-sCi0v1';
+my $bd_args = '-sCi0v1';
-my $brd = B::RecDeparse->new(deparse => [ $br_args ], level => -1);
+my $brd = B::RecDeparse->new(deparse => [ $bd_args ], level => -1);
which $brd, [ ], [ qw<add mul fma> ], -1;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 0);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 0);
which $brd, [ qw<fma> ], [ qw<add mul> ], 0;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 1);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 1);
which $brd, [ qw<add mul> ], [ qw<fma> ], 1;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 2);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 2);
which $brd, [ ], [ qw<add mul fma> ], 2;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 3);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 3);
which $brd, [ ], [ qw<add mul fma> ], 2;
is($code->(2), $coderef->(2), "result compiles to the good thing at level $l");
}
-my $br_args = '-sCi0v1';
+my $bd_args = '-sCi0v1';
-my $brd = B::RecDeparse->new(deparse => $br_args, level => -1);
+my $brd = B::RecDeparse->new(deparse => $bd_args, level => -1);
which $brd, \&foo, [ ], [ qw<add dummy> ], [ qw<add call> ], [ ], -1;
which $brd, \&bar, [ ], [ qw<add call> ], [ qw<add call> ], [ ], -1;
-$brd = B::RecDeparse->new(deparse => $br_args, level => 0);
+$brd = B::RecDeparse->new(deparse => $bd_args, level => 0);
which $brd, \&foo, [ qw<call> ], [ qw<add> ], [ qw<add> ], [ qw<dummy> ], 0;
which $brd, \&bar, [ ], [ qw<add call> ], [ qw<add> ], [ qw<dummy> ], 0;
-$brd = B::RecDeparse->new(deparse => $br_args, level => 1);
+$brd = B::RecDeparse->new(deparse => $bd_args, level => 1);
which $brd, \&foo, [ ], [ qw<add dummy> ], [ qw<add call> ], [ ], 1;
which $brd, \&bar, [ ], [ qw<add call> ], [ qw<add call> ], [ ], 1;
-$brd = B::RecDeparse->new(deparse => $br_args, level => 2);
+$brd = B::RecDeparse->new(deparse => $bd_args, level => 2);
which $brd, \&foo, [ ], [ qw<add dummy> ], [ qw<add call> ], [ ], 2;
which $brd, \&bar, [ ], [ qw<add call> ], [ qw<add call> ], [ ], 2;
is($code->(1, 3), wut(1, 3), "result compiles to the good thing at level $l");
}
-my $br_args = '-sCi0v1';
+my $bd_args = '-sCi0v1';
-my $brd = B::RecDeparse->new(deparse => [ $br_args ], level => -1);
+my $brd = B::RecDeparse->new(deparse => [ $bd_args ], level => -1);
which $brd, [ ], [ qw<Hlagh::add mul Dongs::fma> ], -1;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 0);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 0);
which $brd, [ qw<fma> ], [ qw<Hlagh::add mul> ], 0;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 1);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 1);
which $brd, [ qw<add mul> ], [ qw<Dongs::fma> ], 1;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 2);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 2);
which $brd, [ ], [ qw<Hlagh::add mul Dongs::fma> ], 2;
-$brd = B::RecDeparse->new(deparse => [ $br_args ], level => 3);
+$brd = B::RecDeparse->new(deparse => [ $bd_args ], level => 3);
which $brd, [ ], [ qw<Hlagh::add mul Dongs::fma> ], 2;