Skip to content

Commit b23941d

Browse files
committed
Often do a decont less in getattr/bindattr codegen
In the case that we have a QAST::WVal for the class handle, then we know that we don't need to generate one.
1 parent 2bb945d commit b23941d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/vm/moar/QAST/QASTOperationsMAST.nqp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2611,13 +2611,15 @@ sub add_bindattr_op($nqpop, $hintedop, $namedop, $want) {
26112611
my $regalloc := $*REGALLOC;
26122612
my $val_mast := $qastcomp.as_mast( :$want, $op[3] );
26132613
my $obj_mast := $qastcomp.as_mast( :want($MVM_reg_obj), $op[0] );
2614-
my $type_mast := $qastcomp.as_mast( :want($MVM_reg_obj), $op[1] );
2614+
my $type_mast := $qastcomp.as_mast( :want($MVM_reg_obj),
2615+
nqp::istype($op[1], QAST::WVal) && !nqp::isconcrete($op[1])
2616+
?? $op[1]
2617+
!! QAST::Op.new( :op('decont'), $op[1] ));
26152618
my int $hint := -1;
26162619
my @ins;
26172620
push_ilist(@ins, $val_mast);
26182621
push_ilist(@ins, $obj_mast);
26192622
push_ilist(@ins, $type_mast);
2620-
push_op(@ins, 'decont', $type_mast.result_reg, $type_mast.result_reg);
26212623
my $name := $op[2];
26222624
$name := $name[2] if nqp::istype($name, QAST::Want) && $name[1] eq 'Ss';
26232625
if nqp::istype($name, QAST::SVal) {
@@ -2649,13 +2651,15 @@ sub add_getattr_op($nqpop, $hintedop, $namedop, $want) {
26492651
QAST::MASTOperations.add_core_op($nqpop, -> $qastcomp, $op {
26502652
my $regalloc := $*REGALLOC;
26512653
my $obj_mast := $qastcomp.as_mast( :want($MVM_reg_obj), $op[0] );
2652-
my $type_mast := $qastcomp.as_mast( :want($MVM_reg_obj), $op[1] );
2654+
my $type_mast := $qastcomp.as_mast( :want($MVM_reg_obj),
2655+
nqp::istype($op[1], QAST::WVal) && !nqp::isconcrete($op[1])
2656+
?? $op[1]
2657+
!! QAST::Op.new( :op('decont'), $op[1] ));
26532658
my int $hint := -1;
26542659
my @ins;
26552660
push_ilist(@ins, $obj_mast);
26562661
push_ilist(@ins, $type_mast);
26572662
my $res_reg := $regalloc.fresh_register($want);
2658-
push_op(@ins, 'decont', $type_mast.result_reg, $type_mast.result_reg);
26592663
my $name := $op[2];
26602664
$name := $name[2] if nqp::istype($name, QAST::Want) && $name[1] eq 'Ss';
26612665
if nqp::istype($name, QAST::SVal) {

0 commit comments

Comments
 (0)