src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/constopt/ConstantTreeAnalyzer.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/constopt/ConstantTreeAnalyzer.java	Fri Jul  7 09:31:02 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/constopt/ConstantTreeAnalyzer.java	Fri Jul  7 09:31:02 2017

*** 27,38 **** --- 27,37 ---- import java.util.BitSet; import java.util.Deque; import java.util.List; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; ! import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.Debug.Scope; import org.graalvm.compiler.debug.Indent; import org.graalvm.compiler.lir.constopt.ConstantTree.Flags; import org.graalvm.compiler.lir.constopt.ConstantTree.NodeCost; /**
*** 41,57 **** --- 40,56 ---- public final class ConstantTreeAnalyzer { private final ConstantTree tree; private final BitSet visited; @SuppressWarnings("try") ! public static NodeCost analyze(DebugContext debug, ConstantTree tree, AbstractBlockBase<?> startBlock) { ! try (Scope s = Debug.scope("ConstantTreeAnalyzer")) { ! try (DebugContext.Scope s = debug.scope("ConstantTreeAnalyzer")) { ConstantTreeAnalyzer analyzer = new ConstantTreeAnalyzer(tree); ! analyzer.analyzeBlocks(debug, startBlock); return tree.getCost(startBlock); } catch (Throwable e) { ! throw Debug.handle(e); ! throw debug.handle(e); } } private ConstantTreeAnalyzer(ConstantTree tree) { this.tree = tree;
*** 65,101 **** --- 64,100 ---- * cause {@linkplain StackOverflowError stack overflows} on larger graphs. * * @param startBlock The start block of the dominator subtree. */ @SuppressWarnings("try") ! private void analyzeBlocks(DebugContext debug, AbstractBlockBase<?> startBlock) { Deque<AbstractBlockBase<?>> worklist = new ArrayDeque<>(); worklist.offerLast(startBlock); while (!worklist.isEmpty()) { AbstractBlockBase<?> block = worklist.pollLast(); ! try (Indent i = Debug.logAndIndent(Debug.VERBOSE_LEVEL, "analyze: %s", block)) { ! try (Indent i = debug.logAndIndent(DebugContext.VERBOSE_LEVEL, "analyze: %s", block)) { assert block != null : "worklist is empty!"; assert isMarked(block) : "Block not part of the dominator tree: " + block; if (isLeafBlock(block)) { ! Debug.log(Debug.VERBOSE_LEVEL, "leaf block"); ! debug.log(DebugContext.VERBOSE_LEVEL, "leaf block"); leafCost(block); continue; } if (!visited.get(block.getId())) { // if not yet visited (and not a leaf block) process all children first! ! Debug.log(Debug.VERBOSE_LEVEL, "not marked"); ! debug.log(DebugContext.VERBOSE_LEVEL, "not marked"); worklist.offerLast(block); AbstractBlockBase<?> dominated = block.getFirstDominated(); while (dominated != null) { ! filteredPush(debug, worklist, dominated); dominated = dominated.getDominatedSibling(); } visited.set(block.getId()); } else { ! Debug.log(Debug.VERBOSE_LEVEL, "marked"); ! debug.log(DebugContext.VERBOSE_LEVEL, "marked"); // otherwise, process block process(block); } } }
*** 158,170 **** --- 157,169 ---- */ private static boolean shouldMaterializerInCurrentBlock(double probabilityBlock, double probabilityChildren, int numMat) { return probabilityBlock * Math.pow(0.9, numMat - 1) < probabilityChildren; } ! private void filteredPush(DebugContext debug, Deque<AbstractBlockBase<?>> worklist, AbstractBlockBase<?> block) { if (isMarked(block)) { ! Debug.log(Debug.VERBOSE_LEVEL, "adding %s to the worklist", block); ! debug.log(DebugContext.VERBOSE_LEVEL, "adding %s to the worklist", block); worklist.offerLast(block); } } private void leafCost(AbstractBlockBase<?> block) {

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