Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Toss a JVM-only optimization.
It's covered by the much more general lexical-to-local lowering, which
we should just make work on the JVM.
  • Loading branch information
jnthn committed Apr 11, 2014
1 parent f392d69 commit 95889b7
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/Perl6/Optimizer.nqp
Expand Up @@ -158,45 +158,8 @@ class Perl6::Optimizer {
}
}

# We may also be able to optimize away the full-blown binder in some
# cases and on some backends.
my $code_obj := $block<code_object>;
my $backend := nqp::getcomp('perl6').backend.name;
if $backend eq 'jvm' && $!level >= 3 && nqp::isconcrete($code_obj) {
my $sig := $code_obj.signature;
self.try_eliminate_binder($block, $sig);
}

$block
}

method try_eliminate_binder($block, $sig) {
my $Signature := self.find_in_setting('Signature');
my @params := nqp::getattr($sig, $Signature, '$!params');
if nqp::elems(@params) == 0 {
# Zero args; no need for binder call, and no more to do.
try_remove_binder_call();
}
sub try_remove_binder_call() {
my int $found := 0;
if nqp::istype($block[0], QAST::Stmts) {
for @($block[0]) {
if nqp::istype($_, QAST::Op) && $_.op eq 'p6bindsig' {
$_.op('null');
$found := 1;
last;
}
}
}
if $found {
$block.custom_args(0);
1
}
else {
0
}
}
}

method is_from_core($name) {
my int $i := +@!block_stack;
Expand Down

0 comments on commit 95889b7

Please sign in to comment.