Permalink
Browse files

Generate much better code for p6bool in some cases

An earlier optimization to make it better handle the case of native
lexicals unfortunately also made it works for native intermediates,
such that things like `nqp::p6bool(nqp::isconcrete($foo))` would
generate bad code. While it's true that VM-level box interning meant
it didn't actually allocate, it still produced much more costly code
than it should have. This fixes it using the recently added decont
context mechanism, giving simpler code that still produces a good
result on native lexicals.
  • Loading branch information...
jnthn committed Jun 15, 2017
1 parent c6b03c4 commit 241d292568a48f787145fc84f0da960bf8eba27c
Showing with 1 addition and 9 deletions.
  1. +1 −9 src/vm/moar/Perl6/Ops.nqp
View
@@ -279,15 +279,7 @@ my $p6bool := -> $qastcomp, $op {
# sure we do a fast lexical access instead of creating a LexicalRef obj

This comment has been minimized.

Show comment
Hide comment
@vendethiel

vendethiel Jun 15, 2017

Contributor

I think this comment can be removed now?

@vendethiel

vendethiel Jun 15, 2017

Contributor

I think this comment can be removed now?

# and going through that.
my @ops;
my $exprres;
my $want := $MVM_reg_obj;
if nqp::istype($op[0], QAST::Var) && $op[0].scope eq 'lexicalref' {
my $spec := nqp::objprimspec($op[0].returns);
if $spec == 1 { $want := $MVM_reg_int64 }
elsif $spec == 2 { $want := $MVM_reg_num64 }
elsif $spec == 3 { $want := $MVM_reg_str }
}
$exprres := $qastcomp.as_mast($op[0], :want($want));
my $exprres := $qastcomp.as_mast($op[0], :want-decont);
push_ilist(@ops, $exprres);
# Go by result kind.

0 comments on commit 241d292

Please sign in to comment.