RFR: 8337563: NMT: rename MEMFLAGS to MemTag [v7]
Afshin Zafari
azafari at openjdk.org
Thu Sep 12 13:36:10 UTC 2024
On Tue, 10 Sep 2024 20:53:46 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
>> Please review this cleanup, where we rename `MEMFLAGS` to `MemTag`.
>>
>> `MEMFLAGS` implies that we can use more than one at the same time, but those are exclusive values, so `MemTag` is a more suitable name.
>>
>> This fix also includes a cleanup of all the related function/template parameter names and local variable names.
>>
>> Testing is pending...
>>
>> Note: there is more history in old closed PRs [https://github.com/openjdk/jdk/pull/20497](https://github.com/openjdk/jdk/pull/20497) and [https://github.com/openjdk/jdk/pull/20472](https://github.com/openjdk/jdk/pull/20472)
>
> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
>
> Coleen's feedback
Again, if we want to replace mem type with mem tag. The regexp search for mem.*type gives this:
---
47 results - 19 files
Source root • src/hotspot/share/gc/shared/oopStorage.hpp:
92: // The memory type for allocations.
276: // The memory type for allocations.
Source root • src/hotspot/share/nmt/mallocSiteTable.hpp:
68: assert(mem_tag != mtNone, "Expect a real memory type");
Source root • src/hotspot/share/nmt/memBaseline.cpp:
64: // Sort into allocation site addresses and memory type order for baseline comparison
Source root • src/hotspot/share/nmt/memBaseline.hpp:
56: by_site_and_type // by call site and memory type
206: // Sort allocation sites in call site address and memory type order
Source root • src/hotspot/share/nmt/memReporter.cpp:
138: void MemReporterBase::print_virtual_memory_region(const char* type, address base, size_t size) const {
179: // Summary by memory type
191: void MemSummaryReporter::report_summary_of_type(MemTag mem_tag,
280: void MemSummaryReporter::report_metadata(Metaspace::MetadataType type) const {
343: "Must have a valid memory type");
522: // Summary diff by memory type
597: void MemSummaryDiffReporter::diff_summary_of_type(MemTag mem_tag,
798: MallocSiteIterator early_itr = _early_baseline.malloc_sites(MemBaseline::by_site_and_type);
799: MallocSiteIterator current_itr = _current_baseline.malloc_sites(MemBaseline::by_site_and_type);
851: // This site was originally allocated with one memory type, then released,
852: // then re-allocated at the same site (as far as we can tell) with a different memory type.
Source root • src/hotspot/share/nmt/memReporter.hpp:
141: // Report summary for each memory type
Source root • src/hotspot/share/nmt/memTracker.cpp:
64: // Memory type is encoded into tracking header as a byte field,
Source root • src/hotspot/share/nmt/nmtCommon.cpp:
32: #define MEMORY_TAG_DECLARE_NAME(type, human_readable) \
Source root • src/hotspot/share/nmt/nmtCommon.hpp:
91: assert(tag_is_valid(mem_tag), "Invalid type (%u)", (unsigned)mem_tag);
Source root • src/hotspot/share/nmt/virtualMemoryTracker.cpp:
297: "Overwrite memory type for region [" INTPTR_FORMAT "-" INTPTR_FORMAT "), %u->%u.",
425: assert(reserved_rgn->mem_tag() == mtNone, "Overwrite memory type (should be mtNone, is: "%s")",
Source root • src/hotspot/share/nmt/virtualMemoryTracker.hpp:
153: // Move virtual memory from one memory type to another.
154: // Virtual memory can be reserved before it is associated with a memory type, and tagged
156: // type to specified memory type.
394: static bool split_reserved_region(address addr, size_t size, size_t split, MemTag mem_tag, MemTag split_type);
Source root • src/hotspot/share/nmt/vmatree.hpp:
97: assert(!(type == StateType::Released) || data.mem_tag == mtNone, "Released type must have flag mtNone");
Source root • src/hotspot/share/prims/whitebox.cpp:
679: // Alloc memory using the test memory type so that we can use that to see if
695: // Alloc memory with pseudo call stack and specific memory type.
Source root • src/hotspot/share/runtime/os.cpp:
725: assert(mem_tag == header->mem_tag(), "weird NMT type mismatch (new:"%s" != old:"%s")\n",
Source root • src/hotspot/share/utilities/bitMap.hpp:
644: // NMT memory type
Source root • src/hotspot/share/utilities/debug.cpp:
714: MemTracker::record_virtual_memory_type(page, mtInternal);
Source root • src/hotspot/share/utilities/growableArray.cpp:
49: // memory type has to be specified for C heap allocation
50: assert(mem_tag != mtNone, "memory type not specified for C heap object");
Source root • src/hotspot/share/utilities/resizeableResourceHash.hpp:
33: MemTag MEM_TYPE>
55: table = NEW_C_HEAP_ARRAY(Node*, table_size, MEM_TYPE);
75: MemTag MEM_TYPE = mtInternal,
80: ResizeableResourceHashtableStorage<K, V, ALLOC_TYPE, MEM_TYPE>,
81: K, V, ALLOC_TYPE, MEM_TYPE, HASH, EQUALS> {
84: using BASE = ResourceHashtableBase<ResizeableResourceHashtableStorage<K, V, ALLOC_TYPE, MEM_TYPE>,
85: K, V, ALLOC_TYPE, MEM_TYPE, HASH, EQUALS>;
Source root • src/hotspot/share/utilities/resourceHash.hpp:
57: MemTag MEM_TYPE,
156: *ptr = new (MEM_TYPE) Node(hv, key, value, *ptr);
177: *ptr = new (MEM_TYPE) Node(hv, key, value);
196: *ptr = new (MEM_TYPE) Node(hv, key);
218: *ptr = new (MEM_TYPE) Node(hv, key, value);
The `MemTracker::record_virtual_memory_type` can be changed to `MemTracker::record_virtual_memory_tag`
-------------
PR Review: https://git.openjdk.org/jdk/pull/20872#pullrequestreview-2300326979
PR Review: https://git.openjdk.org/jdk/pull/20872#pullrequestreview-2300332293
More information about the serviceability-dev
mailing list