11/*
2- * Copyright (c) 2013, 2025 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2013, 2026 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -193,14 +193,14 @@ bool VirtualMemoryTracker::Instance::print_containing_region(const void* p, outp
193193}
194194
195195bool VirtualMemoryTracker::print_containing_region (const void * p, outputStream* st) {
196- ReservedMemoryRegion rmr = tree ()->find_reserved_region ((address)p);
197- if (!rmr .contain_address ((address)p)) {
196+ VirtualMemoryRegion rgn = tree ()->find_reserved_region ((address)p);
197+ if (!rgn. is_valid () || !rgn .contain_address ((address)p)) {
198198 return false ;
199199 }
200200 st->print_cr (PTR_FORMAT " in mmap'd memory region [" PTR_FORMAT " - " PTR_FORMAT " ], tag %s" ,
201- p2i (p), p2i (rmr .base ()), p2i (rmr .end ()), NMTUtil::tag_to_enum_name (rmr .mem_tag ()));
201+ p2i (p), p2i (rgn .base ()), p2i (rgn .end ()), NMTUtil::tag_to_enum_name (rgn .mem_tag ()));
202202 if (MemTracker::tracking_level () == NMT_detail) {
203- rmr. call_stack ()->print_on (st);
203+ rgn. reserved_call_stack ()->print_on (st);
204204 }
205205 st->cr ();
206206 return true ;
@@ -213,7 +213,7 @@ bool VirtualMemoryTracker::Instance::walk_virtual_memory(VirtualMemoryWalker* wa
213213
214214bool VirtualMemoryTracker::walk_virtual_memory (VirtualMemoryWalker* walker) {
215215 bool ret = true ;
216- tree ()->visit_reserved_regions ([&](ReservedMemoryRegion & rgn) {
216+ tree ()->visit_reserved_regions ([&](VirtualMemoryRegion & rgn) {
217217 if (!walker->do_allocation_site (&rgn)) {
218218 ret = false ;
219219 return false ;
@@ -223,29 +223,29 @@ bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) {
223223 return ret;
224224}
225225
226- size_t VirtualMemoryTracker::committed_size (const ReservedMemoryRegion* rmr ) {
226+ size_t VirtualMemoryTracker::committed_size (const VirtualMemoryRegion* rgn ) {
227227 size_t result = 0 ;
228- tree ()->visit_committed_regions (*rmr , [&](CommittedMemoryRegion & crgn) {
228+ tree ()->visit_committed_regions (*rgn , [&](VirtualMemoryRegion & crgn) {
229229 result += crgn.size ();
230230 return true ;
231231 });
232232 return result;
233233}
234234
235- size_t VirtualMemoryTracker::Instance::committed_size (const ReservedMemoryRegion* rmr ) {
235+ size_t VirtualMemoryTracker::Instance::committed_size (const VirtualMemoryRegion* rgn ) {
236236 assert (_tracker != nullptr , " Sanity check" );
237- return _tracker->committed_size (rmr );
237+ return _tracker->committed_size (rgn );
238238}
239239
240- address VirtualMemoryTracker::Instance::thread_stack_uncommitted_bottom (const ReservedMemoryRegion* rmr ) {
240+ address VirtualMemoryTracker::Instance::thread_stack_uncommitted_bottom (const VirtualMemoryRegion* rgn ) {
241241 assert (_tracker != nullptr , " Sanity check" );
242- return _tracker->thread_stack_uncommitted_bottom (rmr );
242+ return _tracker->thread_stack_uncommitted_bottom (rgn );
243243}
244244
245- address VirtualMemoryTracker::thread_stack_uncommitted_bottom (const ReservedMemoryRegion* rmr ) {
246- address bottom = rmr ->base ();
247- address top = rmr ->end ();
248- tree ()->visit_committed_regions (*rmr , [&](CommittedMemoryRegion & crgn) {
245+ address VirtualMemoryTracker::thread_stack_uncommitted_bottom (const VirtualMemoryRegion* rgn ) {
246+ address bottom = rgn ->base ();
247+ address top = rgn ->end ();
248+ tree ()->visit_committed_regions (*rgn , [&](VirtualMemoryRegion & crgn) {
249249 address committed_top = crgn.base () + crgn.size ();
250250 if (committed_top < top) {
251251 // committed stack guard pages, skip them
@@ -299,7 +299,7 @@ class SnapshotThreadStackWalker : public VirtualMemoryWalker {
299299public:
300300 SnapshotThreadStackWalker () {}
301301
302- bool do_allocation_site (const ReservedMemoryRegion * rgn) {
302+ bool do_allocation_site (const VirtualMemoryRegion * rgn) {
303303 if (MemTracker::NmtVirtualMemoryLocker::is_safe_to_use ()) {
304304 assert_lock_strong (NmtVirtualMemory_lock);
305305 }
@@ -340,19 +340,19 @@ void VirtualMemoryTracker::Instance::snapshot_thread_stacks() {
340340 walk_virtual_memory (&walker);
341341}
342342
343- ReservedMemoryRegion RegionsTree::find_reserved_region (address addr) {
344- ReservedMemoryRegion rmr ;
345- auto contain_region = [&](ReservedMemoryRegion & region_in_tree) {
343+ VirtualMemoryRegion RegionsTree::find_reserved_region (address addr) {
344+ VirtualMemoryRegion rgn ;
345+ auto contain_region = [&](VirtualMemoryRegion & region_in_tree) {
346346 if (region_in_tree.contain_address (addr)) {
347- rmr = region_in_tree;
347+ rgn = region_in_tree;
348348 return false ;
349349 }
350350 return true ;
351351 };
352352 visit_reserved_regions (contain_region);
353- return rmr ;
353+ return rgn ;
354354}
355355
356- bool CommittedMemoryRegion::equals (const ReservedMemoryRegion& rmr ) const {
357- return size () == rmr .size () && call_stack ()->equals (*(rmr. call_stack ()));
356+ bool VirtualMemoryRegion::equals_including_stacks (const VirtualMemoryRegion& rgn ) const {
357+ return size () == rgn .size () && committed_call_stack ()->equals (*(rgn. reserved_call_stack ()));
358358}
0 commit comments