Mercurial > hg > truffle
changeset 15983:1fbefda059a6
[inlining] documentation and assertions
author | Miguel Garcia <miguel.m.garcia@oracle.com> |
---|---|
date | Thu, 29 May 2014 16:35:01 +0200 |
parents | aa28d876651a |
children | 114ca0838327 |
files | graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java Wed May 28 17:24:38 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java Thu May 29 16:35:01 2014 +0200 @@ -380,6 +380,7 @@ */ private boolean tryToInline(CallsiteHolder callerCallsiteHolder, MethodInvocation calleeInvocation, MethodInvocation parentInvocation, int inliningDepth) { InlineInfo calleeInfo = calleeInvocation.callee(); + assert iterContains(callerCallsiteHolder.graph().getInvokes(), calleeInfo.invoke()); Assumptions callerAssumptions = parentInvocation.assumptions(); metricInliningConsidered.increment(); @@ -395,6 +396,15 @@ return false; } + private static <T> boolean iterContains(Iterable<T> in, T elem) { + for (T i : in) { + if (i == elem) { + return true; + } + } + return false; + } + /** * Process the next invoke and enqueue all its graphs for processing. */ @@ -585,6 +595,10 @@ assert currentInvocation.callee().invoke().asNode().isAlive(); currentInvocation.incrementProcessedGraphs(); if (currentInvocation.processedGraphs() == currentInvocation.totalGraphs()) { + /* + * "all of currentInvocation's graphs processed" amounts to + * "all concrete methods that come into question already had the callees they contain analyzed for inlining" + */ popInvocation(); final MethodInvocation parentInvoke = currentInvocation(); try (Debug.Scope s = Debug.scope("Inlining", inliningContext())) {