< prev index next >

src/java.base/share/classes/java/lang/invoke/LambdaForm.java

Print this page
*** 23,10 ***
--- 23,11 ---
   * questions.
   */
  
  package java.lang.invoke;
  
+ import jdk.internal.misc.CDS;
  import jdk.internal.perf.PerfCounter;
  import jdk.internal.vm.annotation.DontInline;
  import jdk.internal.vm.annotation.Hidden;
  import jdk.internal.vm.annotation.Stable;
  import sun.invoke.util.Wrapper;

*** 1154,12 ***
              if (member != null)
                  return member.hashCode();
              return super.hashCode();
          }
  
!         static final MethodType INVOKER_METHOD_TYPE =
!             MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
  
          private static MethodHandle computeInvoker(MethodTypeForm typeForm) {
              typeForm = typeForm.basicType().form();  // normalize to basic type
              MethodHandle mh = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
              if (mh != null)  return mh;
--- 1155,27 ---
              if (member != null)
                  return member.hashCode();
              return super.hashCode();
          }
  
!         static final MethodType INVOKER_METHOD_TYPE;
!         private static @Stable MethodType[] archivedObjects;
+ 
+         static {
+             CDS.initializeFromArchive(NamedFunction.class);
+             if (archivedObjects != null) {
+                 INVOKER_METHOD_TYPE = archivedObjects[0];
+             } else {
+                 INVOKER_METHOD_TYPE =
+                     MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
+             }
+         }
+ 
+         static void dumpSharedArchive() {
+             archivedObjects = new MethodType[1];
+             archivedObjects[0] = INVOKER_METHOD_TYPE;
+         }
  
          private static MethodHandle computeInvoker(MethodTypeForm typeForm) {
              typeForm = typeForm.basicType().form();  // normalize to basic type
              MethodHandle mh = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
              if (mh != null)  return mh;
< prev index next >