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

JEP 399: Intermediate-Representation Graph Serialization

XMLWordPrintable

    • Igor Ignatyev
    • Feature
    • Open
    • Implementation
    • hotspot dash compiler dash dev at openjdk dot java dot net
    • M
    • M
    • 399

      Summary

      To aid in testing, create a facility to serialize and deserialize the intermediate-representation (IR) graphs used in the HotSpot run-time compilers.

      Non-Goals

      It is not a goal to provide a means to serialize IR graphs for purposes other than testing.

      Motivation

      It is not possible, today, for HotSpot run-time compiler tests to test compiler optimizations directly. To test a specific optimization, they resort to manipulating the JVM into a state in which that optimization will be performed. These are “gray box” tests, since they depend upon HotSpot implementation details but do not have access to HotSpot internals. They are fragile, since a change in the implementation can render a test useless.

      Most run-time compiler optimizations operate upon an IR graph. If we could load a graph into the JVM, perform a specific optimization on it, and then export it for analysis then we could write stable and robust optimizer tests that do not depend upon HotSpot implementation details. This would also simplify the development of optimizer regression tests.

      Description

      We propose to introduce new HotSpot WhiteBox APIs to import an IR graph, perform a specific optimization on it, and then export it:

      • IRHandle import(InputStream)
      • IRHandle optimize(IRHandle, OptimizationEnum)
      • InputStream export(IRHandle)

      where IRHandle is a reference to an IR graph object and OptimizationEnum is an enumeration of all supported optimizations.

      There is already a serial format for the C2 IR, namely the XML format used by the Ideal Graph Visualizer (IGV). We propose to use that format, extending it as necessary for the C1 IR. Using the IGV format will also allow us to enhance the IGV tool so that it can serve as a WSYIWYG-editor for IR graphs.

      Risks and Assumptions

      Adding this code to product builds will slightly increase the size of libjvm.so. If that becomes an issue then we can move it into a separate dynamically-linked library.

            epavlova Ekaterina Pavlova
            iignatyev Igor Ignatyev (Inactive)
            Igor Ignatyev Igor Ignatyev (Inactive)
            Aleksandre Iline, Mikael Vidstedt, Vladimir Kozlov
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated: