Skip to content

Commit

Permalink
Avoid problems with moveable objects breaking LIR canonical form.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Rogers committed Jun 28, 2009
1 parent 0821fbd commit e7b9fb4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rvm/src/org/jikesrvm/compilers/opt/Simplifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -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:
* <ul>
* <li> <code> Reg = Reg <op> Reg </code>
* <li> <code> Reg = Reg <op> Constant </code>
* <li> <code> Reg = Constant <op> Constant </code>
* </ul>
* 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);
}
}
Expand Down

0 comments on commit e7b9fb4

Please sign in to comment.