Skip to content

Commit

Permalink
Fixes #4323. Usage of #[]= assignment in method argument broken.
Browse files Browse the repository at this point in the history
I had introduced a bad optimization during IR build phase.  It assumed
all Strings could be built out of order but I did not account for the
fact that the same StrNode could be referenced by two instructions at
the same time (since each occurrence will perform a dup).

Note: It might look like I removed FrozenStrings from building out of
order but the ordinary logic in buildWithOrder will end up creating
the operand in place and not generating the copy since it is an
ImmutableLiteral.
  • Loading branch information
enebo committed Nov 21, 2016
1 parent 744a927 commit 89759e4
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Expand Up @@ -561,10 +561,6 @@ protected Variable copyAndReturnValue(Operand val) {
}

protected Operand buildWithOrder(Node node, boolean preserveOrder) {
// Even though String literals are mutable they cannot fail or depend on rest of program's semantics so
// they can ignore order.
if (node instanceof StrNode) return buildStrRaw((StrNode) node);

Operand value = build(node);

// We need to preserve order in cases (like in presence of assignments) except that immutable
Expand Down

0 comments on commit 89759e4

Please sign in to comment.