@@ -158,9 +158,10 @@ class QAST::MASTOperations {
158
158
my int $ operand := nqp ::atpos_i(@ operands_values , $ operands_offset + $ operand_num ++ );
159
159
my int $ operand_kind := ($ operand +& $ MVM_operand_type_mask );
160
160
my int $ constant_operand := ! ($ operand +& $ MVM_operand_rw_mask );
161
+ my $ want-decont := @ deconts [$ arg_num ];
161
162
my $ arg := $ operand_kind == $ MVM_operand_type_var
162
- ?? $ qastcomp . as_mast($ _ )
163
- !! $ qastcomp . as_mast($ _ , : want($ operand_kind / 8 ));
163
+ ?? $ qastcomp . as_mast($ _ , : $ want-decont )
164
+ !! $ qastcomp . as_mast($ _ , : want($ operand_kind / 8 ), : $ want-decont );
164
165
my int $ arg_kind := $ arg . result_kind;
165
166
166
167
if $ arg_num == 0 && nqp ::eqat($ op , ' return_' , 0 ) {
@@ -732,7 +733,7 @@ for <if unless with without> -> $op_name {
732
733
$ op [1 ]. blocktype($ orig_type );
733
734
}
734
735
else {
735
- @ comp_ops [1 ] := $ qastcomp . as_mast($ op [1 ], : want($ wanted ));
736
+ @ comp_ops [1 ] := $ qastcomp . as_mast($ op [1 ], : want($ wanted ), : want-decont( $ * WANT-DECONT ) );
736
737
}
737
738
if needs_cond_passed($ op [2 ]) {
738
739
my $ orig_type := $ op [2 ]. blocktype;
@@ -745,7 +746,7 @@ for <if unless with without> -> $op_name {
745
746
$ op [2 ]. blocktype($ orig_type );
746
747
}
747
748
elsif $ op [2 ] {
748
- @ comp_ops [2 ] := $ qastcomp . as_mast($ op [2 ], : want($ wanted ));
749
+ @ comp_ops [2 ] := $ qastcomp . as_mast($ op [2 ], : want($ wanted ), : want-decont( $ * WANT-DECONT ) );
749
750
}
750
751
751
752
if (@ comp_ops [0 ]. result_kind == $ MVM_reg_void ) {
@@ -2521,6 +2522,17 @@ QAST::MASTOperations.add_core_moarop_mapping('iscont_i', 'iscont_i');
2521
2522
QAST ::MASTOperations. add_core_moarop_mapping(' iscont_n' , ' iscont_n' );
2522
2523
QAST ::MASTOperations. add_core_moarop_mapping(' iscont_s' , ' iscont_s' );
2523
2524
QAST ::MASTOperations. add_core_moarop_mapping(' isrwcont' , ' isrwcont' );
2525
+ QAST ::MASTOperations. add_core_op(' decont' , -> $ qastcomp , $ op {
2526
+ if + $ op . list != 1 {
2527
+ nqp ::die(" The 'decont' op needs 1 operand, got " ~ + $ op . list);
2528
+ }
2529
+ my $ regalloc := $ * REGALLOC ;
2530
+ my $ res_reg := $ regalloc . fresh_o();
2531
+ my $ expr := $ qastcomp . as_mast($ op [0 ], : want($ MVM_reg_obj ), : want-decont);
2532
+ push_op($ expr . instructions, ' decont' , $ res_reg , $ expr . result_reg);
2533
+ $ regalloc . release_register($ expr . result_reg, $ MVM_reg_obj );
2534
+ MAST::InstructionList. new ($ expr . instructions, $ res_reg , $ MVM_reg_obj )
2535
+ });
2524
2536
QAST ::MASTOperations. add_core_moarop_mapping(' decont' , ' decont' );
2525
2537
QAST ::MASTOperations. add_core_moarop_mapping(' decont_i' , ' decont_i' );
2526
2538
QAST ::MASTOperations. add_core_moarop_mapping(' decont_n' , ' decont_n' );
0 commit comments