-
Enhancement
-
Resolution: Unresolved
-
P4
-
18, 19
-
Fix Understood
-
generic
-
generic
If running with -XX:+OmitStackTraceInFastThrow (which is the default) C2 will optimize certain "hot" implicit exceptions (i.e. AIOOBE, NullPointerExceptions,..) and replace them by a static, pre-allocated exception without any stacktrace.
However, we can actually do better. Instead of using a single, pre-allocated exception object for all method we can let the compiler allocate specific exceptions for each method and fill them with at least one stack frame with the method /line-number information of the currently compiled method. If the method in question is being inlined, we can add stackframes for all callers up to the inlining depth of the method in question.
This optimization comes at no run-time costs because all the extra work will be done at compile time.
However, we can actually do better. Instead of using a single, pre-allocated exception object for all method we can let the compiler allocate specific exceptions for each method and fill them with at least one stack frame with the method /line-number information of the currently compiled method. If the method in question is being inlined, we can add stackframes for all callers up to the inlining depth of the method in question.
This optimization comes at no run-time costs because all the extra work will be done at compile time.
- relates to
-
JDK-8169685 C2: ClassCastException with empty message
-
- Closed
-
-
JDK-8046503 Ability to reset OmitStackTraceInFastThrow counter
-
- Open
-
-
JDK-8273563 Improve performance of implicit exceptions with -XX:-OmitStackTraceInFastThrow
-
- In Progress
-
-
JDK-4292742 NullPointerException with no stack trace
-
- Resolved
-
-
JDK-8073432 Object.getClass() throws stackless NPE, due to C2 intrinsic
-
- Resolved
-
- links to
-
Review openjdk/jdk/5392
(1 links to)