diff --git a/src/hotspot/share/nmt/memMapPrinter.cpp b/src/hotspot/share/nmt/memMapPrinter.cpp index 8f1a4569e22..a6626faa95d 100644 --- a/src/hotspot/share/nmt/memMapPrinter.cpp +++ b/src/hotspot/share/nmt/memMapPrinter.cpp @@ -173,7 +173,7 @@ static bool vma_touches_thread_stack(const void* from, const void* to, const Thr // kernel. That can happen, e.g., for non-java threads that don't have guard pages. // Therefore we go for the simplest way here and check for intersection between VMA and thread stack. // Note it is possible to encounter a brand new thread that has not yet initialized its stack fields. - return range_intersects(from, to, (const void*)t->stack_end(), (const void*)t->stack_base_or_null()); + return t->stack_base_or_null() != nullptr && range_intersects(from, to, (const void*)t->stack_end(), (const void*)t->stack_base()); } struct GCThreadClosure : public ThreadClosure { diff --git a/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java index 72283ca0120..7f5d09de8e5 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java @@ -28,16 +28,29 @@ import jdk.test.lib.process.OutputAnalyzer; /* - * @test + * @test id=normal * @summary Test of diagnostic command System.map * @library /test/lib - * @requires (os.family == "linux" | os.family == "windows" | os.family == "mac") + * @requires (vm.gc != "Z") & (os.family == "linux" | os.family == "windows" | os.family == "mac") * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.internal.jvmstat/sun.jvmstat.monitor * @run testng/othervm -XX:+UsePerfData SystemMapTest */ + +/* + * @test id=zgc + * @bug 8346717 + * @summary Test of diagnostic command System.map using ZGC + * @library /test/lib + * @requires vm.gc.Z & (os.family == "linux" | os.family == "windows" | os.family == "mac") + * @modules java.base/jdk.internal.misc + * java.compiler + * java.management + * jdk.internal.jvmstat/sun.jvmstat.monitor + * @run testng/othervm -XX:+UsePerfData -XX:+UseZGC SystemMapTest + */ public class SystemMapTest extends SystemMapTestBase { public void run(CommandExecutor executor) { OutputAnalyzer output = executor.execute("System.map");