diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp index 43b3066e01ae1..8bab51b61b73d 100644 --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -229,6 +229,7 @@ JVMTI_ONLY(nonstatic_field(MethodCounters, _number_of_breakpoints, u2)) \ nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \ nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \ + AOT_ONLY(nonstatic_field(MethodCounters, _method, Method*)) \ \ nonstatic_field(MethodData, _size, int) \ nonstatic_field(MethodData, _method, Method*) \ diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 1f6cb0b3c4559..a73b125977945 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -296,6 +296,7 @@ typedef HashtableEntry KlassHashtableEntry; JVMTI_ONLY(nonstatic_field(MethodCounters, _number_of_breakpoints, u2)) \ nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \ nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \ + AOT_ONLY(nonstatic_field(MethodCounters, _method, Method*)) \ nonstatic_field(Method, _constMethod, ConstMethod*) \ nonstatic_field(Method, _method_data, MethodData*) \ nonstatic_field(Method, _method_counters, MethodCounters*) \ diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java index 9497e80944f4d..ecd221577fec2 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @@ -316,6 +316,11 @@ public static boolean shouldStoreFingerprint() { } public boolean hasStoredFingerprint() { + // has_stored_fingerprint() @ instanceKlass.cpp can return true only if INCLUDE_AOT is + // set during compilation. + if (!VM.getVM().hasAOT()) { + return false; + } return shouldStoreFingerprint() || isShared(); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java index fa8bcd7531510..871ba282747af 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java @@ -89,6 +89,8 @@ public class VM { private FileMapInfo fileMapInfo; private Bytes bytes; + /** Flag indicating if AOT is enabled in the build */ + private boolean hasAOT; /** Flag indicating if JVMTI support is included in the build */ private boolean isJvmtiSupported; /** Flags indicating whether we are attached to a core, C1, or C2 build */ @@ -444,6 +446,16 @@ private VM(TypeDataBase db, JVMDebugger debugger, boolean isBigEndian) { invocationEntryBCI = db.lookupIntConstant("InvocationEntryBci").intValue(); + // We infer AOT if _method @ methodCounters is declared. + { + Type type = db.lookupType("MethodCounters"); + if (type.getField("_method", false, false) == null) { + hasAOT = false; + } else { + hasAOT = true; + } + } + // We infer the presence of JVMTI from the presence of the InstanceKlass::_breakpoints field. { Type type = db.lookupType("InstanceKlass"); @@ -829,6 +841,11 @@ public boolean isBigEndian() { return isBigEndian; } + /** Returns true if AOT is enabled, false otherwise */ + public boolean hasAOT() { + return hasAOT; + } + /** Returns true if JVMTI is supported, false otherwise */ public boolean isJvmtiSupported() { return isJvmtiSupported; diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 30d38dc7dcf4d..5309f02d77f8b 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -92,8 +92,6 @@ runtime/ReservedStack/ReservedStackTest.java 8231031 generic-all # :hotspot_serviceability serviceability/sa/sadebugd/DebugdConnectTest.java 8239062 macosx-x64 -serviceability/sa/TestInstanceKlassSize.java 8230664 linux-ppc64le,linux-ppc64 -serviceability/sa/TestInstanceKlassSizeForInterface.java 8230664 linux-ppc64le,linux-ppc64 serviceability/sa/TestRevPtrsForInvokeDynamic.java 8241235 generic-all serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatIntervalTest.java 8214032 generic-all diff --git a/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java b/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java index 72f9af9ff5d81..99ca7b1e484c9 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java +++ b/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java @@ -107,7 +107,7 @@ private static void startMeWithArgs() throws Exception { for (String s : output.asLines()) { if (s.contains(instanceKlassName)) { Asserts.assertTrue( - s.contains(size), "The size computed by SA for" + + s.contains(size), "The size computed by SA for " + instanceKlassName + " does not match."); match = true; }