# HG changeset patch # User Erik Eckstein # Date 1387353454 -3600 # Node ID 24ae4e7ecf03e2ced08863e9840f456d0ab982d4 # Parent e8c4a6ea3f7724ad658373b54f86f2372dc83195 fixed wrong redundant move elimination after loop safepoints, re-enabled redundant move elimination diff -r e8c4a6ea3f77 -r 24ae4e7ecf03 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Dec 17 20:58:58 2013 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Wed Dec 18 08:57:34 2013 +0100 @@ -1878,14 +1878,7 @@ printLir("After register number assignment", true); EdgeMoveOptimizer.optimize(ir); ControlFlowOptimizer.optimize(ir); - - /* - * Temporarily disabled because of problem in specjvm2008. TODO: fix the problem and - * re-enable it. - * - * RedundantMoveElimination.optimize(ir, frameMap, gen.getGraph().method()); - */ - + RedundantMoveElimination.optimize(ir, frameMap, gen.getGraph().method()); NullCheckOptimizer.optimize(ir, target.implicitNullCheckLimit); printLir("After control flow optimization", false); } catch (Throwable e) { diff -r e8c4a6ea3f77 -r 24ae4e7ecf03 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java Tue Dec 17 20:58:58 2013 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java Wed Dec 18 08:57:34 2013 +0100 @@ -297,6 +297,7 @@ int sourceIdx = getStateIdx(moveOp.getInput()); int destIdx = getStateIdx(moveOp.getResult()); if (sourceIdx >= 0 && destIdx >= 0) { + assert isObjectValue(state[sourceIdx]) || (moveOp.getInput().getKind() != Kind.Object) : "move op moves object but input is not defined as object"; state[destIdx] = state[sourceIdx]; indent.log("move value %d from %d to %d", state[sourceIdx], sourceIdx, destIdx); return initValueNum; @@ -342,8 +343,13 @@ } OutputValueProc outputValueProc = new OutputValueProc(valueNum); + + op.forEachTemp(outputValueProc); + /* + * Semantically the output values are written _after_ the temp values + */ op.forEachOutput(outputValueProc); - op.forEachTemp(outputValueProc); + valueNum = outputValueProc.opValueNum; if (op.hasState()) { @@ -351,6 +357,9 @@ * All instructions with framestates (mostly method calls), may do garbage * collection. GC will rewrite all object references which are live at this point. * So we can't rely on their values. + * + * It would be sufficient to just kill all values which are referenced in the state + * (or all values which are not), but for simplicity we kill all values. */ indent.log("kill all object values"); clearValuesOfKindObject(state, valueNum);