On Wed, 17 Jul 2024 18:46:11 GMT, Vladimir Ivanov <vliva...@openjdk.org> wrote:
>> 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. > > Now it starts to sound concerning... `Klass::set_secondary_supers()` > initializes both `_secondary_supers` and `_bitmap` which implies that > `Klass::is_subtype_of()` may be called on not yet initialized Klass. It > that's the case, it does look like a bug on its own. How is it expected to > work when `_secondary_supers` hasn't been set yet? On a second thought the following setter may be the culprit: void Klass::set_secondary_supers(Array<Klass*>* secondaries) { assert(!UseSecondarySupersTable || secondaries == nullptr, ""); set_secondary_supers(secondaries, SECONDARY_SUPERS_BITMAP_EMPTY); } It should be adjusted to set `SECONDARY_SUPERS_BITMAP_FULL` instead. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19989#discussion_r1681581587