RFR: 8180450: secondary_super_cache does not scale well [v14]

Vladimir Ivanov vlivanov at openjdk.org
Fri Apr 12 23:52:45 UTC 2024


On Fri, 12 Apr 2024 23:49:16 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> src/hotspot/share/oops/klass.cpp line 459:
>> 
>>> 457: }
>>> 458: 
>>> 459: uint8_t Klass::compute_home_slot(Klass* k, uintx bitmap) {
>> 
>> This could use some comments, because it's not doing what I would expect, if this should match the asm code.  Here, we never call population_count() on the full bitmap (shift 0), unlike the asm code.
>
> Neither do we do that in assembly code [1] [2]. `Klass::compute_home_slot` is equivalent to what happens in MacroAssembler (modulo some micro-optimizations).
> 
> 
> [1] macroAssembler_x86.cpp:
> ``` 
> ...
>     int shift_count = Klass::SECONDARY_SUPERS_TABLE_MASK - bit;
>     if (shift_count != 0) {
>       salq(r_array_index, shift_count);
>     } else {
>       testq(r_array_index, r_array_index);
>     }
> ...
>   if (bit != 0) {
>     popcntq(r_array_index, r_array_index);
> 
> 
> [2] macroAssembler_aarch64.cpp:
> 
>   if (bit != 0) {
>     shld(vtemp, vtemp, Klass::SECONDARY_SUPERS_TABLE_MASK - bit);
>     cnt(vtemp, T8B, vtemp);
>     addv(vtemp, T8B, vtemp);
>     fmovd(r_array_index, vtemp);

Are you asking about `if (hash > 0) {` check?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18309#discussion_r1563372942


More information about the hotspot-dev mailing list