RFR: 8366241: NMT: Consolidate [Virtual/Committed/Reserved]Regions into one structure [v6]
Afshin Zafari
azafari at openjdk.org
Tue Nov 25 10:07:47 UTC 2025
On Thu, 20 Nov 2025 13:05:52 GMT, Paul Hübner <phubner at openjdk.org> wrote:
>> Afshin Zafari has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains nine commits:
>>
>> - Merge remote-tracking branch 'origin/master' into _8366241_nmt_consolidate_structures
>> - fixes
>> - Merge remote-tracking branch 'origin/master' into _8366241_nmt_consolidate_structures
>> - Merge remote-tracking branch 'origin/master' into _8366241_nmt_consolidate_structures
>> - master merge fix
>> - Merge remote-tracking branch 'origin/master' into _8366241_nmt_consolidate_structures
>> - after merge with 8366363.
>> - Merge remote-tracking branch 'origin/master' into _8366241_nmt_consolidate_structures
>> - 8366241: NMT: Consolidate [Virtual/Committed/Reserved]Regions into one structure
>
> src/hotspot/share/nmt/virtualMemoryTracker.hpp line 217:
>
>> 215: }
>> 216:
>> 217: VirtualMemoryRegion(address addr, size_t size, const NativeCallStack& stack, bool committed) :
>
> Correct me if I'm wrong but is this `committed` only ever true? And then we use the presence of this constructor parameter to decide whether we are creating a committed or a reserved region?
>
> If so, at the very least we should assert that committed is true. But I think it would be nicer to make the constructor private and make some static factory methods akin to `VirtualMemoryRegion::committed` and `VirtualMemoryRegion::reserved`.
You are right. The `committed` is used here to distinguish signatures of the VMR constructor.
`VMR(address, size_t, NativeCallStack)` without this parameter would have been resolved to `VMR(address, size_t, NCS, MemTag= mtNone)`. Actually it doesn't matter if the value of the parameter be true or false, the `bool` type does the work for us.
There is only one instance that uses this signature: `regionsTree.inline.hpp:41`.
Regarding your suggestion, we can provide a static method to build a Committed memory region and pass into it the required values. Something like:
VMR cmr;
VMR::create_cmr(addr, size, stack, cmr);// cmr is passed by ref and filled in
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27137#discussion_r2559371834
More information about the hotspot-runtime-dev
mailing list