Updated Interpreter optimization resources (markdown)
parent
e9328b7f0d
commit
cbbbd4a1c9
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue