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

Restructure CollectedHeap error printing

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • hotspot
    • gc

      Calling Universe::heap()->print_on_error() gets dispatched to the most specific implementation, which for some GCs is their own implementation instead of the default in CollectedHeap. Each GC-specific implementation calls back to CollectedHeap::print_on_error(), which then dispatches back into the specific implementation of print_on(). This is kind of awkward and creates a call-chain that's not straightforward to wrap your head around, jumping back and forth via CollectedHeap and the specific implementation.

      To make the call-chain cleaner, I propose making print_on_error() a pure virtual method in CollectedHeap, forcing each implementation of CollectedHeap to implement it on their own, making the call-chain stay inside the specific implementation. In addition, I also suggest we remove print_extended_on() and leave that to the GCs that want such functionality.

      Removing the common print_on_error() also means that GCs that do not print anything interesting for their barrier set (ZGC & Shenandoah) can omit printing barrier set information.

      To make print_on_error() consistent with print_on(), I also suggest we move the printing of "Heap:" to the caller of print_on_error() (only inside vmError.cpp). This is a trivial change for all GCs except ZGC, which requires some restructuring in its error printing.

            jsikstro Joel Sikstrom
            jsikstro Joel Sikstrom
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: