changeset 4296:d089b71a5237

Add possibility to disable inlining for specific methods. Clear the HotSpotMethodResolvedImpl constructor, for it's never called.
author Andreas Woess <andreas.woess@jku.at>
date Wed, 18 Jan 2012 16:21:54 +0100
parents 1e3ecb08767d
children a3229b37b04c
files graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedMethod.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/ri/HotSpotMethodResolvedImpl.java src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalJavaAccess.hpp
diffstat 5 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedMethod.java	Wed Jan 18 15:04:03 2012 -0800
+++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiResolvedMethod.java	Wed Jan 18 16:21:54 2012 +0100
@@ -225,4 +225,9 @@
      * @see Method#getGenericReturnType()
      */
     Type getGenericReturnType();
+
+    /**
+     * @return {@code true} if this method can be inlined
+     */
+    boolean canBeInlined();
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Wed Jan 18 15:04:03 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Wed Jan 18 16:21:54 2012 +0100
@@ -329,6 +329,12 @@
             }
             return false;
         }
+        if (!resolvedMethod.canBeInlined()) {
+            if (GraalOptions.TraceInlining) {
+                TTY.println("not inlining %s because it is marked non-inlinable", methodName(resolvedMethod));
+            }
+            return false;
+        }
         return true;
     }
 
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Wed Jan 18 15:04:03 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Wed Jan 18 16:21:54 2012 +0100
@@ -56,13 +56,10 @@
     private Map<Object, Object> compilerStorage;
     private RiResolvedType holder;
     private byte[] code;
+    private boolean canBeInlined;
 
     private HotSpotMethodResolvedImpl() {
         super(null);
-        codeSize = -1;
-        accessFlags = -1;
-        maxLocals = -1;
-        maxStackSize = -1;
         throw new IllegalStateException("this constructor is never actually called, because the objects are allocated from within the VM");
     }
 
@@ -306,4 +303,13 @@
             return null;
         }
     }
+
+    @Override
+    public boolean canBeInlined() {
+        return canBeInlined;
+    }
+
+    public void setCanBeInlined(boolean canBeInlined) {
+        this.canBeInlined = canBeInlined;
+    }
 }
--- a/src/share/vm/graal/graalCompiler.cpp	Wed Jan 18 15:04:03 2012 -0800
+++ b/src/share/vm/graal/graalCompiler.cpp	Wed Jan 18 16:21:54 2012 +0100
@@ -270,6 +270,7 @@
   HotSpotMethodResolved::set_accessFlags(obj, method->access_flags().as_int());
   HotSpotMethodResolved::set_maxLocals(obj, method->max_locals());
   HotSpotMethodResolved::set_maxStackSize(obj, method->max_stack());
+  HotSpotMethodResolved::set_canBeInlined(obj, true);
   
   method->set_graal_mirror(obj());
   return obj();
--- a/src/share/vm/graal/graalJavaAccess.hpp	Wed Jan 18 15:04:03 2012 -0800
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Wed Jan 18 16:21:54 2012 +0100
@@ -67,6 +67,7 @@
     int_field(HotSpotMethodResolved, accessFlags)                                       \
     int_field(HotSpotMethodResolved, maxLocals)                                         \
     int_field(HotSpotMethodResolved, maxStackSize)                                      \
+    boolean_field(HotSpotMethodResolved, canBeInlined)                                  \
   end_class                                                                             \
   start_class(HotSpotType)                                                              \
     oop_field(HotSpotType, name, "Ljava/lang/String;")                                  \