[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 36/51] tcg: Remove CF_IGNORE_ICOUNT
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 36/51] tcg: Remove CF_IGNORE_ICOUNT |
Date: |
Wed, 25 Oct 2017 11:35:20 +0200 |
Now that we have curr_cflags, we can include CF_USE_ICOUNT
early and then remove it as necessary.
Reviewed-by: Emilio G. Cota <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
include/exec/exec-all.h | 17 +++++++++--------
accel/tcg/cpu-exec.c | 16 +++++++++-------
accel/tcg/translate-all.c | 3 ---
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index a3bd3e7abd..f14c6a56eb 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -22,6 +22,7 @@
#include "qemu-common.h"
#include "exec/tb-context.h"
+#include "sysemu/cpus.h"
/* allow to see translation results - the slowdown should be negligible, so we
leave it */
#define DEBUG_DISAS
@@ -319,13 +320,12 @@ struct TranslationBlock {
size <= TARGET_PAGE_SIZE) */
uint16_t icount;
uint32_t cflags; /* compile flags */
-#define CF_COUNT_MASK 0x7fff
-#define CF_LAST_IO 0x8000 /* Last insn may be an IO access. */
-#define CF_NOCACHE 0x10000 /* To be freed after execution */
-#define CF_USE_ICOUNT 0x20000
-#define CF_IGNORE_ICOUNT 0x40000 /* Do not generate icount code */
-#define CF_INVALID 0x80000 /* TB is stale. Setters must acquire tb_lock */
-#define CF_PARALLEL 0x100000 /* Generate code for a parallel context */
+#define CF_COUNT_MASK 0x00007fff
+#define CF_LAST_IO 0x00008000 /* Last insn may be an IO access. */
+#define CF_NOCACHE 0x00010000 /* To be freed after execution */
+#define CF_USE_ICOUNT 0x00020000
+#define CF_INVALID 0x00040000 /* TB is stale. Setters need tb_lock */
+#define CF_PARALLEL 0x00080000 /* Generate code for a parallel context */
/* cflags' mask for hashing/comparison */
#define CF_HASH_MASK \
(CF_COUNT_MASK | CF_LAST_IO | CF_USE_ICOUNT | CF_PARALLEL)
@@ -380,7 +380,8 @@ static inline uint32_t tb_cflags(const TranslationBlock *tb)
/* current cflags for hashing/comparison */
static inline uint32_t curr_cflags(void)
{
- return parallel_cpus ? CF_PARALLEL : 0;
+ return (parallel_cpus ? CF_PARALLEL : 0)
+ | (use_icount ? CF_USE_ICOUNT : 0);
}
void tb_free(TranslationBlock *tb);
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 849b54d0b0..b44c7941aa 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -198,17 +198,19 @@ static void cpu_exec_nocache(CPUState *cpu, int
max_cycles,
TranslationBlock *orig_tb, bool ignore_icount)
{
TranslationBlock *tb;
+ uint32_t cflags = curr_cflags() | CF_NOCACHE;
+
+ if (ignore_icount) {
+ cflags &= ~CF_USE_ICOUNT;
+ }
/* Should never happen.
We only end up here when an existing TB is too long. */
- if (max_cycles > CF_COUNT_MASK)
- max_cycles = CF_COUNT_MASK;
+ cflags |= MIN(max_cycles, CF_COUNT_MASK);
tb_lock();
- tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flags,
- max_cycles | CF_NOCACHE
- | (ignore_icount ? CF_IGNORE_ICOUNT : 0)
- | curr_cflags());
+ tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base,
+ orig_tb->flags, cflags);
tb->orig_tb = orig_tb;
tb_unlock();
@@ -229,7 +231,7 @@ void cpu_exec_step_atomic(CPUState *cpu)
TranslationBlock *tb;
target_ulong cs_base, pc;
uint32_t flags;
- uint32_t cflags = 1 | CF_IGNORE_ICOUNT;
+ uint32_t cflags = 1;
uint32_t cf_mask = cflags & CF_HASH_MASK;
if (sigsetjmp(cpu->jmp_env, 0) == 0) {
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index dcd47cd692..9fa94340dd 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1274,9 +1274,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
assert_memory_lock();
phys_pc = get_page_addr_code(env, pc);
- if (use_icount && !(cflags & CF_IGNORE_ICOUNT)) {
- cflags |= CF_USE_ICOUNT;
- }
tb = tb_alloc(pc);
if (unlikely(!tb)) {
--
2.13.6
- [Qemu-devel] [PULL 31/51] target/sh4: check CF_PARALLEL instead of parallel_cpus, (continued)
- [Qemu-devel] [PULL 31/51] target/sh4: check CF_PARALLEL instead of parallel_cpus, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 25/51] tcg: convert tb->cflags reads to tb_cflags(tb), Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 29/51] target/m68k: check CF_PARALLEL instead of parallel_cpus, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 33/51] tcg: check CF_PARALLEL instead of parallel_cpus, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 30/51] target/s390x: check CF_PARALLEL instead of parallel_cpus, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 34/51] cpu-exec: lookup/generate TB outside exclusive region during step_atomic, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 32/51] target/sparc: check CF_PARALLEL instead of parallel_cpus, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 35/51] tcg: Add CF_LAST_IO + CF_USE_ICOUNT to CF_HASH_MASK, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 39/51] translate-all: report correct avg host TB size, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 37/51] translate-all: use a binary search tree to track TBs in TBContext, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 36/51] tcg: Remove CF_IGNORE_ICOUNT,
Richard Henderson <=
- [Qemu-devel] [PULL 38/51] exec-all: rename tb_free to tb_remove, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 43/51] tcg: introduce **tcg_ctxs to keep track of all TCGContext's, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 42/51] gen-icount: fold exitreq_label into TCGContext, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 40/51] tcg: take tb_ctx out of TCGContext, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 44/51] tcg: distribute profiling counters across TCGContext's, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 45/51] tcg: allocate optimizer temps with tcg_malloc, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 46/51] osdep: introduce qemu_mprotect_rwx/none, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 41/51] tcg: define tcg_init_ctx and make tcg_ctx a pointer, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 51/51] translate-all: exit from tb_phys_invalidate if qht_remove fails, Richard Henderson, 2017/10/25
- [Qemu-devel] [PULL 49/51] tcg: enable multiple TCG contexts in softmmu, Richard Henderson, 2017/10/25