unicorn/qemu
Eric Blake 8f4a64398a
qapi: Don't special-case simple union wrappers
Simple unions were carrying a special case that hid their 'data'
QMP member from the resulting C struct, via the hack method
QAPISchemaObjectTypeVariant.simple_union_type(). But by using
the work we started by unboxing flat union and alternate
branches, coupled with the ability to visit the members of an
implicit type, we can now expose the simple union's implicit
type in qapi-types.h:

| struct q_obj_ImageInfoSpecificQCow2_wrapper {
| ImageInfoSpecificQCow2 *data;
| };
|
| struct q_obj_ImageInfoSpecificVmdk_wrapper {
| ImageInfoSpecificVmdk *data;
| };
...
| struct ImageInfoSpecific {
| ImageInfoSpecificKind type;
| union { /* union tag is @type */
| void *data;
|- ImageInfoSpecificQCow2 *qcow2;
|- ImageInfoSpecificVmdk *vmdk;
|+ q_obj_ImageInfoSpecificQCow2_wrapper qcow2;
|+ q_obj_ImageInfoSpecificVmdk_wrapper vmdk;
| } u;
| };

Doing this removes asymmetry between QAPI's QMP side and its
C side (both sides now expose 'data'), and means that the
treatment of a simple union as sugar for a flat union is now
equivalent in both languages (previously the two approaches used
a different layer of dereferencing, where the simple union could
be converted to a flat union with equivalent C layout but
different {} on the wire, or to an equivalent QMP wire form
but with different C representation). Using the implicit type
also lets us get rid of the simple_union_type() hack.

Of course, now all clients of simple unions have to adjust from
using su->u.member to using su->u.member.data; while this touches
a number of files in the tree, some earlier cleanup patches
helped minimize the change to the initialization of a temporary
variable rather than every single member access. The generated
qapi-visit.c code is also affected by the layout change:

|@@ -7393,10 +7393,10 @@ void visit_type_ImageInfoSpecific_member
| }
| switch (obj->type) {
| case IMAGE_INFO_SPECIFIC_KIND_QCOW2:
|- visit_type_ImageInfoSpecificQCow2(v, "data", &obj->u.qcow2, &err);
|+ visit_type_q_obj_ImageInfoSpecificQCow2_wrapper_members(v, &obj->u.qcow2, &err);
| break;
| case IMAGE_INFO_SPECIFIC_KIND_VMDK:
|- visit_type_ImageInfoSpecificVmdk(v, "data", &obj->u.vmdk, &err);
|+ visit_type_q_obj_ImageInfoSpecificVmdk_wrapper_members(v, &obj->u.vmdk, &err);
| break;
| default:
| abort();

Backports commit 32bafa8fdd098d52fbf1102d5a5e48d29398c0aa from qemu
2018-02-21 22:51:33 -05:00
..
crypto crypto: Clean up includes 2018-02-19 00:47:40 -05:00
default-configs
docs
fpu softfloat: Remove lingering fast casts 2018-02-20 19:04:22 -05:00
hw qom: Allow properties to be registered against classes 2018-02-21 21:00:56 -05:00
include qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE 2018-02-21 21:55:15 -05:00
qapi qapi: Don't box branches of flat unions 2018-02-20 16:44:55 -05:00
qobject qapi: Convert QType into QAPI built-in enum type 2018-02-19 21:47:05 -05:00
qom qom: Change object property iterator API contract 2018-02-21 21:03:58 -05:00
scripts qapi: Don't special-case simple union wrappers 2018-02-21 22:51:33 -05:00
target-arm target-arm: Fix translation level on early translation faults 2018-02-21 21:53:15 -05:00
target-i386 target-i386: Dump unknown opcodes with -d unimp 2018-02-21 21:37:16 -05:00
target-m68k tcg: Make store_dummy a TCGv 2018-02-21 00:24:40 -05:00
target-mips tcg: Make cpu_gpr a TCGv array 2018-02-21 01:02:46 -05:00
target-sparc tcg: Make cpu_regs_sparc a TCGv array 2018-02-21 01:50:28 -05:00
tcg tcg: Make cpu_regs_sparc a TCGv array 2018-02-21 01:50:28 -05:00
util error: ensure errno detail is printed with error_abort 2018-02-21 21:40:24 -05:00
aarch64.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
aarch64eb.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
accel.c all: Clean up includes 2018-02-19 01:34:28 -05:00
arm.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
armeb.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
CODING_STYLE
configure
COPYING
COPYING.LIB
cpu-exec-common.c exec: Clean up includes 2018-02-19 00:49:55 -05:00
cpu-exec.c exec: Clean up includes 2018-02-19 00:49:55 -05:00
cpus.c exec: Clean up includes 2018-02-19 00:49:55 -05:00
cputlb.c memory: Drop MemoryRegion.ram_addr 2018-02-21 08:53:08 -05:00
exec.c exec: fix early return from ram_block_add 2018-02-21 21:37:58 -05:00
gen_all_header.sh
glib_compat.c glib_compat: backport hashtable iterator interfaces 2018-02-21 13:18:44 -05:00
HACKING import 2015-08-21 15:04:50 +08:00
header_gen.py target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
ioport.c all: Clean up includes 2018-02-19 01:34:28 -05:00
LICENSE
m68k.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
Makefile qapi: Turn generators' mandatory option -i into an argument 2018-02-19 15:22:27 -05:00
Makefile.objs crypto: move crypto objects out of libqemuutil.la 2018-02-17 15:23:50 -05:00
Makefile.target tcg: split tcg_op_defs to -common 2018-02-17 15:23:51 -05:00
memory_mapping.c all: Clean up includes 2018-02-19 01:34:28 -05:00
memory.c qom: Allow properties to be registered against classes 2018-02-21 21:00:56 -05:00
mips64.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
mips64el.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
mips.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
mipsel.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
powerpc.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
qapi-schema.json qapi: Lazy creation of array types 2018-02-19 18:55:35 -05:00
qemu-log.c all: Clean up includes 2018-02-19 01:34:28 -05:00
qemu-timer.c all: Clean up includes 2018-02-19 01:34:28 -05:00
rules.mak
softmmu_template.h exec.c: Pass MemTxAttrs to iotlb_to_region so it uses the right AS 2018-02-17 23:19:00 -05:00
sparc64.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
sparc.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00
tcg-runtime.c all: Clean up includes 2018-02-19 01:34:28 -05:00
translate-all.c all: Clean up includes 2018-02-19 01:34:28 -05:00
translate-all.h translate-all: remove unnecessary argument to tb_invalidate_phys_range 2018-02-13 09:04:51 -05:00
translate-common.c exec: Clean up includes 2018-02-19 00:49:55 -05:00
unicorn_common.h qom/cpu: Add MemoryRegion property 2018-02-18 21:54:50 -05:00
VERSION
vl.c vl.c: Remove periods and exclamation points from error messages 2018-02-17 15:24:14 -05:00
vl.h
x86_64.h target-arm: Implement MRS (banked) and MSR (banked) instructions 2018-02-21 21:50:42 -05:00