diff --git a/rvm/src/org/jikesrvm/compilers/opt/Simplifier.java b/rvm/src/org/jikesrvm/compilers/opt/Simplifier.java index b8bdf7faa..707b16736 100644 --- a/rvm/src/org/jikesrvm/compilers/opt/Simplifier.java +++ b/rvm/src/org/jikesrvm/compilers/opt/Simplifier.java @@ -3837,20 +3837,20 @@ private static DefUseEffect refLoad(Instruction s, OptOptions opts) { } /** - * To reduce the number of conditions to consider, we - * transform all commutative - * operators to a canoncial form. The following forms are considered - * canonical: + * To reduce the number of conditions to consider, we transform all commutative + * operators to a canoncial form. The following forms are considered canonical: * + * For object constant operands we treat movable objects like registers. */ private static void canonicalizeCommutativeOperator(Instruction instr) { - if (Binary.getVal1(instr).isConstant()) { - Operand tmp = Binary.getClearVal1(instr); - Binary.setVal1(instr, Binary.getClearVal2(instr)); + Operand op1 = Binary.getVal1(instr); + if (op1.isConstant() && !op1.isMovableObjectConstant()) { + Operand tmp = Binary.getClearVal1(instr); + Binary.setVal1(instr, Binary.getClearVal2(instr)); Binary.setVal2(instr, tmp); } }