# HG changeset patch # User Miguel Garcia # Date 1400159255 -7200 # Node ID 0d0ce3c657dff1e5b035d6c8f8af461143e850f7 # Parent 1efd95f6e1ba0ce56b54812efbc127414aaa491c [inlining] side-effects moved out from just-extracted method diff -r 1efd95f6e1ba -r 0d0ce3c657df graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java --- 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 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 probabilities) { + /** + * @return true iff inlining was actually performed + */ + private boolean moveForward(HighTierContext context, InliningData data, ToDoubleFunction 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; } /**