Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8337563: NMT: rename MEMFLAGS to MemTag #20872

Closed
wants to merge 23 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shared/oopStorage.hpp
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ class OopStorage : public CHeapObjBase {
// bookkeeping overhead, including this storage object.
size_t total_memory_usage() const;

// The memory type for allocations.
// The memory tag for allocations.
MemTag mem_tag() const;

enum EntryStatus {
@@ -273,7 +273,7 @@ class OopStorage : public CHeapObjBase {
// mutable because this gets set even for const iteration.
mutable int _concurrent_iteration_count;

// The memory type for allocations.
// The memory tag for allocations.
MemTag _mem_tag;

// Flag indicating this storage object is a candidate for empty block deletion.
2 changes: 1 addition & 1 deletion src/hotspot/share/jfr/metadata/metadata.xml
Original file line number Diff line number Diff line change
@@ -735,7 +735,7 @@
</Event>

<Event name="NativeMemoryUsage" category="Java Virtual Machine, Memory" label="Native Memory Usage Per Type"
description="Native memory usage for a given memory type in the JVM" period="everyChunk">
description="Native memory usage for a given memory tag in the JVM" period="everyChunk">
<Field type="NMTType" name="type" label="Memory Type" description="Type used for the native memory allocation" />
<Field type="ulong" contentType="bytes" name="reserved" label="Reserved Memory" description="Reserved bytes for this type" />
<Field type="ulong" contentType="bytes" name="committed" label="Committed Memory" description="Committed bytes for this type" />
2 changes: 1 addition & 1 deletion src/hotspot/share/nmt/mallocSiteTable.hpp
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ class MallocSiteHashtableEntry : public CHeapObj<mtNMT> {

MallocSiteHashtableEntry(NativeCallStack stack, MemTag mem_tag):
_malloc_site(stack, mem_tag), _hash(stack.calculate_hash()), _next(nullptr) {
assert(mem_tag != mtNone, "Expect a real memory type");
assert(mem_tag != mtNone, "Expect a real memory tag");
}

inline const MallocSiteHashtableEntry* next() const {
2 changes: 1 addition & 1 deletion src/hotspot/share/nmt/memBaseline.cpp
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ int compare_malloc_site(const MallocSite& s1, const MallocSite& s2) {
return s1.call_stack()->compare(*s2.call_stack());
}

// Sort into allocation site addresses and memory type order for baseline comparison
// Sort into allocation site addresses and memory tag order for baseline comparison
int compare_malloc_site_and_type(const MallocSite& s1, const MallocSite& s2) {
int res = compare_malloc_site(s1, s2);
if (res == 0) {
4 changes: 2 additions & 2 deletions src/hotspot/share/nmt/memBaseline.hpp
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ class MemBaseline {
by_address, // by memory address
by_size, // by memory size
by_site, // by call site where the memory is allocated from
by_site_and_type // by call site and memory type
by_site_and_type // by call site and memory tag
};

private:
@@ -203,7 +203,7 @@ class MemBaseline {
void malloc_sites_to_size_order();
// Sort allocation sites in call site address order
void malloc_sites_to_allocation_site_order();
// Sort allocation sites in call site address and memory type order
// Sort allocation sites in call site address and memory tag order
void malloc_sites_to_allocation_site_and_type_order();

// Sort allocation sites in reserved size order
2 changes: 1 addition & 1 deletion src/hotspot/share/nmt/memMapPrinter.cpp
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ static bool range_intersects(const void* from1, const void* to1, const void* fro
return MAX2(from1, from2) < MIN2(to1, to2);
}

// A Cache that correlates range with MEMFLAG, optimized to be iterated quickly
// A Cache that correlates range with MemTag, optimized to be iterated quickly
// (cache friendly).
class CachedNMTInformation : public VirtualMemoryWalker {
struct Range { const void* from; const void* to; };
10 changes: 5 additions & 5 deletions src/hotspot/share/nmt/memReporter.cpp
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@ void MemSummaryReporter::report() {
out->cr();
out->cr();

// Summary by memory type
// Summary by memory tag
for (int index = 0; index < mt_number_of_tags; index ++) {
MemTag mem_tag = NMTUtil::index_to_tag(index);
// thread stack is reported as part of thread category
@@ -340,7 +340,7 @@ int MemDetailReporter::report_malloc_sites() {
_stackprinter.print_stack(stack);
MemTag mem_tag = malloc_site->mem_tag();
assert(NMTUtil::tag_is_valid(mem_tag) && mem_tag != mtNone,
"Must have a valid memory type");
"Must have a valid memory tag");
INDENT_BY(29,
out->print("(");
print_malloc(malloc_site->counter(), mem_tag);
@@ -519,7 +519,7 @@ void MemSummaryDiffReporter::report_diff() {
out->cr();
out->cr();

// Summary diff by memory type
// Summary diff by memory tag
for (int index = 0; index < mt_number_of_tags; index ++) {
MemTag mem_tag = NMTUtil::index_to_tag(index);
// thread stack is reported as part of thread category
@@ -848,8 +848,8 @@ void MemDetailDiffReporter::diff_virtual_memory_sites() const {
old_virtual_memory_site(early_site);
early_site = early_itr.next();
} else if (early_site->mem_tag() != current_site->mem_tag()) {
// This site was originally allocated with one memory type, then released,
// then re-allocated at the same site (as far as we can tell) with a different memory type.
// This site was originally allocated with one memory tag, then released,
// then re-allocated at the same site (as far as we can tell) with a different memory tag.
old_virtual_memory_site(early_site);
early_site = early_itr.next();
new_virtual_memory_site(current_site);
2 changes: 1 addition & 1 deletion src/hotspot/share/nmt/memReporter.hpp
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ class MemSummaryReporter : public MemReporterBase {
// Generate summary report
virtual void report();
private:
// Report summary for each memory type
// Report summary for each memory tag
void report_summary_of_type(MemTag mem_tag, MallocMemory* malloc_memory,
VirtualMemory* virtual_memory);

4 changes: 2 additions & 2 deletions src/hotspot/share/nmt/virtualMemoryTracker.cpp
Original file line number Diff line number Diff line change
@@ -294,7 +294,7 @@ size_t ReservedMemoryRegion::committed_size() const {

void ReservedMemoryRegion::set_mem_tag(MemTag new_mem_tag) {
assert((mem_tag() == mtNone || mem_tag() == new_mem_tag),
"Overwrite memory type for region [" INTPTR_FORMAT "-" INTPTR_FORMAT "), %u->%u.",
"Overwrite memory tag for region [" INTPTR_FORMAT "-" INTPTR_FORMAT "), %u->%u.",
p2i(base()), p2i(end()), (unsigned)mem_tag(), (unsigned)new_mem_tag);
if (mem_tag() != new_mem_tag) {
VirtualMemorySummary::move_reserved_memory(mem_tag(), new_mem_tag, size());
@@ -422,7 +422,7 @@ void VirtualMemoryTracker::set_reserved_region_type(address addr, MemTag mem_tag
if (reserved_rgn != nullptr) {
assert(reserved_rgn->contain_address(addr), "Containment");
if (reserved_rgn->mem_tag() != mem_tag) {
assert(reserved_rgn->mem_tag() == mtNone, "Overwrite memory type (should be mtNone, is: \"%s\")",
assert(reserved_rgn->mem_tag() == mtNone, "Overwrite memory tag (should be mtNone, is: \"%s\")",
NMTUtil::tag_to_name(reserved_rgn->mem_tag()));
reserved_rgn->set_mem_tag(mem_tag);
}
8 changes: 4 additions & 4 deletions src/hotspot/share/nmt/virtualMemoryTracker.hpp
Original file line number Diff line number Diff line change
@@ -150,10 +150,10 @@ class VirtualMemorySummary : AllStatic {
as_snapshot()->by_type(mem_tag)->release_memory(size);
}

// Move virtual memory from one memory type to another.
// Virtual memory can be reserved before it is associated with a memory type, and tagged
// Move virtual memory from one memory tag to another.
// Virtual memory can be reserved before it is associated with a memory tag, and tagged
// as 'unknown'. Once the memory is tagged, the virtual memory will be moved from 'unknown'
// type to specified memory type.
// type to specified memory tag.
static inline void move_reserved_memory(MemTag from, MemTag to, size_t size) {
as_snapshot()->by_type(from)->release_memory(size);
as_snapshot()->by_type(to)->reserve_memory(size);
@@ -390,7 +390,7 @@ class VirtualMemoryTracker : AllStatic {

// Given an existing memory mapping registered with NMT, split the mapping in
// two. The newly created two mappings will be registered under the call
// stack and the memory types of the original section.
// stack and the memory tag of the original section.
static bool split_reserved_region(address addr, size_t size, size_t split, MemTag mem_tag, MemTag split_type);

// Walk virtual memory data structure for creating baseline, etc.
2 changes: 1 addition & 1 deletion src/hotspot/share/nmt/vmatree.hpp
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ class VMATree {
public:
IntervalState() : type_flag{0,0}, sidx() {}
IntervalState(const StateType type, const RegionData data) {
assert(!(type == StateType::Released) || data.mem_tag == mtNone, "Released type must have flag mtNone");
assert(!(type == StateType::Released) || data.mem_tag == mtNone, "Released type must have memory tag mtNone");
type_flag[0] = static_cast<uint8_t>(type);
type_flag[1] = static_cast<uint8_t>(data.mem_tag);
sidx = data.stack_idx;
4 changes: 2 additions & 2 deletions src/hotspot/share/prims/whitebox.cpp
Original file line number Diff line number Diff line change
@@ -676,7 +676,7 @@ WB_END

#endif // INCLUDE_G1GC

// Alloc memory using the test memory type so that we can use that to see if
// Alloc memory using the test memory tag so that we can use that to see if
// NMT picks it up correctly
WB_ENTRY(jlong, WB_NMTMalloc(JNIEnv* env, jobject o, jlong size))
jlong addr = 0;
@@ -692,7 +692,7 @@ WB_ENTRY(jlong, WB_NMTMallocWithPseudoStack(JNIEnv* env, jobject o, jlong size,
return (jlong)(uintptr_t)os::malloc(size, mtTest, stack);
WB_END

// Alloc memory with pseudo call stack and specific memory type.
// Alloc memory with pseudo call stack and specific memory tag.
WB_ENTRY(jlong, WB_NMTMallocWithPseudoStackAndType(JNIEnv* env, jobject o, jlong size, jint pseudo_stack, jint mem_tag))
address pc = (address)(size_t)pseudo_stack;
NativeCallStack stack(&pc, 1);
2 changes: 1 addition & 1 deletion src/hotspot/share/utilities/bitMap.hpp
Original file line number Diff line number Diff line change
@@ -641,7 +641,7 @@ class ResourceBitMap : public GrowableBitMap<ResourceBitMap> {

// A BitMap with storage in the CHeap.
class CHeapBitMap : public GrowableBitMap<CHeapBitMap> {
// NMT memory type
// NMT memory tag
const MemTag _mem_tag;

// Don't allow copy or assignment, to prevent the
4 changes: 2 additions & 2 deletions src/hotspot/share/utilities/growableArray.cpp
Original file line number Diff line number Diff line change
@@ -46,8 +46,8 @@ void* GrowableArrayCHeapAllocator::allocate(int max, int element_size, MemTag me
assert(max >= 0, "integer overflow");
size_t byte_size = element_size * (size_t) max;

// memory type has to be specified for C heap allocation
assert(mem_tag != mtNone, "memory type not specified for C heap object");
// memory tag has to be specified for C heap allocation
assert(mem_tag != mtNone, "memory tag not specified for C heap object");
return (void*)AllocateHeap(byte_size, mem_tag);
}