RFR: 8344445: MethodCounters don't need a vptr

Kim Barrett kbarrett at openjdk.org
Tue Nov 19 08:16:45 UTC 2024


On Tue, 19 Nov 2024 02:55:32 GMT, Dean Long <dlong at openjdk.org> wrote:

>> This is a somewhat trivial change to make MethodCounters inherit from MetaspaceObj so that they don't have any virtual functions (and vptrs).  They're just a bunch of ints.
>> 
>> Tested with tier1-4.
>
> src/hotspot/share/oops/methodCounters.hpp line 61:
> 
>> 59:   void deallocate_contents(ClassLoaderData* loader_data) {}
>> 60: 
>> 61:   void metaspace_pointers_do(MetaspaceClosure* it) { return; }
> 
> Does it change the behavior if we remove this along with
> ` it->push(&_method_counters);`
> in Method::metaspace_pointers_do?

That would violate the contract for MetaspaceObj.
https://github.com/openjdk/jdk/blob/499186be0fa70dba4b008cdafb72aba6addb2965/src/hotspot/share/memory/allocation.hpp#L247-L261

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22220#discussion_r1847855702


More information about the hotspot-dev mailing list