src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/LoopFragment.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.loop/src/org/graalvm/compiler/loop/LoopFragment.java	Fri Jul  7 09:31:12 2017
--- new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/LoopFragment.java	Fri Jul  7 09:31:12 2017

*** 129,138 **** --- 129,140 ---- return l.loopBegin().graph(); } protected abstract DuplicationReplacement getDuplicationReplacement(); + protected abstract void beforeDuplication(); + protected abstract void finishDuplication(); protected void patchNodes(final DuplicationReplacement dataFix) { if (isDuplicate() && !nodesReady) { assert !original.isDuplicate();
*** 160,169 **** --- 162,172 ---- } }; } else { dr = null; } + beforeDuplication(); NodeIterable<Node> nodesIterable = original().nodes(); duplicationMap = graph().addDuplicates(nodesIterable, graph(), nodesIterable.count(), dr); finishDuplication(); nodesReady = true; } else {
*** 173,189 **** --- 176,192 ---- protected static NodeBitMap computeNodes(Graph graph, Iterable<AbstractBeginNode> blocks) { return computeNodes(graph, blocks, Collections.emptyList()); } ! protected static NodeBitMap computeNodes(Graph graph, Iterable<AbstractBeginNode> blocks, Iterable<LoopExitNode> earlyExits) { ! protected static NodeBitMap computeNodes(Graph graph, Iterable<AbstractBeginNode> blocks, Iterable<AbstractBeginNode> earlyExits) { final NodeBitMap nodes = graph.createNodeBitMap(); computeNodes(nodes, graph, blocks, earlyExits); return nodes; } ! protected static void computeNodes(NodeBitMap nodes, Graph graph, Iterable<AbstractBeginNode> blocks, Iterable<LoopExitNode> earlyExits) { ! protected static void computeNodes(NodeBitMap nodes, Graph graph, Iterable<AbstractBeginNode> blocks, Iterable<AbstractBeginNode> earlyExits) { for (AbstractBeginNode b : blocks) { if (b.isDeleted()) { continue; }
*** 196,219 **** --- 199,226 ---- withState.states().forEach(state -> state.applyToVirtual(node -> nodes.mark(node))); } nodes.mark(n); } } ! for (LoopExitNode earlyExit : earlyExits) { ! for (AbstractBeginNode earlyExit : earlyExits) { if (earlyExit.isDeleted()) { continue; } ! FrameState stateAfter = earlyExit.stateAfter(); ! nodes.mark(earlyExit); + + if (earlyExit instanceof LoopExitNode) { + LoopExitNode loopExit = (LoopExitNode) earlyExit; + FrameState stateAfter = loopExit.stateAfter(); if (stateAfter != null) { stateAfter.applyToVirtual(node -> nodes.mark(node)); } nodes.mark(earlyExit); for (ProxyNode proxy : earlyExit.proxies()) { + for (ProxyNode proxy : loopExit.proxies()) { nodes.mark(proxy); } } + } final NodeBitMap nonLoopNodes = graph.createNodeBitMap(); for (AbstractBeginNode b : blocks) { if (b.isDeleted()) { continue;
*** 300,325 **** --- 307,340 ---- } }; } ! public static NodeIterable<LoopExitNode> toHirExits(final Iterable<Block> blocks) { ! return new NodeIterable<LoopExitNode>() { ! public static NodeIterable<AbstractBeginNode> toHirExits(final Iterable<Block> blocks) { ! return new NodeIterable<AbstractBeginNode>() { @Override ! public Iterator<LoopExitNode> iterator() { ! public Iterator<AbstractBeginNode> iterator() { final Iterator<Block> it = blocks.iterator(); ! return new Iterator<LoopExitNode>() { ! return new Iterator<AbstractBeginNode>() { @Override public void remove() { throw new UnsupportedOperationException(); } + /** + * Return the true LoopExitNode for this loop or the BeginNode for the block. + */ @Override ! public LoopExitNode next() { ! return (LoopExitNode) it.next().getBeginNode(); ! public AbstractBeginNode next() { ! Block next = it.next(); + LoopExitNode exit = next.getLoopExit(); + if (exit != null) { + return exit; + } + return next.getBeginNode(); } @Override public boolean hasNext() { return it.hasNext();

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