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

Make Xerces DatatypeException stackless

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11, 17, 18, 19
    • Fix Version/s: 19
    • Component/s: xml

      Description

      Profiling of SPECjvm2008:xml.validation shows there are lots of InvalidateDataTypeValueExceptions are thrown from Xerces. See screenshot for async-profiler stack trace.

      It does not look like those exceptions leak outside javax.xml. The uses of exception or its subclasses (`InvalidDatatypeValueException`, `InvalidDatatypeFacetException`) take the form of:

      ```
                      catch (InvalidDatatypeValueException ex) {
                          fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                     ex.getKey(),
                                                     ex.getArgs(),
                                                     XMLErrorReporter.SEVERITY_ERROR );
                      }
      ```

      ...so they don't seem to use the stack traces: only key, args, message is used. Which means we can turn `DatatypeException` stackless, and save some cycles on throws.

      This improves xml.validation performance for about +3%.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shade Aleksey Shipilev
              Reporter:
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: