Signed-off-by: Richard Henderson <[email protected]>
---
include/hw/core/cpu.h | 4 ++--
accel/tcg/cpu-exec.c | 8 ++++----
accel/tcg/cputlb.c | 2 +-
accel/tcg/tb-maint.c | 2 +-
accel/tcg/translate-all.c | 2 +-
tcg/tcg-op.c | 2 +-
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 5b7c330047..5d1b624e6c 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -369,9 +369,11 @@ typedef union IcountDecr {
* @plugin_mem_cbs: active plugin memory callbacks
* @plugin_mem_value_low: 64 lower bits of latest accessed mem value.
* @plugin_mem_value_high: 64 higher bits of latest accessed mem value.
+ * @tb_jmp_cache: Hash table of recently accessed TranslationBlocks.
*/
typedef struct CPUNegativeOffsetState {
CPUTLB tlb;
+ struct CPUJumpCache *tb_jmp_cache;
#ifdef CONFIG_PLUGIN
/*
* The callback pointer are accessed via TCG (see gen_empty_mem_helper).
@@ -528,8 +530,6 @@ struct CPUState {
AddressSpace *as;
MemoryRegion *memory;
- struct CPUJumpCache *tb_jmp_cache;
-
GArray *gdb_regs;
int gdb_num_regs;
int gdb_num_g_regs;
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 4c20091ef5..2ed8f7c251 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -237,7 +237,7 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu,
TCGTBCPUState s)
tcg_debug_assert(!(s.cflags & CF_INVALID));
hash = tb_jmp_cache_hash_func(s.pc);
- jc = cpu->tb_jmp_cache;
+ jc = cpu->neg.tb_jmp_cache;
tb = qatomic_read(&jc->array[hash].tb);
if (likely(tb &&
@@ -1012,7 +1012,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc)
* for the fast lookup
*/
h = tb_jmp_cache_hash_func(s.pc);
- jc = cpu->tb_jmp_cache;
+ jc = cpu->neg.tb_jmp_cache;
jc->array[h].pc = s.pc;
qatomic_set(&jc->array[h].tb, tb);
}
@@ -1109,7 +1109,7 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp)
/* Pick up one-insn-per-tb and -d nochain from the command line. */
tcg_update_cflags(cpu);
- cpu->tb_jmp_cache = g_new0(CPUJumpCache, 1);
+ cpu->neg.tb_jmp_cache = g_new0(CPUJumpCache, 1);
tlb_init(cpu);
#ifndef CONFIG_USER_ONLY
tcg_iommu_init_notifier_list(cpu);
@@ -1127,5 +1127,5 @@ void tcg_exec_unrealizefn(CPUState *cpu)
#endif /* !CONFIG_USER_ONLY */
tlb_destroy(cpu);
- g_free_rcu(cpu->tb_jmp_cache, rcu);
+ g_free_rcu(cpu->neg.tb_jmp_cache, rcu);
}
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index dc83f3bad8..c777f5ac3f 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -149,7 +149,7 @@ static void tlb_window_reset(CPUTLBDesc *desc, int64_t ns,
static void tb_jmp_cache_clear_page(CPUState *cpu, vaddr page_addr)
{
- CPUJumpCache *jc = cpu->tb_jmp_cache;
+ CPUJumpCache *jc = cpu->neg.tb_jmp_cache;
int i, i0;
if (unlikely(!jc)) {
diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c
index 4313864d2c..ca1b0089fc 100644
--- a/accel/tcg/tb-maint.c
+++ b/accel/tcg/tb-maint.c
@@ -905,7 +905,7 @@ static void tb_jmp_cache_inval_tb(TranslationBlock *tb)
uint32_t h = tb_jmp_cache_hash_func(tb->pc);
CPU_FOREACH(cpu) {
- CPUJumpCache *jc = cpu->tb_jmp_cache;
+ CPUJumpCache *jc = cpu->neg.tb_jmp_cache;
if (qatomic_read(&jc->array[h].tb) == tb) {
qatomic_set(&jc->array[h].tb, NULL);
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index ea8257935e..3dd1714414 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -624,7 +624,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
*/
void tcg_flush_jmp_cache(CPUState *cpu)
{
- CPUJumpCache *jc = cpu->tb_jmp_cache;
+ CPUJumpCache *jc = cpu->neg.tb_jmp_cache;
/* During early initialization, the cache may not yet be allocated. */
if (unlikely(jc == NULL)) {
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 0040d149e0..7969875d20 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -1914,7 +1914,7 @@ static void gen_jc_probe(TCGTemp *pc, TCGTemp *cs_base,
uint32_t flags)
/* p = &jc->array[tb_jmp_cache_hash_func(pc)] */
gen_jc_hash(h, t, pc);
tcg_gen_ld(TCG_TYPE_I64, t, tcgv_ptr_temp(tcg_env),
- offsetof(CPUState, tb_jmp_cache) - sizeof(CPUState));
+ offsetof(CPUState, neg.tb_jmp_cache) - sizeof(CPUState));
tcg_gen_lea(TCG_TYPE_I64, p, t, h, 4, 0);
if (tcg_op_supported(INDEX_op_goto_jc, TCG_TYPE_PTR, 0)) {
--
2.53.0