-
Enhancement
-
Resolution: Won't Fix
-
P4
-
20
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)
```
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)