Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8273392

Improve usability of stack-less exceptions due to -XX:+OmitStackTraceInFastThrow

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 18, 19
    • hotspot
    • 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.

            simonis Volker Simonis
            simonis Volker Simonis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: