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

Minimal ConstantDynamic support

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P2
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Class file construct
    • Scope:
      SE

      Description

      Summary

      Implement JEP 309 by properly parsing and resolving new CONSTANT_Dynamic constants in JVM class files used by Hotspot.

      The draft VM specification may be found by the Change Review Request (CSR) issue JDK-8189199 that is associated with the main development issue.

      Problem

      Static arguments to bootstrap methods are drawn from a very limited language: the arguments can only be primitive numbers, strings, Classes, MethodHandles, or MethodTypes. Many applications would be helped by greater expressive freedom.

      Some applications of invokedynamic consist merely of loading a single, cached value (a ConstantCallSite wrapping a MethodHandles.constant). It would be more natural in these cases to ldc the value directly.

      Solution

      A new CONSTANT_Dynamic constant pool entry uses a bootstrap method to dynamically compute a value at resolution time. It shares much of the structure and behavior of invokedynamic call site resolution, but uses a field descriptor in its NameAndType, and represents a value of the given type rather than a CallSite.

      Specification

      Updates to the Java Virtual Machine Specification are attached. Some small changes may be forthcoming before finalizing this proposal.

      Some descriptive changes to the java.lang.invoke API documentation will also be attached before finalizing.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dlsmith Dan Smith
                Reporter:
                psandoz Paul Sandoz (Inactive)
                Reviewed By:
                Paul Sandoz (Inactive)
              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: