On Thu, 30 Apr 2026 01:31:52 GMT, David Holmes <[email protected]> wrote:

>> Casper Norrbin has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   feedback fixes
>
> src/hotspot/share/memory/heapInspection.cpp line 614:
> 
>> 612:     InstanceKlass* ik = InstanceKlass::cast(klass);
>> 613:     int tab = 1;
>> 614:     st->print_cr("Class %s [@%s]:", klass->external_name(),
> 
> Doesn't it suffice to just make this change? If we convert to Symbol it seems 
> more efficient than using `strcmp` (though I confess I'm not clear what this 
> closure is actually doing and what set of classes it potentially generates).

I agree using `strcmp` is not very efficient, since we iterate the full 
`KlassInfoTable`. We still need to keep the external name as the argument 
however, but I reverted most changes for a different design. Now, we instead 
convert user input from dotted to slash form once, then use the same logic as 
before (probe the symbol table, then match on `klass->name()`). That way, we 
don't have to worry about comparing strings and we avoid lots of allocations 
from `external_name()`

As a side effect, this now also works on both internal and external names, as 
slashes would be left untouched.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2375#discussion_r3166934053

Reply via email to