Mercurial > hg > graal-compiler
changeset 23292:1a1a163340e7
Inlining exploration limit shouldn't be a bailout
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Mon, 11 Jan 2016 20:19:25 -0800 |
parents | 6d1914226c63 |
children | a134baee9f15 |
files | graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java |
diffstat | 2 files changed, 14 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java Mon Jan 11 16:47:22 2016 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java Mon Jan 11 20:19:25 2016 -0800 @@ -24,9 +24,6 @@ import java.util.Map; -import jdk.vm.ci.code.BailoutException; - -import com.oracle.graal.compiler.common.util.Util; import com.oracle.graal.nodes.Invoke; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.options.Option; @@ -51,14 +48,13 @@ * the inlining call tree exploration can be wide enough to prevent inlining from completing * in reasonable time. */ - @Option(help = "Per-compilation method inlining limit before bailing out (use 0 to disable)", type = OptionType.Debug)// + @Option(help = "Per-compilation method inlining exploration limit before giving up (use 0 to disable)", type = OptionType.Debug)// public static final OptionValue<Integer> MethodInlineBailoutLimit = new OptionValue<>(5000); } private final InliningPolicy inliningPolicy; private final CanonicalizerPhase canonicalizer; - private int inliningCount; private int maxMethodPerInlining = Integer.MAX_VALUE; public InliningPhase(CanonicalizerPhase canonicalizer) { @@ -78,10 +74,6 @@ maxMethodPerInlining = max; } - public int getInliningCount() { - return inliningCount; - } - /** * * This method sets in motion the inlining machinery. @@ -100,16 +92,16 @@ while (data.hasUnprocessedGraphs()) { boolean wasInlined = data.moveForward(); assert data.repOK(); - if (wasInlined) { - count++; + count++; + if (!wasInlined) { if (limit > 0 && count == limit) { - throw new BailoutException("Reached method inline limit %d%nInvocation stack:%n %s", limit, Util.join(data.getInvocationStackTrace(), "\n ")); + // Limit the amount of exploration which is done + break; } } } - inliningCount += count; - assert data.inliningDepth() == 0; - assert data.graphCount() == 0; + assert data.inliningDepth() == 0 || count == limit; + assert data.graphCount() == 0 || count == limit; } }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java Mon Jan 11 16:47:22 2016 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java Mon Jan 11 20:19:25 2016 -0800 @@ -114,6 +114,7 @@ private final int maxMethodPerInlining; private final CanonicalizerPhase canonicalizer; private final InliningPolicy inliningPolicy; + private final StructuredGraph rootGraph; private int maxGraphs; @@ -124,6 +125,7 @@ this.canonicalizer = canonicalizer; this.inliningPolicy = inliningPolicy; this.maxGraphs = 1; + this.rootGraph = rootGraph; invocationQueue.push(new MethodInvocation(null, 1.0, 1.0, null)); graphQueue.push(new CallsiteHolderExplorable(rootGraph, 1.0, 1.0, null)); @@ -733,7 +735,11 @@ */ popInvocation(); try (Debug.Scope s = Debug.scope("Inlining", inliningContext())) { - return tryToInline(currentInvocation, inliningDepth() + 1); + if (tryToInline(currentInvocation, inliningDepth() + 1)) { + // Report real progress only if we inline into the root graph + return currentGraph().graph() == rootGraph; + } + return false; } catch (Throwable e) { throw Debug.handle(e); }