< prev index next >

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

Print this page
*** 29,22 ***
  import java.lang.constant.Constable;
  import java.lang.constant.MethodTypeDesc;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.function.Supplier;
- import java.util.HashMap;
- import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  import java.util.Objects;
  import java.util.Optional;
  import java.util.StringJoiner;
  import java.util.concurrent.ConcurrentHashMap;
  
  import jdk.internal.util.ReferencedKeySet;
  import jdk.internal.util.ReferenceKey;
- import jdk.internal.misc.CDS;
  import jdk.internal.vm.annotation.Stable;
  import sun.invoke.util.BytecodeDescriptor;
  import sun.invoke.util.VerifyType;
  import sun.invoke.util.Wrapper;
  
--- 29,19 ---

*** 392,21 ***
      private static MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
          if (ptypes.length == 0) {
              ptypes = NO_PTYPES; trusted = true;
          }
          MethodType primordialMT = new MethodType(rtype, ptypes);
-         if (archivedMethodTypes != null) {
-             // If this JVM process reads from archivedMethodTypes, it never
-             // modifies the table. So there's no need for synchronization.
-             // See copyInternTable() below.
-             assert CDS.isUsingArchive();
-             MethodType mt = archivedMethodTypes.get(primordialMT);
-             if (mt != null) {
-                 return mt;
-             }
-         }
- 
          MethodType mt = internTable.get(primordialMT);
          if (mt != null)
              return mt;
  
          // promote the object to the Real Thing, and reprobe
--- 389,10 ---

*** 423,11 ***
          mt.form = MethodTypeForm.findForm(mt);
          return internTable.intern(mt);
      }
  
      private static final @Stable MethodType[] objectOnlyTypes = new MethodType[20];
-     private static @Stable HashMap<MethodType,MethodType> archivedMethodTypes;
  
      /**
       * Finds or creates a method type whose components are {@code Object} with an optional trailing {@code Object[]} array.
       * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
       * All parameters and the return type will be {@code Object},
--- 409,10 ---

*** 1394,32 ***
          // Return a new validated MethodType for the rtype and ptypes passed from readObject.
          MethodType mt = ((MethodType[])wrapAlt)[0];
          wrapAlt = null;
          return mt;
      }
- 
-     static HashMap<MethodType,MethodType> copyInternTable() {
-         HashMap<MethodType,MethodType> copy = new HashMap<>();
- 
-         for (Iterator<MethodType> i = internTable.iterator(); i.hasNext(); ) {
-             MethodType t = i.next();
-             copy.put(t, t);
-         }
- 
-         return copy;
-     }
- 
-     // This is called from C code, at the very end of Java code execution
-     // during the AOT cache assembly phase.
-     static void createArchivedObjects() {
-         // After the archivedMethodTypes field is assigned, this table
-         // is never modified. So we don't need synchronization when reading from
-         // it (which happens only in a future JVM process, never in the current process).
-         //
-         // @implNote CDS.isDumpingStaticArchive() is mutually exclusive with
-         // CDS.isUsingArchive(); at most one of them can return true for any given JVM
-         // process.
-         assert CDS.isDumpingStaticArchive();
-         archivedMethodTypes = copyInternTable();
-         internTable.clear();
-     }
  }
--- 1379,6 ---
< prev index next >