Adapter sharing is broken with -XX:+ValueTypePassFieldsAsArgs

Tobias Hartmann tobias.hartmann at oracle.com
Mon Mar 27 14:10:16 UTC 2017


Hi Roland,

thanks for looking at this!

On 27.03.2017 15:43, Roland Westrelin wrote:
> Why the change lines 2254-2281?
> You skip over the T_VALUETYPE/T_VOID markers, right?

Yes, I check for the T_VALUETYPE/T_VOID scope to avoid widening when we are passing the fields of a value type (see 'is_valuetype' argument of adapter_encoding).

> I don't think that's correct. With your change:
> 
> class MyValue1 {
>     int f1;
>     long f2;
> }
> 
> class MyValue3 {
>     int f1;
> }
> 
> class MyValue4 {
>     long f2;
> }
> 
> class MyValue2 {
>     MyValue3 f1;
>     MyValue4 f2;
> }
> 
> MyValue1 and MyValue2 would share the same adapters but that would only
> be correct if they have the same layout (because now adapters embed hard
> coded offsets for fields). Is it true? Is it guaranteed that it doesn't
> change in the future?

Right, that's not intended and probably not guaranteed in the future.

I tried to remove the 'continue' statements but that triggers the "failed: code must match" assert again. Investigating.

Thanks,
Tobias



More information about the valhalla-dev mailing list