Mercurial > hg > truffle
changeset 5788:8c9ce2cb3afe
recompute inlining level instead of caching it
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 06 Jul 2012 17:17:34 +0200 |
parents | 0017be5ba31e |
children | eca97d497f5d |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java |
diffstat | 1 files changed, 11 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java Fri Jul 06 16:29:30 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java Fri Jul 06 17:17:34 2012 +0200 @@ -84,10 +84,10 @@ graph.createNodeMap(); if (hints != null) { - scanInvokes((Iterable<? extends Node>) Util.uncheckedCast(this.hints), -1); + scanInvokes((Iterable<? extends Node>) Util.uncheckedCast(this.hints)); } else { - scanInvokes(graph.getNodes(InvokeNode.class), 0); - scanInvokes(graph.getNodes(InvokeWithExceptionNode.class), 0); + scanInvokes(graph.getNodes(InvokeNode.class)); + scanInvokes(graph.getNodes(InvokeWithExceptionNode.class)); } while (!inlineCandidates.isEmpty() && graph.getNodeCount() < GraalOptions.MaximumDesiredSize) { @@ -131,7 +131,7 @@ } if (newNodes != null && info.level < GraalOptions.MaximumInlineLevel) { - scanInvokes(newNodes, info.level + 1); + scanInvokes(newNodes); } } } @@ -149,17 +149,17 @@ } } - private void scanInvokes(final Iterable<? extends Node> nodes, final int level) { + private void scanInvokes(final Iterable<? extends Node> nodes) { Debug.scope("InliningDecisions", new Runnable() { public void run() { for (Node node : nodes) { if (node != null) { if (node instanceof Invoke) { Invoke invoke = (Invoke) node; - scanInvoke(invoke, level); + scanInvoke(invoke); } for (Node usage : node.usages().filterInterface(Invoke.class).snapshot()) { - scanInvoke((Invoke) usage, level); + scanInvoke((Invoke) usage); } } } @@ -167,10 +167,9 @@ }); } - private void scanInvoke(Invoke invoke, int level) { - InlineInfo info = InliningUtil.getInlineInfo(invoke, level >= 0 ? level : computeInliningLevel(invoke), runtime, assumptions, this, optimisticOpts); + private void scanInvoke(Invoke invoke) { + InlineInfo info = InliningUtil.getInlineInfo(invoke, computeInliningLevel(invoke), runtime, assumptions, this, optimisticOpts); if (info != null) { - assert level == -1 || computeInliningLevel(invoke) == level : "outer FramesStates must match inlining level"; metricInliningConsidered.increment(); inlineCandidates.add(info); } @@ -260,13 +259,13 @@ } private static int computeInliningLevel(Invoke invoke) { - int count = 0; + int count = -1; FrameState curState = invoke.stateAfter(); while (curState != null) { count++; curState = curState.outerFrameState(); } - return count - 1; + return count; } private static InliningPolicy createInliningPolicy() {