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:

Proposed http://cr.openjdk.java.net/~jrose/jvm/condy-jvms-2017-0620.html

5.4.3.6 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


JVMS 8/9:

6.5 invoke dynamic:
The call site specifier is resolved (ยง5.4.3.6 
<https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html#jvms-5.4.3.6>) 
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.

5.4.3 Resolution:
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.

thanks,
Karen

Reply via email to