src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanResolveDataFlowPhase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanResolveDataFlowPhase.java

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanResolveDataFlowPhase.java

Print this page

        

*** 34,45 **** import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig; import org.graalvm.compiler.core.common.alloc.Trace; import org.graalvm.compiler.core.common.alloc.TraceBuilderResult; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; ! import org.graalvm.compiler.debug.Debug; ! import org.graalvm.compiler.debug.DebugCounter; import org.graalvm.compiler.debug.Indent; import org.graalvm.compiler.lir.LIR; import org.graalvm.compiler.lir.LIRInstruction; import org.graalvm.compiler.lir.StandardOp; import org.graalvm.compiler.lir.StandardOp.JumpOp; --- 34,45 ---- import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig; import org.graalvm.compiler.core.common.alloc.Trace; import org.graalvm.compiler.core.common.alloc.TraceBuilderResult; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; ! import org.graalvm.compiler.debug.CounterKey; ! import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.Indent; import org.graalvm.compiler.lir.LIR; import org.graalvm.compiler.lir.LIRInstruction; import org.graalvm.compiler.lir.StandardOp; import org.graalvm.compiler.lir.StandardOp.JumpOp;
*** 67,86 **** } private static final class Resolver { private final TraceLinearScan allocator; private final TraceBuilderResult traceBuilderResult; private Resolver(TraceLinearScan allocator, TraceBuilderResult traceBuilderResult) { this.allocator = allocator; this.traceBuilderResult = traceBuilderResult; } private void resolveFindInsertPos(AbstractBlockBase<?> fromBlock, AbstractBlockBase<?> toBlock, TraceLocalMoveResolver moveResolver) { if (fromBlock.getSuccessorCount() <= 1) { ! if (Debug.isLogEnabled()) { ! Debug.log("inserting moves at end of fromBlock B%d", fromBlock.getId()); } ArrayList<LIRInstruction> instructions = allocator.getLIR().getLIRforBlock(fromBlock); LIRInstruction instr = instructions.get(instructions.size() - 1); if (instr instanceof StandardOp.JumpOp) { --- 67,88 ---- } private static final class Resolver { private final TraceLinearScan allocator; private final TraceBuilderResult traceBuilderResult; + private final DebugContext debug; private Resolver(TraceLinearScan allocator, TraceBuilderResult traceBuilderResult) { this.allocator = allocator; this.traceBuilderResult = traceBuilderResult; + this.debug = allocator.getDebug(); } private void resolveFindInsertPos(AbstractBlockBase<?> fromBlock, AbstractBlockBase<?> toBlock, TraceLocalMoveResolver moveResolver) { if (fromBlock.getSuccessorCount() <= 1) { ! if (debug.isLogEnabled()) { ! debug.log("inserting moves at end of fromBlock B%d", fromBlock.getId()); } ArrayList<LIRInstruction> instructions = allocator.getLIR().getLIRforBlock(fromBlock); LIRInstruction instr = instructions.get(instructions.size() - 1); if (instr instanceof StandardOp.JumpOp) {
*** 89,100 **** } else { moveResolver.setInsertPosition(instructions, instructions.size()); } } else { ! if (Debug.isLogEnabled()) { ! Debug.log("inserting moves at beginning of toBlock B%d", toBlock.getId()); } if (DetailedAsserts.getValue(allocator.getOptions())) { assert allocator.getLIR().getLIRforBlock(fromBlock).get(0) instanceof StandardOp.LabelOp : "block does not start with a label"; --- 91,102 ---- } else { moveResolver.setInsertPosition(instructions, instructions.size()); } } else { ! if (debug.isLogEnabled()) { ! debug.log("inserting moves at beginning of toBlock B%d", toBlock.getId()); } if (DetailedAsserts.getValue(allocator.getOptions())) { assert allocator.getLIR().getLIRforBlock(fromBlock).get(0) instanceof StandardOp.LabelOp : "block does not start with a label";
*** 121,131 **** private void resolveDataFlow(Trace currentTrace, AbstractBlockBase<?>[] blocks) { if (blocks.length < 2) { // no resolution necessary return; } ! try (Indent indent = Debug.logAndIndent("resolve data flow")) { TraceLocalMoveResolver moveResolver = allocator.createMoveResolver(); AbstractBlockBase<?> toBlock = null; for (int i = 0; i < blocks.length - 1; i++) { AbstractBlockBase<?> fromBlock = blocks[i]; --- 123,133 ---- private void resolveDataFlow(Trace currentTrace, AbstractBlockBase<?>[] blocks) { if (blocks.length < 2) { // no resolution necessary return; } ! try (Indent indent = debug.logAndIndent("resolve data flow")) { TraceLocalMoveResolver moveResolver = allocator.createMoveResolver(); AbstractBlockBase<?> toBlock = null; for (int i = 0; i < blocks.length - 1; i++) { AbstractBlockBase<?> fromBlock = blocks[i];
*** 146,156 **** } } @SuppressWarnings("try") private void resolveCollectMappings(AbstractBlockBase<?> fromBlock, AbstractBlockBase<?> toBlock, TraceLocalMoveResolver moveResolver) { ! try (Indent indent0 = Debug.logAndIndent("Edge %s -> %s", fromBlock, toBlock)) { // collect all intervals that have been split between // fromBlock and toBlock int toId = allocator.getFirstLirInstructionId(toBlock); int fromId = allocator.getLastLirInstructionId(fromBlock); assert fromId >= 0; --- 148,158 ---- } } @SuppressWarnings("try") private void resolveCollectMappings(AbstractBlockBase<?> fromBlock, AbstractBlockBase<?> toBlock, TraceLocalMoveResolver moveResolver) { ! try (Indent indent0 = debug.logAndIndent("Edge %s -> %s", fromBlock, toBlock)) { // collect all intervals that have been split between // fromBlock and toBlock int toId = allocator.getFirstLirInstructionId(toBlock); int fromId = allocator.getLastLirInstructionId(fromBlock); assert fromId >= 0;
*** 178,189 **** private boolean containedInTrace(Trace currentTrace, AbstractBlockBase<?> block) { return currentTrace.getId() == traceBuilderResult.getTraceForBlock(block).getId(); } ! private static final DebugCounter numResolutionMoves = Debug.counter("TraceRA[numTraceLSRAResolutionMoves]"); ! private static final DebugCounter numStackToStackMoves = Debug.counter("TraceRA[numTraceLSRAStackToStackMoves]"); private void addMapping(Value phiFrom, Value phiTo, int fromId, int toId, TraceLocalMoveResolver moveResolver) { assert !isRegister(phiFrom) : "Out is a register: " + phiFrom; assert !isRegister(phiTo) : "In is a register: " + phiTo; assert !Value.ILLEGAL.equals(phiTo) : "The value not needed in this branch? " + phiFrom; --- 180,191 ---- private boolean containedInTrace(Trace currentTrace, AbstractBlockBase<?> block) { return currentTrace.getId() == traceBuilderResult.getTraceForBlock(block).getId(); } ! private static final CounterKey numResolutionMoves = DebugContext.counter("TraceRA[numTraceLSRAResolutionMoves]"); ! private static final CounterKey numStackToStackMoves = DebugContext.counter("TraceRA[numTraceLSRAStackToStackMoves]"); private void addMapping(Value phiFrom, Value phiTo, int fromId, int toId, TraceLocalMoveResolver moveResolver) { assert !isRegister(phiFrom) : "Out is a register: " + phiFrom; assert !isRegister(phiTo) : "In is a register: " + phiTo; assert !Value.ILLEGAL.equals(phiTo) : "The value not needed in this branch? " + phiFrom;
*** 191,201 **** // no need to handle virtual stack slots return; } TraceInterval toParent = allocator.intervalFor(asVariable(phiTo)); if (isConstantValue(phiFrom)) { ! numResolutionMoves.increment(); TraceInterval toInterval = allocator.splitChildAtOpId(toParent, toId, LIRInstruction.OperandMode.DEF); moveResolver.addMapping(asConstant(phiFrom), toInterval); } else { addMapping(allocator.intervalFor(asVariable(phiFrom)), toParent, fromId, toId, moveResolver); } --- 193,203 ---- // no need to handle virtual stack slots return; } TraceInterval toParent = allocator.intervalFor(asVariable(phiTo)); if (isConstantValue(phiFrom)) { ! numResolutionMoves.increment(debug); TraceInterval toInterval = allocator.splitChildAtOpId(toParent, toId, LIRInstruction.OperandMode.DEF); moveResolver.addMapping(asConstant(phiFrom), toInterval); } else { addMapping(allocator.intervalFor(asVariable(phiFrom)), toParent, fromId, toId, moveResolver); }
*** 207,219 **** if (toInterval == null) { // not alive return; } if (fromInterval != toInterval) { ! numResolutionMoves.increment(); ! if (numStackToStackMoves.isEnabled() && isStackSlotValue(toInterval.location()) && isStackSlotValue(fromInterval.location())) { ! numStackToStackMoves.increment(); } moveResolver.addMapping(fromInterval, toInterval); } } } --- 209,221 ---- if (toInterval == null) { // not alive return; } if (fromInterval != toInterval) { ! numResolutionMoves.increment(debug); ! if (isStackSlotValue(toInterval.location()) && isStackSlotValue(fromInterval.location())) { ! numStackToStackMoves.increment(debug); } moveResolver.addMapping(fromInterval, toInterval); } } }
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanResolveDataFlowPhase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File