changeset 52015:01fc0d30437a lworld

8209899: [lworld] dcmd tests crash with "Unexpected constant pool layout" Summary: Generate constant pool ValueType attribute entries after the fields depended on by jcmd. Reviewed-by: mchung
author hseigel
date Fri, 07 Sep 2018 13:09:45 -0400
parents cf5b7963fb8b
children a848604ec3e2
files src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java test/hotspot/jtreg/ProblemList.txt test/jdk/ProblemList.txt
diffstat 3 files changed, 12 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java	Thu Sep 06 14:17:29 2018 +0200
+++ b/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java	Fri Sep 07 13:09:45 2018 -0400
@@ -159,6 +159,12 @@
         //     [CONSTANT_Class_info] for above
         //     [UTF-8] [Target class's name]
         //     [CONSTANT_Class_info] for above
+        // ^   [UTF-8] [Serialization: Class's name in which to invoke constructor]
+        // ^   [CONSTANT_Class_info] for above
+        //     [UTF-8] target method or constructor name
+        //     [UTF-8] target method or constructor signature
+        //     [CONSTANT_NameAndType_info] for above
+        //     [CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info] for target method
         //     [UTF-8] descriptor for type of non-primitive parameter 1
         //     [CONSTANT_Class_info] for type of non-primitive parameter 1
         //     ...
@@ -167,12 +173,6 @@
         //     [UTF-8] descriptor for declared value types if not present in CP
         //     [CONSTANT_Class_info] for declared value types if not present in CP
         //     ...
-        // ^   [UTF-8] [Serialization: Class's name in which to invoke constructor]
-        // ^   [CONSTANT_Class_info] for above
-        //     [UTF-8] target method or constructor name
-        //     [UTF-8] target method or constructor signature
-        //     [CONSTANT_NameAndType_info] for above
-        //     [CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info] for target method
         //     [UTF-8] "invoke" or "newInstance"
         //     [UTF-8] invoke or newInstance descriptor
         // +   [UTF-8] "java/lang/Exception"
@@ -312,11 +312,7 @@
         }
         asm.emitConstantPoolClass(asm.cpi());
         superClass = asm.cpi();
-
-        // emit constant pool entries for declaring class, parameter types and return type
-        cpClassPool.emitConstantPoolEntries();
         targetClass = cpClassPool.cpIndex(declaringClass);
-
         short serializationTargetClassIdx = (short) 0;
         if (forSerialization) {
             asm.emitConstantPoolUTF8(getClassName(serializationTargetClass, false));
@@ -336,6 +332,10 @@
             }
         }
         targetMethodRef = asm.cpi();
+
+        // emit constant pool entries for parameter types and return type
+        cpClassPool.emitConstantPoolEntries();
+
         if (isConstructor) {
             asm.emitConstantPoolUTF8("newInstance");
         } else {
@@ -841,7 +841,7 @@
 
         void emitConstantPoolEntries() {
             for (Class<?> c : types) {
-                cpEntries.put(c, emitConstantPoolEntries(c));
+                cpEntries.computeIfAbsent(c, this::emitConstantPoolEntries);
             }
         }
 
@@ -856,7 +856,7 @@
         }
 
         short cpIndex(Class<?> c) {
-            return cpEntries.get(c);
+            return cpEntries.computeIfAbsent(c, this::emitConstantPoolEntries);
         }
 
         short[] declaredValueTypes() {
--- a/test/hotspot/jtreg/ProblemList.txt	Thu Sep 06 14:17:29 2018 +0200
+++ b/test/hotspot/jtreg/ProblemList.txt	Fri Sep 07 13:09:45 2018 -0400
@@ -187,10 +187,6 @@
 serviceability/sa/TestJmapCoreMetaspace.java 8190936 generic-all
 serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java 8190936 generic-all
 
-serviceability/dcmd/vm/ClassHierarchyTest.java 8209899 generic-all
-serviceability/dcmd/vm/ClassLoaderHierarchyTest.java 8209899 generic-all
-serviceability/dcmd/vm/ShowReflectionTargetTest.java 8209899 generic-all
-
 #############################################################################
 
 # :hotspot_misc
--- a/test/jdk/ProblemList.txt	Thu Sep 06 14:17:29 2018 +0200
+++ b/test/jdk/ProblemList.txt	Fri Sep 07 13:09:45 2018 -0400
@@ -540,10 +540,6 @@
 com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java 8030957 aix-all
 com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java  8030957 aix-all
 
-# Valhalla...
-
-com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java 8209899 generic-all
-
 ############################################################################
 
 # jdk_jmx