JDK-8233745 : [JVMCI] TranslatedException should serialize classloader and module info
Type:Bug
Component:hotspot
Sub-Component:compiler
Affected Version:11,14
Priority:P4
Status:Resolved
Resolution:Fixed
Submitted:2019-11-07
Updated:2020-03-23
Resolved:2019-11-09
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
j.l.StackTraceElement was extended by classloader name, module name and version fields in JDK 9, so jdk.vm.ci.hotspot.TranslatedException should be updated to serialize/deserialize these fields.
Comments
OpenJDK 11 updates backport will follow after larger Graal integration, see https://github.com/oracle/graal/issues/2196
to illustrate the difference in string representations, comparison of "before" and "after" from the original version of the test:
diff[
2,31c2,31
< at app//jdk.vm.ci.hotspot.test.TestTranslatedException.encodeDecodeTest(TestTranslatedException.java:73)
< at java.base@14-internal/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
< at java.base@14-internal/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
< at java.base@14-internal/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
< at java.base@14-internal/java.lang.reflect.Method.invoke(Method.java:564)
< at app//org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
< at app//org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
< at app//org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
< at app//org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
< at app//org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
< at app//org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
< at app//org.testng.TestRunner.privateRun(TestRunner.java:773)
< at app//org.testng.TestRunner.run(TestRunner.java:623)
< at app//org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
< at app//org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
< at app//org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
< at app//org.testng.SuiteRunner.run(SuiteRunner.java:259)
< at app//org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
< at app//org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
< at app//org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
< at app//org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
< at app//org.testng.TestNG.run(TestNG.java:1018)
< at app//com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
< at app//com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
< at java.base@14-internal/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
< at java.base@14-internal/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
< at java.base@14-internal/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
< at java.base@14-internal/java.lang.reflect.Method.invoke(Method.java:564)
< at app//com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
< at java.base@14-internal/java.lang.Thread.run(Thread.java:833)
---
> at jdk.vm.ci.hotspot.test.TestTranslatedException.encodeDecodeTest(TestTranslatedException.java:73)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:564)
> at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
> at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
> at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
> at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
> at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
> at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
> at org.testng.TestRunner.privateRun(TestRunner.java:773)
> at org.testng.TestRunner.run(TestRunner.java:623)
> at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
> at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
> at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
> at org.testng.SuiteRunner.run(SuiteRunner.java:259)
> at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
> at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
> at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
> at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
> at org.testng.TestNG.run(TestNG.java:1018)
> at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
> at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:564)
> at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
> at java.base/java.lang.Thread.run(Thread.java:833)
91c91
< at app//jdk.vm.ci.hotspot.test.TestTranslatedException.encodeDecodeTest(TestTranslatedException.java:71)
---
> at jdk.vm.ci.hotspot.test.TestTranslatedException.encodeDecodeTest(TestTranslatedException.java:71)
]
where before is [
java.lang.ExceptionInInitializerError
at jdk.vm.ci.hotspot.test.TestTranslatedException.encodeDecodeTest(TestTranslatedException.java:73)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 9
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 8
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 7
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 6
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 5
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 4
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 3
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 2
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 1
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 0
... 30 more
Caused by: java.lang.ExceptionInInitializerError
at jdk.vm.ci.hotspot.test.TestTranslatedException.encodeDecodeTest(TestTranslatedException.java:71)
... 29 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: jdk.vm.ci.hotspot.test.TestTranslatedException$Untranslatable: test exception
... 30 more
Caused by: java.lang.NullPointerException
... 30 more
] and after is [
java.lang.ExceptionInInitializerError
at app//jdk.vm.ci.hotspot.test.TestTranslatedException.encodeDecodeTest(TestTranslatedException.java:73)
at java.base@14-internal/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base@14-internal/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base@14-internal/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base@14-internal/java.lang.reflect.Method.invoke(Method.java:564)
at app//org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at app//org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at app//org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
at app//org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
at app//org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at app//org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at app//org.testng.TestRunner.privateRun(TestRunner.java:773)
at app//org.testng.TestRunner.run(TestRunner.java:623)
at app//org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at app//org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at app//org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at app//org.testng.SuiteRunner.run(SuiteRunner.java:259)
at app//org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at app//org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at app//org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at app//org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at app//org.testng.TestNG.run(TestNG.java:1018)
at app//com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
at app//com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
at java.base@14-internal/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base@14-internal/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base@14-internal/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base@14-internal/java.lang.reflect.Method.invoke(Method.java:564)
at app//com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
at java.base@14-internal/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 9
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 8
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 7
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 6
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 5
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 4
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 3
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 2
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 1
... 30 more
Caused by: java.lang.ExceptionInInitializerError
... 30 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: java.lang.RuntimeException: 0
... 30 more
Caused by: java.lang.ExceptionInInitializerError
at app//jdk.vm.ci.hotspot.test.TestTranslatedException.encodeDecodeTest(TestTranslatedException.java:71)
... 29 more
Caused by: java.lang.reflect.InvocationTargetException: invoke
... 30 more
Caused by: jdk.vm.ci.hotspot.test.TestTranslatedException$Untranslatable: test exception
... 30 more
Caused by: java.lang.NullPointerException
... 30 more
]
08-11-2019
http://cr.openjdk.java.net/~iignatyev//8233745/webrev.00/index.html adds all new fields TranslatedException.
I wasn't able to make deserialize StackTraceElement to have the same string representation as original ones b/c StackTraceElement::declaringClassObject won't be set, as a result, JDK_NON_UPGRADEABLE_MODULE and BUILTIN_CLASS_LOADER bits won't be set either and StackTraceElement::toString has 'app/' as a classloader (won't be in original b/c dropClassLoaderName() is true) and version of java.base module (won't be in original b/c dropModuleVersion() is true); so I changed how TestTranslatedException compares original and decoded exceptions.