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

need an implementation-private Java API for processor description

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P3 P3
    • tbd
    • 9, 10
    • hotspot

      Low-level platform code needs a way to query the characteristics of the CPU (or CPUs) that the JVM is running on.

      Known use cases include JITs written in Java (e.g., Graal), secondary code generators (e.g., for Project Sumatra or native code stubs), and processor-specific optimizations (e.g., vectorized CRC32 JDK-7088419).

      Some coarse-grained information is available in system properties (os.arch) and sun.misc.Unsafe (word size, page size) but these techniques do not scale to the new use cases.

      The key customers of this private API will be tools which generate or manage processor-specific code, especially for heavily-optimized platforms. This is a very small niche in the Java ecosystem, so there is no general requirement for portability or platform coverage.

      Requirements:

      - a restricted-use API (like sun.misc.Unsafe)
      - support multiple instances of distinct CPU classes (in case of heterogeneous systems)
      - identify basic processor attributes common to all CPUs, such as ISA, manufacturer, clock speed, part number
      - report basic architectural parameters such as word size, cache line size, and hardware memory model
      - provide access to ISA-specific attributes such configuration or version registers (e.g., as a long[] array of length dependent on the platform)
      - in the case of heterogeneous systems, distinguish between host and auxiliary CPUs

      Likely additional requirements:

      - provide information as needed about multiprocessor configuration
      - provide information as needed about memory interconnect
      - provide other information as needed from the HotSpot VM_Version API
      - reflect reasonable amounts of relevant information from facilities like /proc/cpuinfo (Linux) and sysinfo (Linux, Solaris)
      - support virtualization by optionally suppressing "TMI"

      Non-requirements:

      - reify CPU classification as Java class structure
      - provide ISA-related formatting services such as disassembly, assembly, etc.
      - provide operational methods that affect processor state such as interrupt masking, register set enabling, etc.
      - provide timers or counters that reflect processor state
      - describe processors running on nearby nodes or systems but outside the current JVM

            Unassigned Unassigned
            jrose John Rose
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: