Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8078602

Support j.l.i.BoundMethodHandle$Species_* classes unloading

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9
    • core-libs

      BMH$Species_* classes are loaded using bootstrap class loader and hence can't be GCed.

      src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java:
                  // load class
                  final byte[] classFile = cw.toByteArray();
                  InvokerBytecodeGenerator.maybeDump(className, classFile);
                  Class<? extends BoundMethodHandle> bmhClass =
                      //UNSAFE.defineAnonymousClass(BoundMethodHandle.class, classFile, null).asSubclass(BoundMethodHandle.class);
                      UNSAFE.defineClass(className, classFile, 0, classFile.length,
                                         BoundMethodHandle.class.getClassLoader(), null)
                          .asSubclass(BoundMethodHandle.class);

      Consider moving to VM anonymous classes instead. It means all references to Species_* field accessors in LambdaForms should be through method handles and not symbolic references.

            liach Chen Liang
            vlivanov Vladimir Ivanov
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: