src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/ssa/SSAUtil.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/ssa/SSAUtil.java	Mon Mar 20 17:40:09 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/ssa/SSAUtil.java	Mon Mar 20 17:40:09 2017

*** 20,31 **** --- 20,31 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ package org.graalvm.compiler.lir.ssa; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.graalvm.compiler.core.common.LIRKind; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; import org.graalvm.compiler.lir.LIR; import org.graalvm.compiler.lir.LIRInstruction;
*** 45,55 **** --- 45,55 ---- * There is no explicit <code>PHI</code> {@linkplain LIRInstruction}. Instead, they are implemented * as parallel copy that span across a control-flow edge. * * The variables introduced by <code>PHI</code>s of a specific {@linkplain AbstractBlockBase merge * block} are {@linkplain LabelOp#setIncomingValues attached} to the {@linkplain LabelOp} of the ! * block. The outgoing values from the predecessor are {@link JumpOp#setOutgoingValues input} to the ! * block. The outgoing values from the predecessor are {@link JumpOp#getOutgoingValue input} to the * {@linkplain BlockEndOp} of the predecessor. Because there are no critical edges we know that the * {@link BlockEndOp} of the predecessor has to be a {@link JumpOp}. * * <h3>Example:</h3> *
*** 95,129 **** --- 95,128 ---- assert pred.getSuccessors()[0] == merge : String.format("Predecessor block %s has wrong successor: %s, should be: %s", pred, pred.getSuccessors()[0], merge); JumpOp jump = phiOut(lir, pred); LabelOp label = phiIn(lir, merge); assert label.getIncomingSize() == jump.getOutgoingSize() : String.format("Phi In/Out size mismatch: in=%d vs. out=%d", label.getIncomingSize(), jump.getOutgoingSize()); assert label.getPhiSize() == jump.getPhiSize() : String.format("Phi In/Out size mismatch: in=%d vs. out=%d", label.getPhiSize(), jump.getPhiSize()); for (int i = 0; i < label.getPhiSize(); i++) { visitor.visit(label.getIncomingValue(i), jump.getOutgoingValue(i)); } } ! private static JumpOp phiOut(LIR lir, AbstractBlockBase<?> block) { ! public static JumpOp phiOut(LIR lir, AbstractBlockBase<?> block) { assert block.getSuccessorCount() == 1; ! ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block); int index = instructions.size() - 1; LIRInstruction op = instructions.get(index); return (JumpOp) op; } public static int phiOutIndex(LIR lir, AbstractBlockBase<?> block) { assert block.getSuccessorCount() == 1; ! ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block); int index = instructions.size() - 1; assert instructions.get(index) instanceof JumpOp; return index; } ! private static LabelOp phiIn(LIR lir, AbstractBlockBase<?> block) { ! public static LabelOp phiIn(LIR lir, AbstractBlockBase<?> block) { assert block.getPredecessorCount() > 1; LabelOp label = (LabelOp) lir.getLIRforBlock(block).get(0); return label; }
*** 139,148 **** --- 138,151 ---- public static boolean verifySSAForm(LIR lir) { return new SSAVerifier(lir).verify(); } + public static boolean isMerge(AbstractBlockBase<?> block) { + return block.getPredecessorCount() > 1; + } + public static void verifyPhi(LIR lir, AbstractBlockBase<?> merge) { assert merge.getPredecessorCount() > 1; for (AbstractBlockBase<?> pred : merge.getPredecessors()) { forEachPhiValuePair(lir, merge, pred, (phiIn, phiOut) -> { assert phiIn.getValueKind().equals(phiOut.getValueKind()) ||

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