mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
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>
This commit is contained in:
parent
db8aaae822
commit
bbc17caf81
2 changed files with 68 additions and 12 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue