Updated Interpreter optimization resources (markdown)

Mamy Ratsimbazafy 2018-06-13 01:20:57 +02:00
parent e9328b7f0d
commit cbbbd4a1c9
1 changed files with 7 additions and 5 deletions

@ -44,15 +44,17 @@ that makes interpretation nice with the hardware branch predictor. Practical imp
Basically, instead of computed goto, you have computed "call" and each section called is ended by
the ret (return) instruction. Note that it the address called is still inline, there is no parameter pushed on the stack.
The trick is that CPU has the following types of predictors:
Linear or straight-line code
Conditional branches
Calls and Returns
Indirect branches
- Linear or straight-line code
- Conditional branches
- Calls and Returns
- Indirect branches
But direct threaded code / computed goto only makes use of indirect branches (goto). Context Threading seems to reduce
cache misses by up to 95%.
cache misses by up to 95% by exploiting all those predictors. However it requires assembly as there is no way to generate
arbitrary call and ret instructions.
## Codebases