vwithfield and ValueType.findWither

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Jun 15 09:36:11 UTC 2017



On 15/06/17 09:46, John Rose wrote:
> On Jun 14, 2017, at 2:20 PM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
>> Another possible story is that we always create values through the VCC constructor, and then unbox. If we think we're happy with that, that might be a fine choice too.
> That's not a bad story for the JIT with aggressive scalarization,
> and was my first idea about this, but it is painful in the interpreter.
>
In which ways it's bad for the interpreter? Note that the current 
implementation of the 'modified' findWither will do just that:

* box incoming value
* set field (with Unsafe.putXYZ)
* unbox resulting reference back to a value

So, it seems to me that, to set 5 fields, the above idiom will do 
box/unbox 5 times, while if we just create a VCC with the fields we want 
and then unbox, that's just one unboxing step.

What am I missing?

Maurizio


More information about the valhalla-dev mailing list