Value array element size represented as log2

David Simms david.simms at oracle.com
Tue Oct 2 07:55:55 UTC 2018


What is it you are asking here ? That you want to 20 bytes rather than 
pow 2 aligned ?

A long time ago we discussed that mul was too expensive compared to 
shift, so that encoding is intentional (addressing uses shift)


On 2/10/2018 8:01 a.m., Ioi Lam wrote:
> (Not sure if this has been discussed before. I did a quick JBS search 
> of "valueArrayKlass" but couldn't find anything).
>
> For example, if my VT has 5 integers (20 bytes) it will take up 32 
> bytes inside the array. This seems kind of wasteful, especially when 
> you have larger VT types.
>
> See:
>
> http://hg.openjdk.java.net/valhalla/valhalla/file/e0c13ab0b852/src/hotspot/share/oops/valueArrayKlass.cpp#l182 
>
>
> jint ValueArrayKlass::array_layout_helper(ValueKlass* vk) {
>   BasicType etype = T_VALUETYPE;
>   int atag  = _lh_array_tag_vt_value;
>   int esize = upper_log2(vk->raw_value_byte_size());
>
> klass.hpp:
>
>   // For arrays, layout helper is a negative number, containing four
>   // distinct bytes, as follows:
>   //    MSB:[tag, hsz, ebt, log2(esz)]:LSB
>   // where:
>   //    tag is 0x80 if the elements are oops, 0xC0 if non-oops
>   //    hsz is array header size in bytes (i.e., offset of first element)
>   //    ebt is the BasicType of the elements
>   //    esz is the element size in bytes
>
>




More information about the valhalla-dev mailing list