8195731: [Graal] runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java intermittently fails with Graal JIT
authorthartmann
Mon, 05 Feb 2018 08:08:01 +0100
changeset 48864 42a2dc52a4e9
parent 48863 ca551fa1c8cd
child 48865 53427ddce0a0
8195731: [Graal] runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java intermittently fails with Graal JIT Summary: Print detailed error if class transformation fails. Exclude tests from Graal testing. Reviewed-by: kvn, dholmes, sspitsyn
test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java
test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java
test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java
test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java
test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java
test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java
test/hotspot/jtreg/testlibrary/jvmti/TransformerAgent.java
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java	Mon Feb 05 07:20:26 2018 +0100
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java	Mon Feb 05 08:08:01 2018 +0100
@@ -29,6 +29,7 @@
  * @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
  * @requires vm.cds
  * @requires vm.flavor != "minimal"
+ * @requires !vm.graal.enabled
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java	Mon Feb 05 07:20:26 2018 +0100
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java	Mon Feb 05 08:08:01 2018 +0100
@@ -30,6 +30,7 @@
  * @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
  * @requires vm.cds
  * @requires vm.flavor != "minimal"
+ * @requires !vm.graal.enabled
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  *          java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java	Mon Feb 05 07:20:26 2018 +0100
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java	Mon Feb 05 08:08:01 2018 +0100
@@ -30,6 +30,7 @@
  * @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
  * @requires vm.cds
  * @requires vm.flavor != "minimal"
+ * @requires !vm.graal.enabled
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java	Mon Feb 05 07:20:26 2018 +0100
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java	Mon Feb 05 08:08:01 2018 +0100
@@ -30,6 +30,7 @@
  *     /test/hotspot/jtreg/runtime/appcds/test-classes /test/hotspot/jtreg/runtime/appcds/jvmti
  *     /test/hotspot/jtreg/testlibrary/jvmti
  * @requires vm.cds
+ * @requires !vm.graal.enabled
  * @modules java.base/jdk.internal.misc
  *          java.management
  *          jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java	Mon Feb 05 07:20:26 2018 +0100
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java	Mon Feb 05 08:08:01 2018 +0100
@@ -34,6 +34,7 @@
  *     /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes
  * @requires vm.cds
  * @requires vm.flavor != "minimal"
+ * @requires !vm.graal.enabled
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  *          java.management
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java	Mon Feb 05 07:20:26 2018 +0100
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java	Mon Feb 05 08:08:01 2018 +0100
@@ -34,6 +34,7 @@
  *     /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes
  * @requires vm.cds
  * @requires vm.flavor != "minimal"
+ * @requires !vm.graal.enabled
  * @modules java.base/jdk.internal.misc
  *          jdk.jartool/sun.tools.jar
  *          java.management
--- a/test/hotspot/jtreg/testlibrary/jvmti/TransformerAgent.java	Mon Feb 05 07:20:26 2018 +0100
+++ b/test/hotspot/jtreg/testlibrary/jvmti/TransformerAgent.java	Mon Feb 05 08:08:01 2018 +0100
@@ -57,17 +57,25 @@
 
 
     static class SimpleTransformer implements ClassFileTransformer {
-       public byte[] transform(ClassLoader loader, String name, Class<?> classBeingRedefined,
-                            ProtectionDomain pd, byte[] buffer) throws IllegalClassFormatException {
+        public byte[] transform(ClassLoader loader, String name, Class<?> classBeingRedefined,
+                                ProtectionDomain pd, byte[] buffer) throws IllegalClassFormatException {
+            try {
+                log("SimpleTransformer called for: " + name + "@" + incrCounter(name));
+                if (!shouldTransform(name))
+                    return null;
 
-            log("SimpleTransformer called for: " + name + "@" + incrCounter(name));
-            if (!shouldTransform(name))
-                return null;
-
-            log("transforming: class name = " + name);
-            int nrOfReplacements = TransformUtil.replace(buffer, TransformUtil.BeforePattern,
-                                                         TransformUtil.AfterPattern);
-            log("replaced the string, nrOfReplacements = " + nrOfReplacements);
+                log("transforming: class name = " + name);
+                int nrOfReplacements = TransformUtil.replace(buffer, TransformUtil.BeforePattern,
+                                                           TransformUtil.AfterPattern);
+                log("replaced the string, nrOfReplacements = " + nrOfReplacements);
+            } catch (Throwable t) {
+                // The retransform native code that called this method does not propagate
+                // exceptions. Instead of getting an uninformative generic error, catch
+                // problems here and print it, then exit.
+                log("Transformation failed!");
+                t.printStackTrace();
+                System.exit(1);
+            }
             return buffer;
         }