Adopting JEP 303 (Intrinsics for LDC and INVOKEDYNAMIC) into Amber

Brian Goetz brian.goetz at
Mon Apr 17 20:57:28 UTC 2017

[ moving to spec list ]

> It's not clear in the current draft, but the compiler should fail if it can not create a const value for a whole expression send as arguments of ldc or indy.

Correct.   It's fine to create a Constable with non-constant arguments:

     ClassConstant cc = ClassConstant.of(someNonConstantFunction())

but if the compiler can't see through the invocation to fold the result, 
its an error to try to intrinsify:

     Intrinsics.ldc(cc)  // error, not a constant

If the inputs are constant but refer to names not locatable via the 
compile-time class path, the reasonable choices are warning or error.

     ClassConstant cc = ClassConstant.of("Lcom/foo/Blarglewooflebark;")
     Intrinsics.ldc(cc)  // warning, not known 
at compile time

I lean towards warning, because it is imaginable one might want to LDC / 
indy against dynamically generated classes.

> and i still think that the whole Constable interface should not be visible from the user, only Constantables and Intrinsics should be visible.

If the Constable type is not visible, then we can't constrain the 
arguments of ldc / indy to be Constable, which is a useful thing (it 
will keep people from making mistakes.)

> also all intermediary objects should be value types, no ?

Value-based, yes.  We don't have value types yet :)

More information about the amber-spec-experts mailing list