tcg/optimize: fix setcond2 optimization

When setcond2 is rewritten into setcond, the state of the destination
temp should be reset, so that a copy of the previous value is not
used instead of the result.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
qapi: qapi-types.py, native list support

Teach type generators about native types so they can generate the
appropriate linked list types.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qapi: qapi-visit.py, fix list handling for union types

Currently we assume non-list types when generating visitor routines for
union types. This is broken, since values like ['Type'] need to mapped
to 'TypeList'.

We already have a type_name() function to handle this that we use for
generating struct visitors, so use that here as well.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qapi: qapi-visit.py, native list support

Teach visitor generators about native types so they can generate the
appropriate visitor routines.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qapi: enable generation of native list code

Also, fix a dependency issue with libqemuutil: qemu-sockets.c needs
qapi-types.c/qapi-visit.c

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qapi: fix leak in unit tests

qmp_output_get_qobject() increments the qobject's reference count. Since
we currently pass this straight into qobject_to_json() so we can feed
the data into a QMP input visitor, we never actually free the underlying
qobject when qmp_output_visitor_cleanup() is called. This causes leaks
on all of the QMP serialization tests.

Fix this by holding a pointer to the qobject and decref'ing it before
returning from qmp_deserialize().

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
json-parser: fix handling of large whole number values

Currently our JSON parser assumes that numbers lacking a mantissa are
integers and attempts to store them as QInt/int64 values. This breaks in
the case where the number overflows/underflows int64 values (which is
still valid JSON)

Fix this by detecting such cases and using a QFloat to store the value
instead.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qapi: fix visitor serialization tests for numbers/doubles

We never actually stored the stringified double values into the strings
before we did the comparisons. This left number/double values completely
uncovered in test-visitor-serialization tests.

Fixing this exposed a bug in our handling of large whole number values
in QEMU's JSON parser which is now fixed.

Simplify the code while we're at it by dropping the
calc_float_string_storage() craziness in favor of GStrings.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qapi: add native list coverage for visitor serialization tests

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qapi: add native list coverage for QMP output visitor tests

This exercises schema-generated visitors for native list types and does
some sanity checking on validity of serialized data.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qapi: add native list coverage for QMP input visitor tests

This exercises schema-generated visitors for native list types and does
some sanity checking on validity of deserialized data.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>