[8u] RFR(XS) 8245617: ObjectSizeCalculator is not supported on OpenJDK

Yangfei (Felix) felix.yang at huawei.com
Fri May 22 08:36:04 UTC 2020


Hi,

8u-specific bug: https://bugs.openjdk.java.net/browse/JDK-8245617 
ObjectSizeCalculator is not supported for the latest openjdk 8u release, as indicated by the test case. 
Method getEffectiveMemoryLayoutSpecification in ObjectSizeCalculator.java is expecting a vmName which starts with "Java HotSpot(TM) ".
For openjdk 8u release, we have a vmName like: "OpenJDK 64-Bit Server VM".

Fix is trivial:
diff -r f5a3d8f60cf5 src/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java
--- a/src/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java       Tue May 19 05:11:20 2020 +0100
+++ b/src/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java       Fri May 22 15:50:37 2020 +0800
@@ -396,7 +396,8 @@
      */
     public static MemoryLayoutSpecification getEffectiveMemoryLayoutSpecification() {
         final String vmName = System.getProperty("java.vm.name");
-        if (vmName == null || !vmName.startsWith("Java HotSpot(TM) ")) {
+        if (vmName == null
+            || (!vmName.startsWith("OpenJDK ") && !vmName.startsWith("Java HotSpot(TM) "))) {
             throw new UnsupportedOperationException(
                     "ObjectSizeCalculator only supported on HotSpot VM");
         }

Is there a good place to incorporate the test case?

Thanks,
Felix


More information about the jdk8u-dev mailing list