# HG changeset patch
# User Miguel Garcia
# Date 1400161303 -7200
# Node ID 947f62e98c07f8a55fd47b434c7a6fbf12ccb926
# Parent d5270e276765a4dea3248c73229d1ec049a6a7a4
[inlining] moved helper class MethodInvocation to package inlining.walker
diff -r d5270e276765 -r 947f62e98c07 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:37:08 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java Thu May 15 15:41:43 2014 +0200
@@ -35,7 +35,6 @@
import com.oracle.graal.graph.Graph.Mark;
import com.oracle.graal.graph.*;
import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.java.*;
import com.oracle.graal.options.*;
import com.oracle.graal.phases.common.*;
import com.oracle.graal.phases.common.inlining.info.InlineInfo;
@@ -45,6 +44,7 @@
import com.oracle.graal.phases.common.inlining.policy.GreedyInliningPolicy;
import com.oracle.graal.phases.common.inlining.policy.InliningPolicy;
import com.oracle.graal.phases.common.inlining.walker.CallsiteHolder;
+import com.oracle.graal.phases.common.inlining.walker.MethodInvocation;
import com.oracle.graal.phases.graph.*;
import com.oracle.graal.phases.tiers.*;
import com.oracle.graal.phases.util.*;
@@ -96,9 +96,9 @@
* single callsite (details below). For example, "exact inline" leads to a single candidate.
*
* the callsite (for the targets above) is tracked as a {@link MethodInvocation}. The difference
- * between {@link MethodInvocation#totalGraphs()} and {@link MethodInvocation#processedGraphs()}
- * indicates the topmost {@link CallsiteHolder}s that might be delved-into to explore inlining
- * opportunities.
+ * between {@link com.oracle.graal.phases.common.inlining.walker.MethodInvocation#totalGraphs()}
+ * and {@link MethodInvocation#processedGraphs()} indicates the topmost {@link CallsiteHolder}s
+ * that might be delved-into to explore inlining opportunities.
*
*
*
@@ -108,8 +108,9 @@
*
* a single {@link CallsiteHolder} (the root one, for the method on which inlining was called)
*
- * a single {@link MethodInvocation} (the {@link MethodInvocation#isRoot} one, ie the unknown
- * caller of the root graph)
+ * a single {@link MethodInvocation} (the
+ * {@link com.oracle.graal.phases.common.inlining.walker.MethodInvocation#isRoot} one, ie the
+ * unknown caller of the root graph)
*
*
*
@@ -351,7 +352,7 @@
}
public void popInvocation() {
- maxGraphs -= invocationQueue.peekFirst().callee.numberOfMethods();
+ maxGraphs -= invocationQueue.peekFirst().callee().numberOfMethods();
assert graphQueue.size() <= maxGraphs;
invocationQueue.removeFirst();
}
@@ -447,69 +448,4 @@
}
}
- private static class MethodInvocation {
-
- private final InlineInfo callee;
- private final Assumptions assumptions;
- private final double probability;
- private final double relevance;
-
- private int processedGraphs;
-
- public MethodInvocation(InlineInfo info, Assumptions assumptions, double probability, double relevance) {
- this.callee = info;
- this.assumptions = assumptions;
- this.probability = probability;
- this.relevance = relevance;
- }
-
- public void incrementProcessedGraphs() {
- processedGraphs++;
- assert processedGraphs <= callee.numberOfMethods();
- }
-
- public int processedGraphs() {
- assert processedGraphs <= callee.numberOfMethods();
- return processedGraphs;
- }
-
- public int totalGraphs() {
- return callee.numberOfMethods();
- }
-
- public InlineInfo callee() {
- return callee;
- }
-
- public Assumptions assumptions() {
- return assumptions;
- }
-
- public double probability() {
- return probability;
- }
-
- public double relevance() {
- return relevance;
- }
-
- public boolean isRoot() {
- return callee == null;
- }
-
- @Override
- public String toString() {
- if (isRoot()) {
- return "";
- }
- CallTargetNode callTarget = callee.invoke().callTarget();
- if (callTarget instanceof MethodCallTargetNode) {
- ResolvedJavaMethod calleeMethod = ((MethodCallTargetNode) callTarget).targetMethod();
- return MetaUtil.format("Invoke#%H.%n(%p)", calleeMethod);
- } else {
- return "Invoke#" + callTarget.targetName();
- }
- }
- }
-
}
diff -r d5270e276765 -r 947f62e98c07 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/MethodInvocation.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/MethodInvocation.java Thu May 15 15:41:43 2014 +0200
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.phases.common.inlining.walker;
+
+import com.oracle.graal.api.code.Assumptions;
+import com.oracle.graal.api.meta.MetaUtil;
+import com.oracle.graal.api.meta.ResolvedJavaMethod;
+import com.oracle.graal.nodes.CallTargetNode;
+import com.oracle.graal.nodes.java.MethodCallTargetNode;
+import com.oracle.graal.phases.common.inlining.info.InlineInfo;
+
+public class MethodInvocation {
+
+ private final InlineInfo callee;
+ private final Assumptions assumptions;
+ private final double probability;
+ private final double relevance;
+
+ private int processedGraphs;
+
+ public MethodInvocation(InlineInfo info, Assumptions assumptions, double probability, double relevance) {
+ this.callee = info;
+ this.assumptions = assumptions;
+ this.probability = probability;
+ this.relevance = relevance;
+ }
+
+ public void incrementProcessedGraphs() {
+ processedGraphs++;
+ assert processedGraphs <= callee.numberOfMethods();
+ }
+
+ public int processedGraphs() {
+ assert processedGraphs <= callee.numberOfMethods();
+ return processedGraphs;
+ }
+
+ public int totalGraphs() {
+ return callee.numberOfMethods();
+ }
+
+ public InlineInfo callee() {
+ return callee;
+ }
+
+ public Assumptions assumptions() {
+ return assumptions;
+ }
+
+ public double probability() {
+ return probability;
+ }
+
+ public double relevance() {
+ return relevance;
+ }
+
+ public boolean isRoot() {
+ return callee == null;
+ }
+
+ @Override
+ public String toString() {
+ if (isRoot()) {
+ return "";
+ }
+ CallTargetNode callTarget = callee.invoke().callTarget();
+ if (callTarget instanceof MethodCallTargetNode) {
+ ResolvedJavaMethod calleeMethod = ((MethodCallTargetNode) callTarget).targetMethod();
+ return MetaUtil.format("Invoke#%H.%n(%p)", calleeMethod);
+ } else {
+ return "Invoke#" + callTarget.targetName();
+ }
+ }
+}