RFR: 8267303: Replace MinObjectAlignmentSize usages for non-Java heap objects
Ioi Lam
iklam at openjdk.java.net
Tue Jul 6 17:34:46 UTC 2021
On Tue, 6 Jul 2021 16:48:34 GMT, Yumin Qi <minqi at openjdk.org> wrote:
>> Oh that might be a good guess. I thought it was just some way to randomize the address some more. @yminqi or @iklam would know since it was added with JDK-8130115.
>
> This address_bits here is for using 'this' to join the calculation of identity_hash. I don't think it matters which bits are used here, but we need keep consistency with SA. If you changed here, you need to change Symbol.java too. Note in 32 bits, LogBytesPerWord is different from LogMinObjAlignmentInBytes (it is 3 for both 32 and 64 its).
I agree that the `+3` can be replaced with `log2(sizeof(Symbol))`. If I remember correctly, the intention was to avoid getting the same value for `(((uintptr_t)this) >> LogBytesPerWord) & 0x07)`.
However, this may not be necessary. The Symbols are of variable sizes (the string body is allocated as part of the Symbol). I write a program to analyze the distribution of the above expression for 18487 Symbols allocated for running a HelloWorld Java program. While it's not perfectly distributed, it may be good enough.
Perhaps we can get rid of the `+ 3` or `+ log2(sizeof(Symbol))` in a separate RFE?
0: +++++++
1: +++++++++++++++++++++++++++++++++++++++
2: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3: ++++++++++++++++++++++++++++++++++++++++++++++
4: ++++++++++++++++++++++++++++++
5: ++++++++++++++++++++++
6: +++++++++++++++
7: ++++++++++
0: 571
1: 3152
2: 4659
3: 3721
4: 2467
5: 1801
6: 1276
7: 838
-------------
PR: https://git.openjdk.java.net/jdk/pull/4675
More information about the hotspot-dev
mailing list