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.
- csr of
-
JDK-8186046 Minimal ConstantDynamic support
- Resolved