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>
This commit is contained in:
Evgeny Voevodin 2013-02-01 01:47:23 +07:00 committed by Blue Swirl
parent 0b0d3320db
commit 5e5f07e08f
5 changed files with 79 additions and 70 deletions

View file

@ -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)