]> git.proxmox.com Git - mirror_qemu.git/commit - accel/tcg/translate-all.c
translate-all: iterate over TBs in a page with PAGE_FOR_EACH_TB
authorEmilio G. Cota <cota@braap.org>
Thu, 3 Aug 2017 22:37:15 +0000 (18:37 -0400)
committerRichard Henderson <richard.henderson@linaro.org>
Fri, 15 Jun 2018 17:42:55 +0000 (07:42 -1000)
commit1e05197f24c49d52f339de9053bb1d17082f1be3
treec5916328c8e13c3ffc4dc6967b724921e95b4bfc
parent128ed2278c4e6ad063f101c5dda7999b43f2d8a3
translate-all: iterate over TBs in a page with PAGE_FOR_EACH_TB

This commit does several things, but to avoid churn I merged them all
into the same commit. To wit:

- Use uintptr_t instead of TranslationBlock * for the list of TBs in a page.
  Just like we did in (c37e6d7e "tcg: Use uintptr_t type for
  jmp_list_{next|first} fields of TB"), the rationale is the same: these
  are tagged pointers, not pointers. So use a more appropriate type.

- Only check the least significant bit of the tagged pointers. Masking
  with 3/~3 is unnecessary and confusing.

- Introduce the TB_FOR_EACH_TAGGED macro, and use it to define
  PAGE_FOR_EACH_TB, which improves readability. Note that
  TB_FOR_EACH_TAGGED will gain another user in a subsequent patch.

- Update tb_page_remove to use PAGE_FOR_EACH_TB. In case there
  is a bug and we attempt to remove a TB that is not in the list, instead
  of segfaulting (since the list is NULL-terminated) we will reach
  g_assert_not_reached().

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
accel/tcg/translate-all.c
include/exec/exec-all.h