Skip to content

Commit

Permalink
If the block var has to go on heap, it must be IRubyObject.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed May 20, 2016
1 parent 1c183c0 commit 88a8896
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.jruby.ir.instructions.CopyInstr;
import org.jruby.ir.instructions.Instr;
import org.jruby.ir.instructions.ReifyClosureInstr;
import org.jruby.ir.operands.LocalVariable;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.representations.BasicBlock;
Expand Down Expand Up @@ -41,6 +42,11 @@ private static void optimizeDelegatedVars(IRScope s) {
for (Instr i: bb.getInstrs()) {
if (i instanceof ReifyClosureInstr) {
ReifyClosureInstr ri = (ReifyClosureInstr) i;

// can't store un-reified block in DynamicScope (only accepts IRubyObject)
// FIXME: (con) it would be nice to not have this limitation
if (ri.getResult() instanceof LocalVariable) continue;

unusedExplicitBlocks.put(ri.getResult(), ri.getSource());
} else {
Iterator<Operand> it = unusedExplicitBlocks.keySet().iterator();
Expand Down

0 comments on commit 88a8896

Please sign in to comment.