# HG changeset patch # User stuefe # Date 1591860172 -7200 # Thu Jun 11 09:22:52 2020 +0200 # Node ID c95a239dec4282089c8b03aa0971218f84ab81cf # Parent a94702f4f69f8cb536f80faf3411d751f427c23e [mq]: 8247252-cds-nmt-ccps-off diff -r a94702f4f69f -r c95a239dec42 src/hotspot/share/memory/metaspaceShared.cpp --- a/src/hotspot/share/memory/metaspaceShared.cpp Wed Jun 10 08:34:10 2020 -0400 +++ b/src/hotspot/share/memory/metaspaceShared.cpp Thu Jun 11 09:22:52 2020 +0200 @@ -2269,6 +2269,7 @@ class_space_rs); if (mapped_base_address == NULL) { result = MAP_ARCHIVE_MMAP_FAILURE; + log_debug(cds)("Failed to reserve spaces (use_requested_addr=%u)", (unsigned)use_requested_addr); } else { #ifdef ASSERT @@ -2471,6 +2472,8 @@ if (archive_space_rs.is_reserved()) { assert(base_address == NULL || (address)archive_space_rs.base() == base_address, "Sanity"); + // Register archive space with NMT. + MemTracker::record_virtual_memory_type(archive_space_rs.base(), mtClassShared); return archive_space_rs.base(); } return NULL; diff -r a94702f4f69f -r c95a239dec42 src/hotspot/share/services/virtualMemoryTracker.cpp --- a/src/hotspot/share/services/virtualMemoryTracker.cpp Wed Jun 10 08:34:10 2020 -0400 +++ b/src/hotspot/share/services/virtualMemoryTracker.cpp Thu Jun 11 09:22:52 2020 +0200 @@ -30,6 +30,7 @@ #include "services/memTracker.hpp" #include "services/threadStackTracker.hpp" #include "services/virtualMemoryTracker.hpp" +#include "utilities/ostream.hpp" size_t VirtualMemorySummary::_snapshot[CALC_OBJ_SIZE_IN_TYPE(VirtualMemorySnapshot, size_t)]; @@ -288,7 +289,9 @@ } void ReservedMemoryRegion::set_flag(MEMFLAGS f) { - assert((flag() == mtNone || flag() == f), "Overwrite memory type"); + assert((flag() == mtNone || flag() == f), + "Overwrite memory type for region [" PTR_FORMAT "-" PTR_FORMAT "), %u->%u.", + p2i(base()), p2i(end()), (unsigned)flag(), (unsigned)f); if (flag() != f) { VirtualMemorySummary::move_reserved_memory(flag(), f, size()); VirtualMemorySummary::move_committed_memory(flag(), f, committed_size()); @@ -385,6 +388,13 @@ return true; } + // Print some more details. Don't use UL here to avoid circularities. +#ifdef ASSERT + tty->print_cr("Error: existing region: [" PTR_FORMAT "-" PTR_FORMAT "), flag %u.\n" + " new region: [" PTR_FORMAT "-" PTR_FORMAT "), flag %u.", + p2i(reserved_rgn->base()), p2i(reserved_rgn->end()), (unsigned)reserved_rgn->flag(), + p2i(base_addr), p2i(base_addr + size), (unsigned)flag); +#endif ShouldNotReachHere(); return false; } diff -r a94702f4f69f -r c95a239dec42 test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java --- a/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java Wed Jun 10 08:34:10 2020 -0400 +++ b/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java Thu Jun 11 09:22:52 2020 +0200 @@ -58,7 +58,8 @@ .setArchiveName(filename) .addPrefix("-XX:SharedBaseAddress=" + testEntry) .addPrefix("-Xlog:cds=debug") - .addPrefix("-Xlog:cds+reloc=debug"); + .addPrefix("-Xlog:cds+reloc=debug") + .addPrefix("-XX:NativeMemoryTracking=detail"); CDSTestUtils.createArchiveAndCheck(opts); OutputAnalyzer out = CDSTestUtils.runWithArchiveAndCheck(opts); diff -r a94702f4f69f -r c95a239dec42 test/hotspot/jtreg/runtime/cds/appcds/ArchiveRelocationTest.java --- a/test/hotspot/jtreg/runtime/cds/appcds/ArchiveRelocationTest.java Wed Jun 10 08:34:10 2020 -0400 +++ b/test/hotspot/jtreg/runtime/cds/appcds/ArchiveRelocationTest.java Thu Jun 11 09:22:52 2020 +0200 @@ -68,10 +68,11 @@ String runRelocArg = run_reloc ? forceRelocation : "-showversion"; String logArg = "-Xlog:cds=debug,cds+reloc=debug"; String unlockArg = "-XX:+UnlockDiagnosticVMOptions"; + String nmtArg = "-XX:NativeMemoryTracking=detail"; OutputAnalyzer out = TestCommon.dump(appJar, TestCommon.list(mainClass), - unlockArg, dumpRelocArg, logArg); + unlockArg, dumpRelocArg, logArg, nmtArg); if (dump_reloc) { out.shouldContain("ArchiveRelocationMode == 1: always allocate class space at an alternative address"); out.shouldContain("Relocating archive from"); diff -r a94702f4f69f -r c95a239dec42 test/hotspot/jtreg/runtime/cds/appcds/TestCombinedCompressedFlags.java --- a/test/hotspot/jtreg/runtime/cds/appcds/TestCombinedCompressedFlags.java Wed Jun 10 08:34:10 2020 -0400 +++ b/test/hotspot/jtreg/runtime/cds/appcds/TestCombinedCompressedFlags.java Thu Jun 11 09:22:52 2020 +0200 @@ -163,7 +163,8 @@ new String[] {"Hello"}, getCompressedOopsArg(t.dumpArg.useCompressedOops), getCompressedClassPointersArg(t.dumpArg.useCompressedClassPointers), - "-Xlog:cds"); + "-Xlog:cds", + "-XX:NativeMemoryTracking=detail"); out.shouldContain("Dumping shared data to file:"); out.shouldHaveExitValue(0); @@ -172,6 +173,7 @@ "-cp", helloJar, "-Xlog:cds", + "-XX:NativeMemoryTracking=detail", getCompressedOopsArg(c.useCompressedOops), getCompressedClassPointersArg(c.useCompressedClassPointers), "Hello");