Mercurial > hg > graal-compiler
changeset 23126:aadd99d250fe
TraceRA: TraceLinearScanEliminateSpillMovePhase: fix isPhiResolutionMove (was negated) and add comments.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 01 Dec 2015 16:14:17 +0100 |
parents | fe57bf1e3595 |
children | 7d8302d428bd |
files | graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/lsra/TraceLinearScanEliminateSpillMovePhase.java |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/lsra/TraceLinearScanEliminateSpillMovePhase.java Mon Nov 30 17:38:22 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/lsra/TraceLinearScanEliminateSpillMovePhase.java Tue Dec 01 16:14:17 2015 +0100 @@ -193,21 +193,33 @@ * no valid opId but -1.) */ private static boolean canEliminateSpillMove(TraceLinearScan allocator, AbstractBlockBase<?> block, MoveOp move, int lastOpId) { + assert ((LIRInstruction) move).id() == -1 : "Not a spill move: " + move; assert isVariable(move.getResult()) : "LinearScan inserts only moves to variables: " + move; assert lastOpId >= 0 : "Invalid lastOpId: " + lastOpId; TraceInterval curInterval = allocator.intervalFor(move.getResult()); - if (!isRegister(curInterval.location()) && curInterval.inMemoryAt(lastOpId) && isPhiResolutionMove(allocator, move)) { + if (!isRegister(curInterval.location()) && curInterval.inMemoryAt(lastOpId) && !isPhiResolutionMove(allocator, move)) { + /* Phi resolution moves cannot be removed because they define the value. */ + // TODO (je) check if the comment is still valid! assert isStackSlotValue(curInterval.location()) : "Not a stack slot: " + curInterval.location(); return true; } return false; } + /** + * Checks if a (spill or split) move is a Phi resolution move. + * + * A spill or split move connects a split parent or a split child with another split child. + * Therefore the destination of the move is always a split child. Phi resolution moves look like + * spill moves (i.e. {@link LIRInstruction#id() id} is {@code 0}, but they define a new + * variable. As a result the destination interval is a split parent. + */ private static boolean isPhiResolutionMove(TraceLinearScan allocator, MoveOp move) { + assert ((LIRInstruction) move).id() == -1 : "Not a spill move: " + move; TraceInterval curInterval = allocator.intervalFor(move.getResult()); - return !curInterval.isSplitParent(); + return curInterval.isSplitParent(); } private static void checkIntervals(TraceInterval interval) {