Mercurial > hg > graal-compiler
changeset 15681:0d0ce3c657df
[inlining] side-effects moved out from just-extracted method
author | Miguel Garcia <miguel.m.garcia@oracle.com> |
---|---|
date | Thu, 15 May 2014 15:07:35 +0200 |
parents | 1efd95f6e1ba |
children | 6bc784b8e66b |
files | graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java |
diffstat | 1 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java Thu May 15 15:01:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java Thu May 15 15:07:35 2014 +0200 @@ -153,14 +153,20 @@ ToDoubleFunction<FixedNode> probabilities = new FixedNodeProbabilityCache(); while (data.hasUnprocessedGraphs()) { - moveForward(context, data, probabilities); + boolean wasInlined = moveForward(context, data, probabilities); + if (wasInlined) { + inliningCount++; + } } assert data.inliningDepth() == 0; assert data.graphCount() == 0; } - private void moveForward(HighTierContext context, InliningData data, ToDoubleFunction<FixedNode> probabilities) { + /** + * @return true iff inlining was actually performed + */ + private boolean moveForward(HighTierContext context, InliningData data, ToDoubleFunction<FixedNode> probabilities) { final MethodInvocation currentInvocation = data.currentInvocation(); @@ -171,18 +177,18 @@ assert remainingGraphs > 0; data.popGraphs(remainingGraphs); data.popInvocation(); - return; + return false; } final boolean delve = data.currentGraph().hasRemainingInvokes() && inliningPolicy.continueInlining(data.currentGraph().graph()); if (delve) { data.processNextInvoke(context); - return; + return false; } data.popGraph(); if (currentInvocation.isRoot()) { - return; + return false; } // try to inline @@ -192,14 +198,13 @@ data.popInvocation(); final MethodInvocation parentInvoke = data.currentInvocation(); try (Scope s = Debug.scope("Inlining", data.inliningContext())) { - boolean wasInlined = InliningData.tryToInline(probabilities, data.currentGraph(), currentInvocation, parentInvoke, data.inliningDepth() + 1, context, inliningPolicy, canonicalizer); - if (wasInlined) { - inliningCount++; - } + return InliningData.tryToInline(probabilities, data.currentGraph(), currentInvocation, parentInvoke, data.inliningDepth() + 1, context, inliningPolicy, canonicalizer); } catch (Throwable e) { throw Debug.handle(e); } } + + return false; } /**