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

Optimize TemplateInterpreter dispatch table placement

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 20
    • hotspot

      Template interpreter uses a large DispatchTable to get to the next bytecode. The dispatch sequence is at the end of almost all interpreter codelets, looks like this:

      ```
         movabs $0x7f3a17c47840,%r10 ; <--- dispatch table
         jmpq *(%r10,%rbx,8) ; <--- jump to relevant bytecode entry
      ```
      (14 bytes)

      Those large immediate constants can be optimized to be RIP-relative at least on x86_64, so that we save about 3 bytes per codelet, and about a kilobyte of interpreter code. The proof-of-concept patch does the dispatch as:

      ```
         lea -0x7b9d(%rip),%r10 # 0x00007f567cd9f600
         jmpq *(%r10,%rbx,8)
      ```
      (11 bytes)

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: