Skip to content
Permalink
Browse files

Move optimization level check a level up

So we do a bit less work if it's below that level.
  • Loading branch information...
jnthn committed Jan 7, 2019
1 parent 307ae38 commit 19e4ace62d085a73506a787fffefca6b6671829a
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/Perl6/Optimizer.nqp
@@ -1088,7 +1088,7 @@ class Perl6::Optimizer {
# If the block is immediate, we may be able to inline it.
my int $flattened := 0;
my $result := $block;
if $block.blocktype eq 'immediate' && $block.arity == 0
if $!level >= 2 && $block.blocktype eq 'immediate' && $block.arity == 0
&& !$vars_info.is_poisoned && !$block.has_exit_handler {
# Scan symbols for any non-interesting ones.
my @sigsyms;
@@ -1112,11 +1112,9 @@ class Perl6::Optimizer {
# If we have no interesting ones, then we can inline the
# statements.
if +@sigsyms == 0 {
if $!level >= 2 {
my $outer := $!symbols.top_block;
$result := self.inline_immediate_block($block, $outer,
nqp::existskey($vars_info.get_decls(), '$_'));
}
my $outer := $!symbols.top_block;
$result := self.inline_immediate_block($block, $outer,
nqp::existskey($vars_info.get_decls(), '$_'));
}
}

0 comments on commit 19e4ace

Please sign in to comment.
You can’t perform that action at this time.