src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/stackslotalloc/FixPointIntervalBuilder.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/stackslotalloc/FixPointIntervalBuilder.java	Fri Jul  7 09:31:07 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/stackslotalloc/FixPointIntervalBuilder.java	Fri Jul  7 09:31:07 2017

*** 31,52 **** --- 31,52 ---- import java.util.Deque; import java.util.EnumSet; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; import org.graalvm.compiler.core.common.cfg.BlockMap; ! 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.InstructionValueConsumer; import org.graalvm.compiler.lir.InstructionValueProcedure; import org.graalvm.compiler.lir.LIR; import org.graalvm.compiler.lir.LIRInstruction; import org.graalvm.compiler.lir.LIRInstruction.OperandFlag; import org.graalvm.compiler.lir.LIRInstruction.OperandMode; import org.graalvm.util.Equivalence; import org.graalvm.util.EconomicSet; import org.graalvm.compiler.lir.VirtualStackSlot; + import org.graalvm.util.EconomicSet; + import org.graalvm.util.Equivalence; import jdk.vm.ci.meta.Value; /** * Calculates the stack intervals using a worklist-based backwards data-flow analysis.
*** 60,70 **** --- 60,70 ---- private final EconomicSet<LIRInstruction> usePos; /** * The number of allocated stack slots. */ ! private static final DebugCounter uninitializedSlots = Debug.counter("StackSlotAllocator[uninitializedSlots]"); ! private static final CounterKey uninitializedSlots = DebugContext.counter("StackSlotAllocator[uninitializedSlots]"); FixPointIntervalBuilder(LIR lir, StackInterval[] stackSlotMap, int maxOpId) { this.lir = lir; this.stackSlotMap = stackSlotMap; this.maxOpId = maxOpId;
*** 111,122 **** --- 111,123 ---- return false; } @SuppressWarnings("try") private void processBlock(AbstractBlockBase<?> block, Deque<AbstractBlockBase<?>> worklist) { + DebugContext debug = lir.getDebug(); if (updateOutBlock(block)) { ! try (Indent indent = Debug.logAndIndent("handle block %s", block)) { ! try (Indent indent = debug.logAndIndent("handle block %s", block)) { ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block); // get out set and mark intervals BitSet outSet = liveOutMap.get(block); markOutInterval(outSet, getBlockEnd(instructions)); printLiveSet("liveOut", outSet);
*** 141,153 **** --- 142,155 ---- } } @SuppressWarnings("try") private void printLiveSet(String label, BitSet liveSet) { if (Debug.isLogEnabled()) { ! try (Indent indent = Debug.logAndIndent(label)) { Debug.log("%s", liveSetToString(liveSet)); + DebugContext debug = lir.getDebug(); ! if (debug.isLogEnabled()) { + try (Indent indent = debug.logAndIndent(label)) { + debug.log("%s", liveSetToString(liveSet)); } } } private String liveSetToString(BitSet liveSet) {
*** 158,178 **** --- 160,182 ---- } return sb.toString(); } private void markOutInterval(BitSet outSet, int blockEndOpId) { + DebugContext debug = lir.getDebug(); for (int i = outSet.nextSetBit(0); i >= 0; i = outSet.nextSetBit(i + 1)) { StackInterval interval = getIntervalFromStackId(i); ! Debug.log("mark live operand: %s", interval.getOperand()); ! debug.log("mark live operand: %s", interval.getOperand()); interval.addTo(blockEndOpId); } } private void markInInterval(BitSet inSet, int blockFirstOpId) { + DebugContext debug = lir.getDebug(); for (int i = inSet.nextSetBit(0); i >= 0; i = inSet.nextSetBit(i + 1)) { StackInterval interval = getIntervalFromStackId(i); ! Debug.log("mark live operand: %s", interval.getOperand()); ! debug.log("mark live operand: %s", interval.getOperand()); interval.addFrom(blockFirstOpId); } } private final class BlockClosure {
*** 190,200 **** --- 194,205 ---- * Process all values of an instruction bottom-up, i.e. definitions before usages. Values * that start or end at the current operation are not included. */ @SuppressWarnings("try") private void processInstructionBottomUp(LIRInstruction op) { try (Indent indent = Debug.logAndIndent("handle op %d, %s", op.id(), op)) { + DebugContext debug = lir.getDebug(); + try (Indent indent = debug.logAndIndent("handle op %d, %s", op.id(), op)) { // kills op.visitEachTemp(defConsumer); op.visitEachOutput(defConsumer); // gen - values that are considered alive for this state
*** 208,236 **** --- 213,243 ---- InstructionValueConsumer useConsumer = new InstructionValueConsumer() { @Override public void visitValue(LIRInstruction inst, Value operand, OperandMode mode, EnumSet<OperandFlag> flags) { if (isVirtualStackSlot(operand)) { + DebugContext debug = lir.getDebug(); VirtualStackSlot vslot = asVirtualStackSlot(operand); addUse(vslot, inst, flags); addRegisterHint(inst, vslot, mode, flags, false); usePos.add(inst); ! Debug.log("set operand: %s", operand); ! debug.log("set operand: %s", operand); currentSet.set(vslot.getId()); } } }; InstructionValueConsumer defConsumer = new InstructionValueConsumer() { @Override public void visitValue(LIRInstruction inst, Value operand, OperandMode mode, EnumSet<OperandFlag> flags) { if (isVirtualStackSlot(operand)) { + DebugContext debug = lir.getDebug(); VirtualStackSlot vslot = asVirtualStackSlot(operand); addDef(vslot, inst); addRegisterHint(inst, vslot, mode, flags, true); usePos.add(inst); ! Debug.log("clear operand: %s", operand); ! debug.log("clear operand: %s", operand); currentSet.clear(vslot.getId()); } } };
*** 238,249 **** --- 245,257 ---- private void addUse(VirtualStackSlot stackSlot, LIRInstruction inst, EnumSet<OperandFlag> flags) { StackInterval interval = getOrCreateInterval(stackSlot); if (flags.contains(OperandFlag.UNINITIALIZED)) { // Stack slot is marked uninitialized so we have to assume it is live all // the time. if (Debug.isCountEnabled() && !(interval.from() == 0 && interval.to() == maxOpId)) { uninitializedSlots.increment(); + DebugContext debug = lir.getDebug(); + if (debug.isCountEnabled() && !(interval.from() == 0 && interval.to() == maxOpId)) { + uninitializedSlots.increment(debug); } interval.addFrom(0); interval.addTo(maxOpId); } else { interval.addTo(inst.id());
*** 268,279 **** --- 276,288 ---- if (hintAtDef) { to.setLocationHint(from); } else { from.setLocationHint(to); } if (Debug.isLogEnabled()) { Debug.log("operation %s at opId %d: added hint from interval %s to %s", op, op.id(), from, to); + DebugContext debug = lir.getDebug(); + if (debug.isLogEnabled()) { + debug.log("operation %s at opId %d: added hint from interval %s to %s", op, op.id(), from, to); } return registerHint; } return null;

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/stackslotalloc/FixPointIntervalBuilder.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File