Flat Array null check issue - Re: RFR(L) Valhalla support for AArch64 v.05
Roland Westrelin
rwestrel at redhat.com
Tue Jul 9 08:46:47 UTC 2019
> GetNullFreeProperty in compile.cpp
>
>
> Interpreter in a similar place uses the code (below):
>
> ldrw(dst, Address(src, oopDesc::klass_offset_in_bytes()));
> asrw(dst, dst, oopDesc::narrow_storage_props_shift);
>
> andr(dst, dst, ArrayStorageProperties::null_free_value);
> cbnz(dst, is_null_free_array);
>
>
> but C2 does:
>
> # LoadNKlass node
> ldrw $dst, $mem
> andr $dst, $dst, oopDesc::compressed_klass_mask()
>
> #AndINode
> andr $dst, 1 << (oopDesc::narrow_storage_props_shift +
> ArrayStorageProperties::null_free_bit);
>
> # cmpI
> cbz(temp_reg, is_null_free_array);
>
>
> Is it correct?
> Do you have any ideas how to go forward with it?
The klass pointer of a null free array is tagged with property bits
(there are 2 property bits: null free and flattened). So before we use
the klass pointer as an actual pointer we need to mask out the property
bits. That's what:
andr $dst, $dst, oopDesc::compressed_klass_mask()
does.
To check for a null free array, we need to test for the null free
property bit on the unmasked klass pointer.
Is the sequence above the actual code generated by c2? It would then
seem that we test for the property bit on the already masked klass
pointer.
Roland.
More information about the valhalla-dev
mailing list