Skip to content

Commit

Permalink
Move optimization level check a level up
Browse files Browse the repository at this point in the history
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 19e4ace
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Perl6/Optimizer.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(), '$_'));
}
}

Expand Down

0 comments on commit 19e4ace

Please sign in to comment.