tcg: Pass last_tb by value to tb_find_fast()

This is a small clean up. tb_find_fast() is a final consumer of this
variable so no need to pass it by reference. 'last_tb' is always updated
by subsequent cpu_loop_exec_tb() in cpu_exec().

This change also simplifies calling cpu_exec_nocache() in
cpu_handle_exception().

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Message-Id: <20160715175852.30749-3-sergey.fedorov@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Sergey Fedorov 2016-07-15 20:58:42 +03:00 committed by Paolo Bonzini
parent 2601505121
commit 4b7e69509d
1 changed files with 7 additions and 8 deletions

View File

@ -320,7 +320,7 @@ found:
} }
static inline TranslationBlock *tb_find_fast(CPUState *cpu, static inline TranslationBlock *tb_find_fast(CPUState *cpu,
TranslationBlock **last_tb, TranslationBlock *last_tb,
int tb_exit) int tb_exit)
{ {
CPUArchState *env = (CPUArchState *)cpu->env_ptr; CPUArchState *env = (CPUArchState *)cpu->env_ptr;
@ -342,7 +342,7 @@ static inline TranslationBlock *tb_find_fast(CPUState *cpu,
/* Ensure that no TB jump will be modified as the /* Ensure that no TB jump will be modified as the
* translation buffer has been flushed. * translation buffer has been flushed.
*/ */
*last_tb = NULL; last_tb = NULL;
cpu->tb_flushed = false; cpu->tb_flushed = false;
} }
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
@ -351,12 +351,12 @@ static inline TranslationBlock *tb_find_fast(CPUState *cpu,
* spanning two pages because the mapping for the second page can change. * spanning two pages because the mapping for the second page can change.
*/ */
if (tb->page_addr[1] != -1) { if (tb->page_addr[1] != -1) {
*last_tb = NULL; last_tb = NULL;
} }
#endif #endif
/* See if we can patch the calling TB. */ /* See if we can patch the calling TB. */
if (*last_tb && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { if (last_tb && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
tb_add_jump(*last_tb, tb_exit, tb); tb_add_jump(last_tb, tb_exit, tb);
} }
tb_unlock(); tb_unlock();
return tb; return tb;
@ -437,8 +437,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
} else if (replay_has_exception() } else if (replay_has_exception()
&& cpu->icount_decr.u16.low + cpu->icount_extra == 0) { && cpu->icount_decr.u16.low + cpu->icount_extra == 0) {
/* try to cause an exception pending in the log */ /* try to cause an exception pending in the log */
TranslationBlock *last_tb = NULL; /* Avoid chaining TBs */ cpu_exec_nocache(cpu, 1, tb_find_fast(cpu, NULL, 0), true);
cpu_exec_nocache(cpu, 1, tb_find_fast(cpu, &last_tb, 0), true);
*ret = -1; *ret = -1;
return true; return true;
#endif #endif
@ -621,7 +620,7 @@ int cpu_exec(CPUState *cpu)
cpu->tb_flushed = false; /* reset before first TB lookup */ cpu->tb_flushed = false; /* reset before first TB lookup */
for(;;) { for(;;) {
cpu_handle_interrupt(cpu, &last_tb); cpu_handle_interrupt(cpu, &last_tb);
tb = tb_find_fast(cpu, &last_tb, tb_exit); tb = tb_find_fast(cpu, last_tb, tb_exit);
cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit, &sc); cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit, &sc);
/* Try to align the host and virtual clocks /* Try to align the host and virtual clocks
if the guest is in advance */ if the guest is in advance */