changeset 4195:7703a9f4769f

Removed inlining decisions from CRI.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 03 Jan 2012 15:34:46 +0100
parents d815dbbf3cad
children ae261db78f68
files graal/com.oracle.max.cri/src/com/sun/cri/ri/RiRuntime.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotRuntime.java
diffstat 3 files changed, 5 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ri/RiRuntime.java	Tue Jan 03 15:30:57 2012 +0100
+++ b/graal/com.oracle.max.cri/src/com/sun/cri/ri/RiRuntime.java	Tue Jan 03 15:34:46 2012 +0100
@@ -33,32 +33,6 @@
 public interface RiRuntime {
 
     /**
-     * Checks whether the specified method is required to be inlined (for semantic reasons).
-     * If this method returns true, then the null-check of the receiver emitted during
-     * inlining is omitted.
-     *
-     * @param method the method being called
-     * @return {@code true} if the method must be inlined; {@code false} to let the compiler
-     * use its own heuristics
-     */
-    boolean mustInline(RiResolvedMethod method);
-
-    /**
-     * Checks whether the specified method must not be inlined (for semantic reasons).
-     * @param method the method being called
-     * @return {@code true} if the method must not be inlined; {@code false} to let the compiler
-     * use its own heuristics
-     */
-    boolean mustNotInline(RiResolvedMethod method);
-
-    /**
-     * Checks whether the specified method cannot be compiled.
-     * @param method the method being called
-     * @return {@code true} if the method cannot be compiled
-     */
-    boolean mustNotCompile(RiResolvedMethod method);
-
-    /**
      * Offset of the lock within the lock object on the stack.
 
      * Note: superseded by sizeOfLockData() in Graal.
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Tue Jan 03 15:30:57 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Tue Jan 03 15:34:46 2012 +0100
@@ -226,7 +226,7 @@
         MethodCallTargetNode callTarget = invoke.callTarget();
 
         if (callTarget.invokeKind() == InvokeKind.Special || callTarget.targetMethod().canBeStaticallyBound()) {
-            if (checkTargetConditions(callTarget.targetMethod(), runtime)) {
+            if (checkTargetConditions(callTarget.targetMethod())) {
                 double weight = callback == null ? 0 : callback.inliningWeight(parent, callTarget.targetMethod(), invoke);
                 return new ExactInlineInfo(invoke, weight, level, callTarget.targetMethod());
             }
@@ -236,7 +236,7 @@
             RiResolvedType exact = callTarget.receiver().exactType();
             assert exact.isSubtypeOf(callTarget.targetMethod().holder()) : exact + " subtype of " + callTarget.targetMethod().holder();
             RiResolvedMethod resolved = exact.resolveMethodImpl(callTarget.targetMethod());
-            if (checkTargetConditions(resolved, runtime)) {
+            if (checkTargetConditions(resolved)) {
                 double weight = callback == null ? 0 : callback.inliningWeight(parent, resolved, invoke);
                 return new ExactInlineInfo(invoke, weight, level, resolved);
             }
@@ -258,7 +258,7 @@
         }
         RiResolvedMethod concrete = holder.uniqueConcreteMethod(callTarget.targetMethod());
         if (concrete != null) {
-            if (checkTargetConditions(concrete, runtime)) {
+            if (checkTargetConditions(concrete)) {
                 double weight = callback == null ? 0 : callback.inliningWeight(parent, concrete, invoke);
                 return new AssumptionInlineInfo(invoke, weight, level, holder, concrete);
             }
@@ -269,7 +269,7 @@
             if (GraalOptions.InlineWithTypeCheck) {
                 // type check and inlining...
                 concrete = profile.types[0].resolveMethodImpl(callTarget.targetMethod());
-                if (concrete != null && checkTargetConditions(concrete, runtime)) {
+                if (concrete != null && checkTargetConditions(concrete)) {
                     double weight = callback == null ? 0 : callback.inliningWeight(parent, concrete, invoke);
                     return new TypeGuardInlineInfo(invoke, weight, level, concrete, profile.types[0], profile.probabilities[0]);
                 }
@@ -315,7 +315,7 @@
         return true;
     }
 
-    private static boolean checkTargetConditions(RiMethod method, GraalRuntime runtime) {
+    private static boolean checkTargetConditions(RiMethod method) {
         if (!(method instanceof RiResolvedMethod)) {
             if (GraalOptions.TraceInlining) {
                 TTY.println("not inlining %s because it is unresolved", method.toString());
@@ -323,12 +323,6 @@
             return false;
         }
         RiResolvedMethod resolvedMethod = (RiResolvedMethod) method;
-        if (runtime.mustNotInline(resolvedMethod)) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because the CRI set it to be non-inlinable", methodName(resolvedMethod));
-            }
-            return false;
-        }
         if (Modifier.isNative(resolvedMethod.accessFlags())) {
             if (GraalOptions.TraceInlining) {
                 TTY.println("not inlining %s because it is a native method", methodName(resolvedMethod));
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotRuntime.java	Tue Jan 03 15:30:57 2012 +0100
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotRuntime.java	Tue Jan 03 15:34:46 2012 +0100
@@ -52,8 +52,6 @@
     final HotSpotRegisterConfig regConfig;
     final HotSpotRegisterConfig globalStubRegConfig;
     private final Compiler compiler;
-    // TODO(ls) this is not a permanent solution - there should be a more sophisticated compiler oracle
-    private HashSet<RiResolvedMethod> notInlineableMethods = new HashSet<>();
 
     public HotSpotRuntime(GraalContext context, HotSpotVMConfig config, Compiler compiler) {
         this.context = context;
@@ -140,28 +138,6 @@
     }
 
     @Override
-    public boolean mustInline(RiResolvedMethod method) {
-        return false;
-    }
-
-    @Override
-    public boolean mustNotCompile(RiResolvedMethod method) {
-        return false;
-    }
-
-    @Override
-    public boolean mustNotInline(RiResolvedMethod method) {
-        if (notInlineableMethods.contains(method)) {
-            return true;
-        }
-        return Modifier.isNative(method.accessFlags());
-    }
-
-    public void makeNotInlineable(RiResolvedMethod method) {
-        notInlineableMethods.add(method);
-    }
-
-    @Override
     public Object registerCompilerStub(CiTargetMethod targetMethod, String name) {
         return HotSpotTargetMethod.installStub(compiler, targetMethod, name);
     }