8253900: SA: wrong size computation when JVM was built without AOT

Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
Jose Ricardo Ziviani 2020-10-09 12:56:47 +00:00 committed by Martin Doerr
parent 2bc8bc5722
commit b1448da109
6 changed files with 25 additions and 3 deletions
src
hotspot/share
jdk.hotspot.agent/share/classes/sun/jvm/hotspot
test/hotspot/jtreg

@ -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*) \

@ -296,6 +296,7 @@ typedef HashtableEntry<InstanceKlass*, mtClass> 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*) \

@ -316,6 +316,11 @@ public class InstanceKlass extends Klass {
}
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();
}

@ -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 @@ public class VM {
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 class VM {
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;

@ -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

@ -107,7 +107,7 @@ public class TestInstanceKlassSize {
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;
}