diff options
author | Evgeny Voevodin <evgenyvoevodin@gmail.com> | 2013-02-01 01:47:23 +0700 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2013-02-16 10:41:16 +0000 |
commit | 5e5f07e08f7ed8c8eb9b02d9f9c3c79cf95d65ee (patch) | |
tree | e5e495dbded2697b180c04de308701755297731b /include/exec | |
parent | 0b0d3320db74cde233ee7855ad32a9c121d20eb4 (diff) |
TCG: Move translation block variables to new context inside tcg_ctx: tb_ctx
It's worth to clean-up translation blocks variables and move them
into one context as was suggested by Swirl.
Also if we use this context directly inside tcg_ctx, then it
speeds up code generation a bit.
Signed-off-by: Evgeny Voevodin <evgenyvoevodin@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'include/exec')
-rw-r--r-- | include/exec/exec-all.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index d235ef8b2e..f685c28573 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -168,6 +168,25 @@ struct TranslationBlock { uint32_t icount; }; +#include "exec/spinlock.h" + +typedef struct TBContext TBContext; + +struct TBContext { + + TranslationBlock *tbs; + TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE]; + int nb_tbs; + /* any access to the tbs or the page table must use this lock */ + spinlock_t tb_lock; + + /* statistics */ + int tb_flush_count; + int tb_phys_invalidate_count; + + int tb_invalidated_flag; +}; + static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc) { target_ulong tmp; @@ -192,8 +211,6 @@ void tb_free(TranslationBlock *tb); void tb_flush(CPUArchState *env); void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); -extern TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE]; - #if defined(USE_DIRECT_JUMP) #if defined(CONFIG_TCG_INTERPRETER) @@ -275,12 +292,6 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, } } -#include "exec/spinlock.h" - -extern spinlock_t tb_lock; - -extern int tb_invalidated_flag; - /* The return address may point to the start of the next instruction. Subtracting one gets us the call instruction itself. */ #if defined(CONFIG_TCG_INTERPRETER) |