ValueType.findConstructor

Paul Sandoz paul.sandoz at oracle.com
Mon Jun 26 17:46:48 UTC 2017


Hi Maurizio,

It’s not naive, that code reflected a reduction on some hacking in an attempt to also explore construction with a default constructor (there is also a disconnect here between the VCC with a constructor and using vdefault with DVT). I think we should keep the constructor method and implement it as you suggest with a combinator. I’ll send out a simplified webrev.

Separately, in my enthusiasm i may be going down a rabbit hole regarding re-construction, arguably it’s not in the spirit of minimal. Still at some point i think we should explore this notion of a more extensible wither for value types (but it also seems application to ref/data classes too).

Paul.

> On 23 Jun 2017, at 16:31, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
> 
> Maybe a naive question - but do you need method handle builder (and extra bytecode spinning) for constructor? Can't we combine the result of findConstructor on the boxed class with the vunbox MH?
> 
> Maurizio
> 
> 
> On 23/06/17 23:17, Paul Sandoz wrote:
>> Hi,
>> 
>> This adds a findConstructor method to ValueType:
>> 
>>   http://cr.openjdk.java.net/~psandoz/valhalla/find-constructor/webrev/ <http://cr.openjdk.java.net/~psandoz/valhalla/find-constructor/webrev/>
>> 
>>>> 
>> Next steps are to investigate re-construction: taking an existing value, one or more explicit component values, and constructing a new value by merging the implicit components of the existing value and the explicit component values. It’s a bit like one or more vwithfield calls but would go through a constructor and perform argument checks etc.
>> 
>> The tricky aspect is reliably extracting out the component values and in a known order so they can be passed as arguments to the VCC constructor.
>> 
>> For MVT i think we can define something useful even if it is a little fragile, so was to make construction easier.
>> 
>> (There are also potential short-cuts if there is no explicit constructor and fields are either initialized to default or some other values, as i think vnew could be used directly for construction).
>> 
>> Paul.
> 



More information about the valhalla-dev mailing list