RFR: 8305895: Implement JEP 450: Compact Object Headers (Experimental) [v14]

Roman Kennke rkennke at openjdk.org
Fri Sep 13 13:03:16 UTC 2024


On Fri, 13 Sep 2024 09:31:39 GMT, Stefan Karlsson <stefank at openjdk.org> 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


More information about the serviceability-dev mailing list