8075263: MHI::checkCustomized isn't eliminated for inlined MethodHandles
authorvlivanov
Fri, 20 Mar 2015 11:42:31 -0700
changeset 30336 36774c81a366
parent 29610 2cc3189821f7
child 30337 5d0420f699df
8075263: MHI::checkCustomized isn't eliminated for inlined MethodHandles Reviewed-by: jrose, kvn
jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Thu Mar 19 15:00:51 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java	Fri Mar 20 11:42:31 2015 -0700
@@ -394,6 +394,7 @@
     @ForceInline
     void checkCustomized(Object o) {
         MethodHandle mh = (MethodHandle)o;
+        if (MethodHandleImpl.isCompileConstant(mh)) return;
         if (mh.form.customized == null) {
             maybeCustomize(mh);
         }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Mar 19 15:00:51 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Mar 20 11:42:31 2015 -0700
@@ -722,6 +722,13 @@
         return result;
     }
 
+    // Intrinsified by C2. Returns true if obj is a compile-time constant.
+    @LambdaForm.Hidden
+    static
+    boolean isCompileConstant(Object obj) {
+        return false;
+    }
+
     static
     MethodHandle makeGuardWithTest(MethodHandle test,
                                    MethodHandle target,