aboutsummaryrefslogtreecommitdiff
path: root/include/exec/cpu-all.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-09-13 11:21:53 -0400
committerRichard Henderson <richard.henderson@linaro.org>2019-10-28 10:29:22 +0100
commitbbc17caf81f94523e67c64a6e6cd8f869b7a1da5 (patch)
tree851892dda244310010e2e1a689312f12b9a1ea8c /include/exec/cpu-all.h
parentdb8aaae822dfdb18d993a686a146efcc63c216c0 (diff)
exec: Use const alias for TARGET_PAGE_BITS_VARY
Using a variable that is declared "const" for this tells the compiler that it may read the value once and assume that it does not change across function calls. For target_page_size, this means we have only one assert per function, and one read of the variable. This reduces the size of qemu-system-aarch64 by 8k. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/exec/cpu-all.h')
-rw-r--r--include/exec/cpu-all.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 255bb186ac..0b449b98ba 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -210,10 +210,16 @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val
/* page related stuff */
#ifdef TARGET_PAGE_BITS_VARY
-extern bool target_page_bits_decided;
-extern int target_page_bits;
-#define TARGET_PAGE_BITS ({ assert(target_page_bits_decided); \
- target_page_bits; })
+typedef struct {
+ bool decided;
+ int bits;
+} TargetPageBits;
+#if defined(CONFIG_ATTRIBUTE_ALIAS) || !defined(IN_EXEC_VARY)
+extern const TargetPageBits target_page;
+#else
+extern TargetPageBits target_page;
+#endif
+#define TARGET_PAGE_BITS ({ assert(target_page.decided); target_page.bits; })
#else
#define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
#endif