RFR 8218142 [lworld] C1 support for array covariance for aaload
Frederic Parain
frederic.parain at oracle.com
Wed Feb 6 22:44:06 UTC 2019
Empty value types are not supported by the JVM yet.
Fred
> On Feb 6, 2019, at 17:39, Remi Forax <forax at univ-mlv.fr> wrote:
>
> ----- Mail original -----
>> De: "Karen Kinnear" <karen.kinnear at oracle.com>
>> À: "Srikanth" <srikanth.adayapalam at oracle.com>
>> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
>> Envoyé: Mercredi 6 Février 2019 15:38:04
>> Objet: Re: RFR 8218142 [lworld] C1 support for array covariance for aaload
>
>> Many thanks Srikanth for the covariance/non-covariance support.
>>
>> And the current flags:
>> -XDallowWithFieldOperator: __WithField construct is allowed only when on
>> -XDallowGenericsOverValues: For values to parameterize generics, not for values
>> them
>> selves to be generic
>> -XDnonCovariantValueArrays: For experiments where VT[] is not a subtype of
>> j.l.O[]
>> -XDallowEmptyValues: Allow values that have no state
>>
>> (I agree with getting rid of -XDdisallowValueConstructors if you didn’t do that
>> already)
>>
>> thanks,
>> Karen
>
> Hi Karen,
> is there already a support for empty value type in the VM ??
>
> Rémi
>
>>
>>> On Feb 5, 2019, at 8:34 AM, Srikanth <srikanth.adayapalam at oracle.com> wrote:
>>>
>>> Javac by default allows covariance now.
>>>
>>> Srikanth
>>>
>>> On 05/02/19 5:24 PM, Ioi Lam wrote:
>>>> If I remember correctly, some of them failed to compile or run after changes in
>>>> javac or hotspot-runtime that disallowed covariance. I'll re-enable them and
>>>> see what happens.
>>>>
>>>> Thanks
>>>>
>>>> - Ioi
>>>>
>>>> On 2/5/19 3:06 AM, Tobias Hartmann wrote:
>>>>> 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