RFR: 8337217: Port VirtualMemoryTracker to use VMATree [v32]
Johan Sjölen
jsjolen at openjdk.org
Fri Feb 28 09:47:14 UTC 2025
On Thu, 27 Feb 2025 17:52:19 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
>> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>>
>> removed UseFlagInPlace test.
>
> src/hotspot/share/nmt/memTracker.hpp line 142:
>
>> 140: if (addr != nullptr) {
>> 141: NmtVirtualMemoryLocker nvml;
>> 142: VirtualMemoryTracker::Instance::add_reserved_region((address)addr, size, stack, mem_tag);
>
> I do not like:
>
> `VirtualMemoryTracker::Instance::add_reserved_region`
>
> with the `Instance` being repeated over and over.
>
> I'd prefer `VirtualMemoryTracker::add_reserved_region` and have `Instance` be impl detail inside.
The wordiness is a bit annoying. The reason that we do this is to separate the global static instance from the implementation, so that we can have many `VMT`s when testing (this is very useful). Do you have a concrete way we can refactor this such that we retain the possibility of having many VMTs and one static instance, whilst reducing the wordiness when using the code? Can this refactoring wait until after integration, as we have more classes following the same pattern that'd need to be refactored?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20425#discussion_r1975118055
More information about the hotspot-dev
mailing list