Optimize TemplateInterpreter dispatch table placement

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P4
    • tbd
    • Affects Version/s: 20
    • Component/s: 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)

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

              Created:
              Updated:
              Resolved: