JEP 303 and ConstantDynamic

Hontvári Attila attila at
Tue Aug 8 09:21:23 UTC 2017

2017-08-07 19:56 keltezéssel, Paul Sandoz írta:
> On 6 Aug 2017, at 07:01, Hontvári Attila <attila at 
> <mailto:attila at>> wrote:
>> On 2017. 08. 04. 4:14, John Rose wrote:
>>> On Aug 3, 2017, at 5:57 AM, Hontvári Attila <attila at 
>>> <mailto:attila at> <mailto:attila at>> wrote:
>>>> But as I understand this, the data of the instances of the 
>>>> intrinsic types don't have to be known at compile-time; they only 
>>>> have to be known and constant at run-time.
>>> That's not true.  We need to be able to fold true constant 
>>> expressions into
>>> bootstrap method arguments and similar class file structures.
>> I originally thought that almost anything that references any CP 
>> entry can refer to a CONSTANT_Dynamic, but according to JDK-8177279 
>> only an ldc or a BootstrapMethods table can refer to a condy item.
> Condy is about dynamic linking of *constant values*, they bubble up 
> onto the stack. It does not make sense for a say a putfield 
> instruction to refer to anything other than a symbolic reference to a 
> field.
Sure, I confused its (intentional) limits with CP-patching in the 
"Isolated Methods" JEP, which can patch any constant item.
>> Would it be possible to make the invokedynamic instruction to handle 
>> a CONSTANT_Dynamic (with type=BootstrapSpecifier) in place of a 
>> CONSTANT_InvokeDynamic? Or would it still not solve all the use cases 
>> of the JEP?
> IIUC your question (an invokedynamic referring to a CONSTANT_Dynamic 
> entry?) I don’t see how that would help.
It would enable using Intrinsics.invokedynamic without compile-time 
constants. The user specifies an expression that creates the 
BootstrapSpecifier, the compiler extracts that expression to a condy 
BSM, and emits an invokedynamic that refers to a CONSTANT_Dynamic with 
the BootstrapSpecifier-producing expression as its BSM.

So the user could write something like this:
     __CONDY(l->new BootstrapSpecifier(l.findStatic(X.class, "y", 

> Paul.
>>> (Remi uses bytecode transforms to approximate the real thing more 
>>> closely.)
>>> — John

More information about the valhalla-dev mailing list