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

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 18, 19
    • Component/s: 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.

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

              Created:
              Updated: