From 5e5f07e08f7ed8c8eb9b02d9f9c3c79cf95d65ee Mon Sep 17 00:00:00 2001 From: Evgeny Voevodin Date: Fri, 1 Feb 2013 01:47:23 +0700 Subject: 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 Signed-off-by: Blue Swirl --- include/exec/exec-all.h | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'include/exec') 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) -- cgit v1.2.3