Browse files

Improve code-gen by avoiding redundant deconts.

Sometimes, we can cheaply figure out we don't need to insert them into
the code at all. Do so. Shaves 3.6KB off NQP build size, 16.2KB off
Rakudo compiler build size, and 55.8KB off CORE.setting bytecode size.
A loop/method call/increment benchmark runs 0.3% less CPU instructions
thanks to this change also.
  • Loading branch information...
1 parent 89345b4 commit a9ec4662951d1051ebf00c7a9703f3326dbaa47b @jnthn jnthn committed Jun 1, 2016
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/vm/moar/QAST/QASTOperationsMAST.nqp
@@ -217,7 +217,8 @@ class QAST::MASTOperations {
# put the arg exression's generation code in the instruction list
nqp::splice(@all_ins, $arg.instructions, +@all_ins, 0)
unless $constant_operand;
- if @deconts[$arg_num] {
+ if @deconts[$arg_num] &&
+ (!$_.has_compile_time_value || nqp::iscont($_.compile_time_value)) {
my $dc_reg := $regalloc.fresh_register($MVM_reg_obj);
nqp::push(@all_ins, :op('decont'), $dc_reg, $arg.result_reg ));
nqp::push(@arg_regs, $dc_reg);

0 comments on commit a9ec466

Please sign in to comment.