# HG changeset patch # User Gilles Duboscq # Date 1337092032 -7200 # Node ID 128b3f57499115a3a0da8c89903ee8efecf8c0cf # Parent c574c454079136b3fd5665a84f1dca67ca07c843# Parent 206df7b3e022c742ff6167ff23b14c524dad56d7 Merge diff -r c574c4540791 -r 128b3f574991 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformUtil.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformUtil.java Tue May 15 14:29:14 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformUtil.java Tue May 15 16:27:12 2012 +0200 @@ -55,7 +55,7 @@ for (Block b : loop.exits) { earlyExits.add(b.getBeginNode()); } - return new SuperBlock(loop.loopBegin(), loop.loopBegin(), blocks, earlyExits, loop.loopBegin()); + return new SuperBlock(loop.loopBegin(), loop.loopBegin(), blocks, earlyExits); } public static int estimateSize(Loop loop) { diff -r c574c4540791 -r 128b3f574991 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/SuperBlock.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/SuperBlock.java Tue May 15 14:29:14 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/SuperBlock.java Tue May 15 16:27:12 2012 +0200 @@ -36,17 +36,15 @@ protected BeginNode exit; protected List blocks; protected List earlyExits; - protected LoopBeginNode loop; protected Map duplicationMapping; protected SuperBlock original; protected NodeBitMap loopNodes; - public SuperBlock(BeginNode entry, BeginNode exit, List blocks, List earlyExits, LoopBeginNode loop) { + public SuperBlock(BeginNode entry, BeginNode exit, List blocks, List earlyExits) { this.entry = entry; this.exit = exit; this.blocks = blocks; this.earlyExits = earlyExits; - this.loop = loop; assert blocks.contains(entry); assert !blocks.contains(exit) || exit == entry; } @@ -83,8 +81,8 @@ newEarlyExits.add(newEarlyExit); replacements.put(earlyExit, newEarlyExit); } - if (loop != null) { - for (LoopEndNode end : loop.loopEnds()) { + if (exit instanceof LoopBeginNode) { + for (LoopEndNode end : ((LoopBeginNode) exit).loopEnds()) { if (nodes.isMarked(end)) { replacements.put(end, graph.add(new EndNode())); } @@ -92,7 +90,7 @@ } Map duplicates = graph.addDuplicates(nodes, replacements); if (exit instanceof MergeNode) { - newExit = mergeExits(replacements, graph, duplicates, (MergeNode) exit); + newExit = mergeExits(replacements, duplicates); } List newBlocks = new ArrayList<>(blocks.size()); @@ -107,16 +105,20 @@ for (Entry e : replacements.entrySet()) { duplicates.put(e.getKey(), e.getValue()); } - SuperBlock superBlock = new SuperBlock(newEntry, newExit, newBlocks, newEarlyExits, loop); + SuperBlock superBlock = new SuperBlock(newEntry, newExit, newBlocks, newEarlyExits); superBlock.duplicationMapping = duplicates; superBlock.original = this; return superBlock; } - private BeginNode mergeExits(Map replacements, StructuredGraph graph, Map duplicates, MergeNode mergeExit) { - BeginNode newExit; + protected StructuredGraph graph() { + return (StructuredGraph) entry.graph(); + } + + private BeginNode mergeExits(Map replacements, Map duplicates) { List endsToMerge = new LinkedList<>(); - if (mergeExit == loop) { + MergeNode mergeExit = (MergeNode) exit; + if (mergeExit instanceof LoopBeginNode) { LoopBeginNode loopBegin = (LoopBeginNode) mergeExit; for (LoopEndNode le : loopBegin.loopEnds()) { Node duplicate = replacements.get(le); @@ -132,7 +134,12 @@ } } } + return mergeEnds(mergeExit, endsToMerge); + } + private BeginNode mergeEnds(MergeNode mergeExit, List endsToMerge) { + BeginNode newExit; + StructuredGraph graph = graph(); if (endsToMerge.size() == 1) { EndNode end = endsToMerge.get(0); assert end.usages().count() == 0; @@ -143,8 +150,12 @@ assert endsToMerge.size() > 1; MergeNode newExitMerge = graph.add(new MergeNode()); newExit = newExitMerge; - FrameState state = mergeExit.stateAfter().duplicate(); - newExitMerge.setStateAfter(state); // this state is wrong (incudes phis from the loop begin) needs to be fixed while resolving data + FrameState state = mergeExit.stateAfter(); + if (state != null) { + FrameState duplicateState = state.duplicate(); + // this state is wrong (incudes phis from the loop begin) needs to be fixed while resolving data + newExitMerge.setStateAfter(duplicateState); + } for (EndNode end : endsToMerge) { newExitMerge.addForwardEnd(end); } @@ -360,7 +371,7 @@ for (BeginNode b : blocks) { for (Node n : b.getBlockNodes()) { for (Node usage : n.usages()) { - markFloating(usage, nodes, ""); + markFloating(usage, nodes); } } } @@ -374,8 +385,7 @@ return nodes; } - private static boolean markFloating(Node n, NodeBitMap loopNodes, String ind) { - //System.out.println(ind + "markFloating(" + n + ")"); + private static boolean markFloating(Node n, NodeBitMap loopNodes) { if (loopNodes.isMarked(n)) { return true; } @@ -384,7 +394,8 @@ } boolean mark = false; if (n instanceof PhiNode) { - mark = loopNodes.isMarked(((PhiNode) n).merge()); + PhiNode phi = (PhiNode) n; + mark = loopNodes.isMarked(phi.merge()); if (mark) { loopNodes.mark(n); } else { @@ -392,7 +403,7 @@ } } for (Node usage : n.usages()) { - if (markFloating(usage, loopNodes, " " + ind)) { + if (markFloating(usage, loopNodes)) { mark = true; } } diff -r c574c4540791 -r 128b3f574991 mx/commands.py --- a/mx/commands.py Tue May 15 14:29:14 2012 +0200 +++ b/mx/commands.py Tue May 15 16:27:12 2012 +0200 @@ -676,7 +676,7 @@ if len(neg) != 0: classes = [c for c in classes if not containsAny(c, neg)] - vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=::test', '-Xcomp', '-esa'] + vmArgs + ['-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) + vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=com/oracle/graal/jtt', '-XX:CompileCommand=exclude,com/oracle/graal/jtt*.run*', '-XX:CompileCommand=quiet', '-Xcomp', '-esa'] + vmArgs + ['-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) def buildvms(args): """build one or more VMs in various configurations""" diff -r c574c4540791 -r 128b3f574991 src/share/vm/opto/bytecodeInfo.cpp --- a/src/share/vm/opto/bytecodeInfo.cpp Tue May 15 14:29:14 2012 +0200 +++ b/src/share/vm/opto/bytecodeInfo.cpp Tue May 15 16:27:12 2012 +0200 @@ -240,6 +240,9 @@ // ignore heuristic controls on inlining return NULL; } + if (callee_method->should_not_inline()) { + return "disallowed by CompilerOracle"; + } // Now perform checks which are heuristic @@ -278,10 +281,6 @@ } } - if (callee_method->should_not_inline()) { - return "disallowed by CompilerOracle"; - } - if (UseStringCache) { // Do not inline StringCache::profile() method used only at the beginning. if (callee_method->name() == ciSymbol::profile_name() &&