Skip to content

Commit

Permalink
8253900: SA: wrong size computation when JVM was built without AOT
Browse files Browse the repository at this point in the history
Reviewed-by: cjplummer, sspitsyn
  • Loading branch information
Jose Ricardo Ziviani authored and TheRealMDoerr committed Oct 9, 2020
1 parent 2bc8bc5 commit b1448da
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/hotspot/share/jvmci/vmStructs_jvmci.cpp
Expand Up @@ -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*) \
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/runtime/vmStructs.cpp
Expand Up @@ -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*) \
Expand Down
Expand Up @@ -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();
}

Expand Down
Expand Up @@ -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 */
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions test/hotspot/jtreg/ProblemList.txt
Expand Up @@ -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
Expand Down
Expand Up @@ -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;
}
Expand Down

1 comment on commit b1448da

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on b1448da Oct 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.