--- old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanResolveDataFlowPhase.java 2017-07-07 09:30:58.000000000 -0700 +++ new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanResolveDataFlowPhase.java 2017-07-07 09:30:58.000000000 -0700 @@ -36,8 +36,8 @@ 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.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; @@ -69,16 +69,18 @@ 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()); + if (debug.isLogEnabled()) { + debug.log("inserting moves at end of fromBlock B%d", fromBlock.getId()); } ArrayList instructions = allocator.getLIR().getLIRforBlock(fromBlock); @@ -91,8 +93,8 @@ } } else { - if (Debug.isLogEnabled()) { - Debug.log("inserting moves at beginning of toBlock B%d", toBlock.getId()); + if (debug.isLogEnabled()) { + debug.log("inserting moves at beginning of toBlock B%d", toBlock.getId()); } if (DetailedAsserts.getValue(allocator.getOptions())) { @@ -123,7 +125,7 @@ // no resolution necessary return; } - try (Indent indent = Debug.logAndIndent("resolve data flow")) { + try (Indent indent = debug.logAndIndent("resolve data flow")) { TraceLocalMoveResolver moveResolver = allocator.createMoveResolver(); AbstractBlockBase toBlock = null; @@ -148,7 +150,7 @@ @SuppressWarnings("try") private void resolveCollectMappings(AbstractBlockBase fromBlock, AbstractBlockBase toBlock, TraceLocalMoveResolver moveResolver) { - try (Indent indent0 = Debug.logAndIndent("Edge %s -> %s", fromBlock, toBlock)) { + 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); @@ -180,8 +182,8 @@ 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 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; @@ -193,7 +195,7 @@ } TraceInterval toParent = allocator.intervalFor(asVariable(phiTo)); if (isConstantValue(phiFrom)) { - numResolutionMoves.increment(); + numResolutionMoves.increment(debug); TraceInterval toInterval = allocator.splitChildAtOpId(toParent, toId, LIRInstruction.OperandMode.DEF); moveResolver.addMapping(asConstant(phiFrom), toInterval); } else { @@ -209,9 +211,9 @@ return; } if (fromInterval != toInterval) { - numResolutionMoves.increment(); - if (numStackToStackMoves.isEnabled() && isStackSlotValue(toInterval.location()) && isStackSlotValue(fromInterval.location())) { - numStackToStackMoves.increment(); + numResolutionMoves.increment(debug); + if (isStackSlotValue(toInterval.location()) && isStackSlotValue(fromInterval.location())) { + numStackToStackMoves.increment(debug); } moveResolver.addMapping(fromInterval, toInterval); }