[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop
From: |
sergey . fedorov |
Subject: |
[Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop |
Date: |
Thu, 17 Mar 2016 16:46:19 +0300 |
From: Paolo Bonzini <address@hidden>
Use a continue statement.
Signed-off-by: Paolo Bonzini <address@hidden>
[Sergey Fedorov: Fix moving to list head in case of no TB]
Signed-off-by: Sergey Fedorov <address@hidden>
---
cpu-exec.c | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index fd92452f16f6..f90482eff778 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -225,37 +225,37 @@ static TranslationBlock *tb_find_physical(CPUState *cpu,
phys_pc = get_page_addr_code(env, pc);
phys_page1 = phys_pc & TARGET_PAGE_MASK;
h = tb_phys_hash_func(phys_pc);
- ptb1 = &tcg_ctx.tb_ctx.tb_phys_hash[h];
- for(;;) {
- tb = *ptb1;
- if (!tb) {
- return NULL;
+ for (ptb1 = &tcg_ctx.tb_ctx.tb_phys_hash[h];
+ (tb = *ptb1) != NULL;
+ ptb1 = &tb->phys_hash_next) {
+ if (tb->pc != pc ||
+ tb->page_addr[0] != phys_page1 ||
+ tb->cs_base != cs_base ||
+ tb->flags != flags) {
+ continue;
}
- if (tb->pc == pc &&
- tb->page_addr[0] == phys_page1 &&
- tb->cs_base == cs_base &&
- tb->flags == flags) {
- /* check next page if needed */
- if (tb->page_addr[1] != -1) {
- tb_page_addr_t phys_page2;
-
- virt_page2 = (pc & TARGET_PAGE_MASK) +
- TARGET_PAGE_SIZE;
- phys_page2 = get_page_addr_code(env, virt_page2);
- if (tb->page_addr[1] == phys_page2) {
- break;
- }
- } else {
+
+ /* check next page if needed */
+ if (tb->page_addr[1] != -1) {
+ tb_page_addr_t phys_page2;
+
+ virt_page2 = (pc & TARGET_PAGE_MASK) +
+ TARGET_PAGE_SIZE;
+ phys_page2 = get_page_addr_code(env, virt_page2);
+ if (tb->page_addr[1] == phys_page2) {
break;
}
+ } else {
+ break;
}
- ptb1 = &tb->phys_hash_next;
}
- /* Move the TB to the head of the list */
- *ptb1 = tb->phys_hash_next;
- tb->phys_hash_next = tcg_ctx.tb_ctx.tb_phys_hash[h];
- tcg_ctx.tb_ctx.tb_phys_hash[h] = tb;
+ if (tb) {
+ /* Move the TB to the head of the list */
+ *ptb1 = tb->phys_hash_next;
+ tb->phys_hash_next = tcg_ctx.tb_ctx.tb_phys_hash[h];
+ tcg_ctx.tb_ctx.tb_phys_hash[h] = tb;
+ }
return tb;
}
--
2.7.3
- [Qemu-devel] [PATCH 3/5] tcg: always keep jump target and tb->jmp_next consistent, (continued)
[Qemu-devel] [PATCH 5/5] tcg: move tb_invalidated_flag to CPUState, sergey . fedorov, 2016/03/17
[Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop,
sergey . fedorov <=
- Re: [Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop, Peter Maydell, 2016/03/17
- Re: [Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop, Alex Bennée, 2016/03/22
- Re: [Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop, Paolo Bonzini, 2016/03/22
- Re: [Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop, Sergey Fedorov, 2016/03/29
- Re: [Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop, Paolo Bonzini, 2016/03/29
- Re: [Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop, Sergey Fedorov, 2016/03/29
- Re: [Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop, Alex Bennée, 2016/03/29
- Re: [Qemu-devel] [PATCH 2/5] tcg: reorganize tb_find_physical loop, Sergey Fedorov, 2016/03/29
[Qemu-devel] [PATCH 1/5] tcg: code_bitmap is not used by user-mode emulation, sergey . fedorov, 2016/03/17