JDK-8236285 : [JVMCI] improve TranslatedException traces
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-12-19
  • Updated: 2022-02-06
  • Resolved: 2020-03-18
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.

To download the current JDK release, click here.
JDK 11 JDK 15
11.0.8-oracleFixed 15 b15Fixed
Description
The way TranslatedExceptions are currently printed can be very confusing. For example:

Caused by: jdk.vm.ci.hotspot.TranslatedException: [java.lang.ClassNotFoundException: java.security.AccessControlException] access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.misc")
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)

means that when translating an AccessControlException from the HotSpot heap to the libgraal heap, an AccessControlException instance could not be created in the libgraal heap as Class.forName("java.security.AccessControlException") failed (libgraal has very limited reflection). If this exception is raised while loading some other class, the ClassNotFoundException part of the exception trace can be very confusing.

There's no need to show the reason a translation failed; only the name of original, non-instantiable exception class needs to be shown:

Caused by: jdk.vm.ci.hotspot.TranslatedException[java.security.AccessControlException]: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.misc")
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)

By putting the original exception class name to the left of the ":" makes it clearer what is going on.

https://github.com/graalvm/labs-openjdk-11/commit/79940e44f174601b3df0afcd992725ffea63f247
Comments
11u backport Mark as jdk11u-jvmci-defer. The patch does not apply. Given the many missing JVMCI changes I skip this one.
18-05-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/acce42fd27a7 User: kvn Date: 2020-03-18 20:12:14 +0000
18-03-2020

http://cr.openjdk.java.net/~kvn/8236285/webrev.00/
18-03-2020