Value array element size represented as log2
John Rose
john.r.rose at oracle.com
Tue Oct 2 06:47:57 UTC 2018
I support this; I would even support burning a couple more bits to put in a
multiplier of 1/3/5/7. This would reduce the fragmentation from 0-50-100%
to 0-13-25%.
On Oct 1, 2018, at 11:01 PM, Ioi Lam <ioi.lam at oracle.com> 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