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

Use separate CodeHeap for code buffers

XMLWordPrintable

      Code buffers are buffers where C1/C2 compilers generate code to. When compilation finishes, code is relocated to a specific code heap where it is executed. We never execute code from code buffers.

      With UseDynamicNumberOfCompilerThreads set to true by default, we have a number of compiler threads changing from 1 to CICompilerCount. For each compiler thread a code buffer needs to be allocated from a code heap. The allocated code buffers are deallocated when corresponding compiler threads die.

      Collocating code buffers with executed code causes the following issues:
      - In non-tiered compilation mode, when a lot of compilations happen, CICompilerCount threads use CICompilerCount code buffers. This reduces space available for compiled code. For example on 64 core Graviton 2 system, CICompilerCount is 18, ReservedCodeCacheSize is 48M, the estimated size of a code buffer is 196675 bytes. 18 compiler threads will use ~3.4M out of 48M.
      - Dynamic allocation/deallocation of code buffers causes fragmentation in a code heap.
      - On platforms with fixed-length instructions, direct calls and jumps have limited distance, for example 128MB for arm64, the smaller the size of the memory with executed code the better. Code buffers increase the size of CodeCache. We need to use indirect calls/jumps.

      To avoid the issues, we can have a separate CodeHeap for code buffers, like a non-nmethod code heap in tiered compilation with the segmented code cache. With the separate CodeHeap for code buffers we will need to update the code calculating CICompilerCount.

            eastigeevich Evgeny Astigeevich
            eastigeevich Evgeny Astigeevich
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: