ConstantDynamic bootstrap specifier resolution
karen.kinnear at oracle.com
Thu Aug 31 20:36:12 UTC 2017
I wanted to clarify my understanding of the context for sharing vs. re-resolving the bootstrap specifier.
Remi, Bjorn and I were discussing this recently and I wanted to follow up with the relevant JVMS text:
188.8.131.52 Bootstrap Specifier Resolution:
(Note: When a bootstrap method is used to resolve a dynamic call site, it is invoked once per distinct call site. When a bootstrap method is used to resolve a dynamic constant, it is called only once perCONSTANT_ConstantDynamic_info structure in the constant pool, not once per instruction which may use this constant.) Next, as part of the continuing resolution of the call site
6.5 invoke dynamic:
The call site specifier is resolved (§184.108.40.206 <https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html#jvms-220.127.116.11>) for this specific dynamic call site to obtain a reference to a java.lang.invoke.MethodHandle instance that will serve as the bootstrap method, a reference to a java.lang.invoke.MethodType instance, and references to static arguments.
Resolution of the symbolic reference of one occurrence of an invokedynamic instruction does not imply that the same symbolic reference is considered resolved for any other invokedynamic instruction.
<>For all other instructions above, resolution of the symbolic reference of one occurrence of an instruction does imply that the same symbolic reference is considered resolved for any other non-invokedynamic instruction.
(The above text implies that the concrete value determined by resolution for a specific invokedynamic instruction is a call site object bound to that specific invokedynamic instruction.)
So today we re-resolve the callsite specifier for EACH BCI.
I presume that an invoke dynamic that has a static argument which is a constant dynamic will use the shared
resolved bootstrap specifier for that constant dynamic, just as other static arguments that reference
constant pool entries such as String, MethodType, MethodHandle, Class use shared resolution based on constant-pool entry.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the valhalla-spec-experts