[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 22/39] tcg: Extract removing of jumps to TB from tb_p
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 22/39] tcg: Extract removing of jumps to TB from tb_phys_invalidate() |
Date: |
Thu, 12 May 2016 14:13:23 -1000 |
From: Sergey Fedorov <address@hidden>
Move the code for removing jumps to a TB out of tb_phys_invalidate() to
a separate static inline function tb_jmp_unlink(). This simplifies
tb_phys_invalidate() and improves code structure.
Signed-off-by: Sergey Fedorov <address@hidden>
Signed-off-by: Sergey Fedorov <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
translate-all.c | 44 ++++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/translate-all.c b/translate-all.c
index 5e057ba..9a57aab 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -962,14 +962,37 @@ static inline void tb_reset_jump(TranslationBlock *tb,
int n)
tb_set_jmp_target(tb, n, addr);
}
+/* remove any jumps to the TB */
+static inline void tb_jmp_unlink(TranslationBlock *tb)
+{
+ uintptr_t tb1, tb2;
+ unsigned int n1;
+
+ tb1 = tb->jmp_list_first;
+ for (;;) {
+ TranslationBlock *tmp_tb;
+ n1 = tb1 & 3;
+ if (n1 == 2) {
+ break;
+ }
+ tmp_tb = (TranslationBlock *)(tb1 & ~3);
+ tb2 = tmp_tb->jmp_list_next[n1];
+ tb_reset_jump(tmp_tb, n1);
+ tmp_tb->jmp_list_next[n1] = (uintptr_t)NULL;
+ tb1 = tb2;
+ }
+
+ assert(((uintptr_t)tb & 3) == 0);
+ tb->jmp_list_first = (uintptr_t)tb | 2; /* fail safe */
+}
+
/* invalidate one TB */
void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
{
CPUState *cpu;
PageDesc *p;
- unsigned int h, n1;
+ unsigned int h;
tb_page_addr_t phys_pc;
- uintptr_t tb1, tb2;
/* remove the TB from the hash list */
phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
@@ -1003,22 +1026,7 @@ void tb_phys_invalidate(TranslationBlock *tb,
tb_page_addr_t page_addr)
tb_remove_from_jmp_list(tb, 1);
/* suppress any remaining jumps to this TB */
- tb1 = tb->jmp_list_first;
- for (;;) {
- TranslationBlock *tmp_tb;
- n1 = tb1 & 3;
- if (n1 == 2) {
- break;
- }
- tmp_tb = (TranslationBlock *)(tb1 & ~3);
- tb2 = tmp_tb->jmp_list_next[n1];
- tb_reset_jump(tmp_tb, n1);
- tmp_tb->jmp_list_next[n1] = (uintptr_t)NULL;
- tb1 = tb2;
- }
-
- assert(((uintptr_t)tb & 3) == 0);
- tb->jmp_list_first = (uintptr_t)tb | 2; /* fail safe */
+ tb_jmp_unlink(tb);
tcg_ctx.tb_ctx.tb_phys_invalidate_count++;
}
--
2.5.5
- [Qemu-devel] [PULL 13/39] translate-all: remove redundant setting of tcg_ctx.code_gen_buffer_size, (continued)
- [Qemu-devel] [PULL 13/39] translate-all: remove redundant setting of tcg_ctx.code_gen_buffer_size, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 15/39] translate-all: Adjust 256mb testing for mips64, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 14/39] translate-all: add missing munmap of the code_gen guard page for MIPS, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 16/39] tcg: Clean up direct block chaining data fields, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 17/39] tcg: Use uintptr_t type for jmp_list_{next|first} fields of TB, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 18/39] tcg: Rearrange tb_link_page() to avoid forward declaration, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 19/39] tcg: Init TB's direct jumps before making it visible, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 21/39] tcg: Rename tb_jmp_remove() to tb_remove_from_jmp_list(), Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 20/39] tcg: Clarify thread safety check in tb_add_jump(), Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 23/39] tcg: Clean up tb_jmp_unlink(), Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 22/39] tcg: Extract removing of jumps to TB from tb_phys_invalidate(),
Richard Henderson <=
- [Qemu-devel] [PULL 24/39] tcg: Clean up direct block chaining safety checks, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 26/39] tcg: code_bitmap and code_write_count are not used by user-mode emulation, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 25/39] tcg: Allow goto_tb to any target PC in user mode, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 27/39] tcg: reorganize tb_find_physical loop, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 28/39] cpu-exec: elide more icount code if CONFIG_USER_ONLY, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 29/39] tcg: Clean up from 'next_tb', Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 31/39] cpu-exec: Move TB chaining into tb_find_fast(), Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 30/39] tcg: Rework tb_invalidated_flag, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 33/39] cpu-exec: Remove relic orphaned comment, Richard Henderson, 2016/05/12
- [Qemu-devel] [PULL 32/39] tcg: Remove needless CPUState::current_tb, Richard Henderson, 2016/05/12