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

Minimal ConstantDynamic support

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P2 P2
    • 11
    • hotspot
    • None
    • minimal
    • Class file construct
    • SE

      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.

            dlsmith Dan Smith
            psandoz Paul Sandoz
            Paul Sandoz
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: