Skip to content

Commit

Permalink
ImmutableLiterals can be emit'd as Operands out of order in simple cases
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Mar 17, 2015
1 parent a416467 commit a6262fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/ir/IRBuilder.java
Expand Up @@ -561,7 +561,9 @@ protected Variable copyAndReturnValue(Operand val) {
protected Operand buildWithOrder(Node node, boolean preserveOrder) {
Operand value = build(node);

return preserveOrder ? copyAndReturnValue(value) : value;
// We need to preserve order in cases (like in presence of assignments) except that immutable
// literals can never change value so we can still emit these out of order.
return preserveOrder && !(value instanceof ImmutableLiteral) ? copyAndReturnValue(value) : value;
}

protected Variable getValueInTemporaryVariable(Operand val) {
Expand Down

0 comments on commit a6262fb

Please sign in to comment.