RFR (XS): [MVT] Support Q-types in MHs.constant()

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Wed Jul 12 12:54:19 UTC 2017


Though it looks attractive at first, I don't think it'll take us too far.

j.l.i API is full of method handle combinators which should properly 
handle DVTs. If there's a separate place for DVT-capable combinators, 
then the combinators (all of them?) should be duplicated there and, 
moreover, special checks should be added across j.l.i API to reject any 
inputs which require DVT support. It looks like an overkill from both 
API & implementation perspective.

IMO there's a better alternative: only keep MVT-specific API 
experimental (VCC->DVT, withers, etc) and enhance j.l.i implementation 
to support DVT-capable operations. It doesn't require any public API 
changes and enables safe removal of MVT-specific API. If there's no way 
for the user to get a DVT class, then there'll be no way to create any 
DVT-capable method handle.

Best regards,
Vladimir Ivanov

On 7/12/17 3:29 AM, Maurizio Cimadamore wrote:
> Looks good
> 
> Moving forward I have a concern on adding more capabilities to 
> MethodHandles/MethodHandles.lookup.
> 
> On the one hand it's cool that we're trying to tweak things so that they 
> 'just work' - that is, let devs use existing MH capabilities to 
> create/combine value-based handles.
> 
> On the other hand, this makes the surface area of MVT very blurry, as it 
> becomes harder to see where standard JDK ends and where MVT begins. This 
> could be problematic if, e.g. at some point we needed to move all the 
> MVT stuff under an experimental incubator module.
> 
> So, I'm starting to wonder if we shouldn't just add a ValueHandles 
> class, similar to MethodHandles.
> 
> In other words - have a ValueHandles class which contains the relevant 
> methods from ValueType plus the ones we've tweaked inside MethodHandles. 
> And have a ValueHandles.Lookup class to perform getter and wither lookup 
> on values.
> 
> What do you think?
> 
> Maurizio
> 
> 
> On 11/07/17 18:43, Vladimir Ivanov wrote:
>> http://cr.openjdk.java.net/~vlivanov/valhalla/8184184/webrev.00/
>>
>> Support Q-types in MHs.constant().
>>
>> Testing: jdk/test/valhalla/mvt/
>>
>> Best regards,
>> Vladimir Ivanov


More information about the valhalla-dev mailing list