On Thu, 11 Jul 2024 23:47:51 GMT, Vladimir Ivanov <vliva...@openjdk.org> wrote:

>> src/hotspot/share/oops/klass.cpp line 284:
>> 
>>> 282: // which doesn't zero out the memory before calling the constructor.
>>> 283: Klass::Klass(KlassKind kind) : _kind(kind),
>>> 284:                                _bitmap(SECONDARY_SUPERS_BITMAP_FULL),
>> 
>> I like the idea, but what are the benefits of initializing `_bitmap` 
>> separately from `_secondary_supers`?
>
> Another observation while browsing the code: `_secondary_supers_bitmap` would 
> be a better name. (Same considerations apply to `_hash_slot`.)

This is because the C++ runtime does secondary super cache lookups even before 
the bitmap has been calculated and the hash table sorted. In this case the 
bitmap is zero, so teh search thinks there are no secondary supers. Setting 
_bitmap to SECONDARY_SUPERS_BITMAP_FULL forces a linear search.

I guess there might be a better way to do this. Perhaps a comment is needed?

I agree about `_secondary_supers_bitmap` name.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19989#discussion_r1681410651

Reply via email to