src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/GlobalLivenessAnalysisPhase.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/alloc/trace/GlobalLivenessAnalysisPhase.java Fri Jul 7 09:30:48 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/GlobalLivenessAnalysisPhase.java Fri Jul 7 09:30:48 2017
*** 29,39 ****
--- 29,39 ----
import java.util.BitSet;
import java.util.EnumSet;
import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
import org.graalvm.compiler.core.common.cfg.Loop;
! import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.debug.Indent;
import org.graalvm.compiler.lir.InstructionValueConsumer;
import org.graalvm.compiler.lir.LIR;
import org.graalvm.compiler.lir.LIRInstruction;
*** 63,73 ****
--- 63,73 ----
context.contextAdd(livenessInfo);
}
private final class Analyser {
! private static final int LOG_LEVEL = DebugContext.INFO_LEVEL;
/**
* Bit map specifying which operands are live upon entry to this block. These are values
* used in this block or any of its successors where such value are not defined in this
* block. The bit index of an operand is its {@linkplain #operandNumber operand number}.
*** 138,150 ****
--- 138,151 ----
* Computes live sets for each block.
*/
@SuppressWarnings("try")
private void computeLiveness() {
// iterate all blocks
+ DebugContext debug = lir.getDebug();
for (int i = blocks.length - 1; i >= 0; i--) {
final AbstractBlockBase<?> block = blocks[i];
! try (Indent indent = Debug.logAndIndent(LOG_LEVEL, "compute local live sets for block %s", block)) {
! try (Indent indent = debug.logAndIndent(LOG_LEVEL, "compute local live sets for block %s", block)) {
final BitSet liveIn = mergeLiveSets(block);
setLiveOut(block, (BitSet) liveIn.clone());
InstructionValueConsumer useConsumer = new InstructionValueConsumer() {
*** 157,176 ****
--- 158,177 ----
@Override
public void visitValue(LIRInstruction op, Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
processDef(liveIn, op, operand);
}
};
! if (Debug.isLogEnabled()) {
! Debug.log(LOG_LEVEL, "liveOut B%d %s", block.getId(), getLiveOut(block));
! if (debug.isLogEnabled()) {
! debug.log(LOG_LEVEL, "liveOut B%d %s", block.getId(), getLiveOut(block));
}
// iterate all instructions of the block
ArrayList<LIRInstruction> instructions = getLIR().getLIRforBlock(block);
for (int j = instructions.size() - 1; j >= 0; j--) {
final LIRInstruction op = instructions.get(j);
! try (Indent indent2 = Debug.logAndIndent(LOG_LEVEL, "handle op %d: %s", op.id(), op)) {
! try (Indent indent2 = debug.logAndIndent(LOG_LEVEL, "handle op %d: %s", op.id(), op)) {
op.visitEachOutput(defConsumer);
op.visitEachTemp(defConsumer);
op.visitEachState(useConsumer);
op.visitEachAlive(useConsumer);
op.visitEachInput(useConsumer);
*** 180,191 ****
--- 181,192 ----
setLiveIn(block, liveIn);
if (block.isLoopHeader()) {
handleLoopHeader(block.getLoop(), liveIn);
}
! if (Debug.isLogEnabled()) {
! Debug.log(LOG_LEVEL, "liveIn B%d %s", block.getId(), getLiveIn(block));
! if (debug.isLogEnabled()) {
! debug.log(LOG_LEVEL, "liveIn B%d %s", block.getId(), getLiveIn(block));
}
}
} // end of block iteration
}
*** 216,227 ****
--- 217,229 ----
private void processUse(final BitSet liveGen, Value operand) {
if (isVariable(operand)) {
int operandNum = operandNumber(operand);
liveGen.set(operandNum);
if (Debug.isLogEnabled()) {
Debug.log(LOG_LEVEL, "liveGen for operand %d(%s)", operandNum, operand);
+ DebugContext debug = lir.getDebug();
+ if (debug.isLogEnabled()) {
+ debug.log(LOG_LEVEL, "liveGen for operand %d(%s)", operandNum, operand);
}
}
}
private void processDef(final BitSet liveGen, LIRInstruction op, Value operand) {
*** 230,241 ****
--- 232,244 ----
int operandNum = operandNumber(operand);
if (operands[operandNum] == null) {
operands[operandNum] = operand;
}
liveGen.clear(operandNum);
if (Debug.isLogEnabled()) {
Debug.log(LOG_LEVEL, "liveKill for operand %d(%s)", operandNum, operand);
+ DebugContext debug = lir.getDebug();
+ if (debug.isLogEnabled()) {
+ debug.log(LOG_LEVEL, "liveKill for operand %d(%s)", operandNum, operand);
}
}
}
private LIR getLIR() {
*** 254,264 ****
--- 257,267 ----
@SuppressWarnings("try")
public void finish() {
// iterate all blocks in reverse order
for (AbstractBlockBase<?> block : (AbstractBlockBase<?>[]) lir.getControlFlowGraph().getBlocks()) {
! try (Indent indent = lir.getDebug().logAndIndent(LOG_LEVEL, "Finish Block %s", block)) {
buildIncoming(block);
buildOutgoing(block);
}
}
}
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/GlobalLivenessAnalysisPhase.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File