--- old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/lsra/LinearScanEliminateSpillMovePhase.java 2017-07-07 09:30:39.000000000 -0700 +++ new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/lsra/LinearScanEliminateSpillMovePhase.java 2017-07-07 09:30:39.000000000 -0700 @@ -31,7 +31,7 @@ import java.util.ArrayList; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; -import org.graalvm.compiler.debug.Debug; +import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.Indent; import org.graalvm.compiler.lir.LIRInsertionBuffer; import org.graalvm.compiler.lir.LIRInstruction; @@ -90,7 +90,8 @@ // called once before assignment of register numbers @SuppressWarnings("try") void eliminateSpillMoves(LIRGenerationResult res) { - try (Indent indent = Debug.logAndIndent("Eliminating unnecessary spill moves")) { + DebugContext debug = allocator.getDebug(); + try (Indent indent = debug.logAndIndent("Eliminating unnecessary spill moves")) { /* * collect all intervals that must be stored after their definition. The list is sorted @@ -99,12 +100,12 @@ Interval interval; interval = allocator.createUnhandledLists(mustStoreAtDefinition, null).getLeft(); if (DetailedAsserts.getValue(allocator.getOptions())) { - checkIntervals(interval); + checkIntervals(debug, interval); } LIRInsertionBuffer insertionBuffer = new LIRInsertionBuffer(); for (AbstractBlockBase block : allocator.sortedBlocks()) { - try (Indent indent1 = Debug.logAndIndent("Handle %s", block)) { + try (Indent indent1 = debug.logAndIndent("Handle %s", block)) { ArrayList instructions = allocator.getLIR().getLIRforBlock(block); int numInst = instructions.size(); @@ -125,14 +126,14 @@ * Move target is a stack slot that is always correct, so eliminate * instruction. */ - if (Debug.isLogEnabled()) { + if (debug.isLogEnabled()) { if (ValueMoveOp.isValueMoveOp(op)) { ValueMoveOp vmove = ValueMoveOp.asValueMoveOp(op); - Debug.log("eliminating move from interval %d (%s) to %d (%s) in block %s", allocator.operandNumber(vmove.getInput()), vmove.getInput(), + debug.log("eliminating move from interval %d (%s) to %d (%s) in block %s", allocator.operandNumber(vmove.getInput()), vmove.getInput(), allocator.operandNumber(vmove.getResult()), vmove.getResult(), block); } else { LoadConstantOp load = LoadConstantOp.asLoadConstantOp(op); - Debug.log("eliminating constant load from %s to %d (%s) in block %s", load.getConstant(), allocator.operandNumber(load.getResult()), load.getResult(), block); + debug.log("eliminating constant load from %s to %d (%s) in block %s", load.getConstant(), allocator.operandNumber(load.getResult()), load.getResult(), block); } } @@ -170,8 +171,8 @@ insertionBuffer.append(j + 1, move); move.setComment(res, "LSRAEliminateSpillMove: store at definition"); - if (Debug.isLogEnabled()) { - Debug.log("inserting move after definition of interval %d to stack slot %s at opId %d", interval.operandNumber, interval.spillSlot(), opId); + if (debug.isLogEnabled()) { + debug.log("inserting move after definition of interval %d to stack slot %s at opId %d", interval.operandNumber, interval.spillSlot(), opId); } } } @@ -206,7 +207,7 @@ return false; } - private static void checkIntervals(Interval interval) { + private static void checkIntervals(DebugContext debug, Interval interval) { Interval prev = null; Interval temp = interval; while (!temp.isEndMarker()) { @@ -220,8 +221,8 @@ assert temp.spillDefinitionPos() >= temp.from() : "invalid order"; assert temp.spillDefinitionPos() <= temp.from() + 2 : "only intervals defined once at their start-pos can be optimized"; - if (Debug.isLogEnabled()) { - Debug.log("interval %d (from %d to %d) must be stored at %d", temp.operandNumber, temp.from(), temp.to(), temp.spillDefinitionPos()); + if (debug.isLogEnabled()) { + debug.log("interval %d (from %d to %d) must be stored at %d", temp.operandNumber, temp.from(), temp.to(), temp.spillDefinitionPos()); } prev = temp;