On Fri, 13 Sep 2024 09:31:39 GMT, Stefan Karlsson <[email protected]> wrote:
>> Roman Kennke has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Hide log timestamps in test to prevent false failures
>
> src/hotspot/share/oops/oop.hpp line 363:
>
>> 361: return sizeof(markWord) + sizeof(Klass*);
>> 362: }
>> 363: }
>
> Not a strong request for this PR, but there are many places that calculates
> almost the same thing, and it might be good to limit the number of places we
> do similar calculations.
>
> I'm wondering if it wouldn't be better for readability to structure the code
> as follows:
>
> static int header_size_in_bytes() {
> if (UseCompactObjectHeaders) {
> return sizeof(markWord);
> } else if (UseCompressedClassPointers) {
> return sizeof(markWord) + sizeof(narrowKlass);
> } else {
> return sizeof(markWord) + sizeof(Klass*);
> }
> }
>
> // Size of object header, aligned to platform wordSize
> static int header_size() {
> return align_up(header_size_in_bytes(), HeapWordSize) / HeapWordSize;
> }
> ...
> static int base_offset_in_bytes() {
> return header_size_in_bytes();
> }
Ok. I filed: https://bugs.openjdk.org/browse/JDK-8340118 for now, let's see if
I can sort this out before integrating this PR.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20677#discussion_r1758825458