RFR 8218142 [lworld] C1 support for array covariance for aaload
Tobias Hartmann
tobias.hartmann at oracle.com
Tue Feb 5 11:06:45 UTC 2019
Hi Ioi,
this looks good to me. Should we re-enable the tests marked with "TODO Re-enable if value type
arrays become covariant with object arrays"? C2 already supports array covariance.
Thanks,
Tobias
On 31.01.19 13:52, Ioi Lam wrote:
> http://cr.openjdk.java.net/~iklam/valhalla/8218142-aaload-covariance.v01/
> https://bugs.openjdk.java.net/browse/JDK-8218142
>
> When loading from an array declared as Object[], now the C1 code checks if the array is flattened.
> If so, the loading is done via a runtime call.
>
> Here's an example of the generated code
>
> mov 0x8(%rsi),%eax ; rsi = array
> mov $0x800000000,%r12
> add %r12,%rax ; rax = array klass
> xor %r12,%r12 ; why is this here??
> mov 0xc(%rax),%eax ; layout_helper
> sar $0x1d,%eax
> cmp $0xfffffffd,%eax ; check for Klass::_lh_array_tag_vt_value
> je L_3 ; slow case
>
> L_1 movslq %edx,%rdx ; non-flattened load
> mov 0x10(%rsi,%rdx,4),%eax
> shl $0x3,%rax
> L_2 ....
>
> L_3 mov %rsi,0x8(%rsp) ; LoadFlattenedArrayStub slow case
> mov %rdx,(%rsp)
> callq 0x00007fe6489c8840 ; runtime_call load_flattened_array
> jmpq L_2
>
>
> The code is pretty big and sub-optimal. My plan is to also get aastore working first, and then
> optimize.
>
> One possibility is to check if the array is actually an Object[] array. That should help with the
> erased generic types.
>
> mov 0x8(%rsi),%eax ; rsi = array
> + cmp $0x00001234, %eax ; compressed klass for [Ljava/lang/Object;
> + je L_1 ; go to non-flattened load
> mov $0x800000000,%r12
>
>
> Thanks
> - Ioi
More information about the valhalla-dev
mailing list