diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2024-12-18 07:42:48 -0600 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-12-19 19:36:37 +0100 |
commit | ef1ac71ff0f2272ab8af4419597ba204e498766f (patch) | |
tree | 3077535ca188897364136f6fc02d526ead6abe00 /rust/qemu-api-macros | |
parent | 5fcabe628b8140691dab834a22be549d242b24bd (diff) | |
download | qemu-ef1ac71ff0f2272ab8af4419597ba204e498766f.zip qemu-ef1ac71ff0f2272ab8af4419597ba204e498766f.tar.gz qemu-ef1ac71ff0f2272ab8af4419597ba204e498766f.tar.bz2 |
include/hw/qdev-properties: Shrink struct Property
Before, via pahole:
arm32, a 32-bit host which aligns uint64_t:
struct Property {
const char * name; /* 0 4 */
const PropertyInfo * info; /* 4 4 */
ptrdiff_t offset; /* 8 4 */
uint8_t bitnr; /* 12 1 */
/* XXX 3 bytes hole, try to pack */
uint64_t bitmask; /* 16 8 */
_Bool set_default; /* 24 1 */
/* XXX 7 bytes hole, try to pack */
union {
int64_t i; /* 32 8 */
uint64_t u; /* 32 8 */
} defval; /* 32 8 */
int arrayoffset; /* 40 4 */
const PropertyInfo * arrayinfo; /* 44 4 */
int arrayfieldsize; /* 48 4 */
const char * link_type; /* 52 4 */
/* size: 56, cachelines: 1, members: 11 */
/* sum members: 46, holes: 2, sum holes: 10 */
};
arm64, an arbitrary 64-bit host:
struct Property {
const char * name; /* 0 8 */
const PropertyInfo * info; /* 8 8 */
ptrdiff_t offset; /* 16 8 */
uint8_t bitnr; /* 24 1 */
/* XXX 7 bytes hole, try to pack */
uint64_t bitmask; /* 32 8 */
_Bool set_default; /* 40 1 */
/* XXX 7 bytes hole, try to pack */
union {
int64_t i; /* 48 8 */
uint64_t u; /* 48 8 */
} defval; /* 48 8 */
int arrayoffset; /* 56 4 */
/* XXX 4 bytes hole, try to pack */
const PropertyInfo * arrayinfo; /* 64 8 */
int arrayfieldsize; /* 72 4 */
/* XXX 4 bytes hole, try to pack */
const char * link_type; /* 80 8 */
/* size: 88, cachelines: 2, members: 11 */
/* sum members: 66, holes: 4, sum holes: 22 */
};
Afterward there are no holes in either structure.
For arm32, size 48, padding 2, saved 8 bytes.
For arm64, size 72, padding 6, saved 16 bytes.
Saves 20k from qemu-system-aarch64 on a 64-bit host.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Lei Yang <leiyang@redhat.com>
Link: https://lore.kernel.org/r/20241218134251.4724-22-richard.henderson@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/qemu-api-macros')
0 files changed, 0 insertions, 0 deletions