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

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

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd_minor
    • Component/s: core-libs
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                vlivanov Vladimir Ivanov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: