From cbbbd4a1c9e94f83de73d7b93180fab055c0a587 Mon Sep 17 00:00:00 2001 From: Mamy Ratsimbazafy Date: Wed, 13 Jun 2018 01:20:57 +0200 Subject: [PATCH] Updated Interpreter optimization resources (markdown) --- Interpreter-optimization-resources.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Interpreter-optimization-resources.md b/Interpreter-optimization-resources.md index 81e4142..c35b94e 100644 --- a/Interpreter-optimization-resources.md +++ b/Interpreter-optimization-resources.md @@ -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