Skip to content

Commit b1448da

Browse files
Jose Ricardo ZivianiTheRealMDoerr
authored andcommitted
8253900: SA: wrong size computation when JVM was built without AOT
Reviewed-by: cjplummer, sspitsyn
1 parent 2bc8bc5 commit b1448da

File tree

6 files changed

+25
-3
lines changed

6 files changed

+25
-3
lines changed

src/hotspot/share/jvmci/vmStructs_jvmci.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
JVMTI_ONLY(nonstatic_field(MethodCounters, _number_of_breakpoints, u2)) \
230230
nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \
231231
nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \
232+
AOT_ONLY(nonstatic_field(MethodCounters, _method, Method*)) \
232233
\
233234
nonstatic_field(MethodData, _size, int) \
234235
nonstatic_field(MethodData, _method, Method*) \

src/hotspot/share/runtime/vmStructs.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
296296
JVMTI_ONLY(nonstatic_field(MethodCounters, _number_of_breakpoints, u2)) \
297297
nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \
298298
nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \
299+
AOT_ONLY(nonstatic_field(MethodCounters, _method, Method*)) \
299300
nonstatic_field(Method, _constMethod, ConstMethod*) \
300301
nonstatic_field(Method, _method_data, MethodData*) \
301302
nonstatic_field(Method, _method_counters, MethodCounters*) \

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ public static boolean shouldStoreFingerprint() {
316316
}
317317

318318
public boolean hasStoredFingerprint() {
319+
// has_stored_fingerprint() @ instanceKlass.cpp can return true only if INCLUDE_AOT is
320+
// set during compilation.
321+
if (!VM.getVM().hasAOT()) {
322+
return false;
323+
}
319324
return shouldStoreFingerprint() || isShared();
320325
}
321326

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ public class VM {
8989
private FileMapInfo fileMapInfo;
9090
private Bytes bytes;
9191

92+
/** Flag indicating if AOT is enabled in the build */
93+
private boolean hasAOT;
9294
/** Flag indicating if JVMTI support is included in the build */
9395
private boolean isJvmtiSupported;
9496
/** 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) {
444446

445447
invocationEntryBCI = db.lookupIntConstant("InvocationEntryBci").intValue();
446448

449+
// We infer AOT if _method @ methodCounters is declared.
450+
{
451+
Type type = db.lookupType("MethodCounters");
452+
if (type.getField("_method", false, false) == null) {
453+
hasAOT = false;
454+
} else {
455+
hasAOT = true;
456+
}
457+
}
458+
447459
// We infer the presence of JVMTI from the presence of the InstanceKlass::_breakpoints field.
448460
{
449461
Type type = db.lookupType("InstanceKlass");
@@ -829,6 +841,11 @@ public boolean isBigEndian() {
829841
return isBigEndian;
830842
}
831843

844+
/** Returns true if AOT is enabled, false otherwise */
845+
public boolean hasAOT() {
846+
return hasAOT;
847+
}
848+
832849
/** Returns true if JVMTI is supported, false otherwise */
833850
public boolean isJvmtiSupported() {
834851
return isJvmtiSupported;

test/hotspot/jtreg/ProblemList.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ runtime/ReservedStack/ReservedStackTest.java 8231031 generic-all
9292
# :hotspot_serviceability
9393

9494
serviceability/sa/sadebugd/DebugdConnectTest.java 8239062 macosx-x64
95-
serviceability/sa/TestInstanceKlassSize.java 8230664 linux-ppc64le,linux-ppc64
96-
serviceability/sa/TestInstanceKlassSizeForInterface.java 8230664 linux-ppc64le,linux-ppc64
9795
serviceability/sa/TestRevPtrsForInvokeDynamic.java 8241235 generic-all
9896

9997
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatIntervalTest.java 8214032 generic-all

test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private static void startMeWithArgs() throws Exception {
107107
for (String s : output.asLines()) {
108108
if (s.contains(instanceKlassName)) {
109109
Asserts.assertTrue(
110-
s.contains(size), "The size computed by SA for" +
110+
s.contains(size), "The size computed by SA for " +
111111
instanceKlassName + " does not match.");
112112
match = true;
113113
}

0 commit comments

Comments
 (0)