unicorn/qemu/include
Emilio G. Cota d3ada2feb5
tcg: allocate TB structs before the corresponding translated code
Allocating an arbitrarily-sized array of tbs results in either
(a) a lot of memory wasted or (b) unnecessary flushes of the code
cache when we run out of TB structs in the array.

An obvious solution would be to just malloc a TB struct when needed,
and keep the TB array as an array of pointers (recall that tb_find_pc()
needs the TB array to run in O(log n)).

Perhaps a better solution, which is implemented in this patch, is to
allocate TB's right before the translated code they describe. This
results in some memory waste due to padding to have code and TBs in
separate cache lines--for instance, I measured 4.7% of padding in the
used portion of code_gen_buffer when booting aarch64 Linux on a
host with 64-byte cache lines. However, it can allow for optimizations
in some host architectures, since TCG backends could safely assume that
the TB and the corresponding translated code are very close to each
other in memory. See this message by rth for a detailed explanation:

https://lists.gnu.org/archive/html/qemu-devel/2017-03/msg05172.html
Subject: Re: GSoC 2017 Proposal: TCG performance enhancements

Backports commit 6e3b2bfd6af488a896f7936e99ef160f8f37e6f2 from qemu
2018-03-03 17:05:49 -05:00
..
crypto Drop unused crypto source files 2018-02-17 15:23:57 -05:00
exec tcg: allocate TB structs before the corresponding translated code 2018-03-03 17:05:49 -05:00
fpu softfloat: Add float128_to_uint32_round_to_zero() 2018-03-02 08:33:09 -05:00
hw armv7m: Fix reads of CONTROL register bit 1 2018-03-02 13:26:38 -05:00
qapi qapi: Improve qobject visitor documentation 2018-03-02 12:24:21 -05:00
qemu qemu/atomic: Loosen restrictions for 64-bit ILP32 hosts 2018-03-02 20:06:39 -05:00
qom tcg: add options for enabling MTTCG 2018-03-02 09:25:01 -05:00
sysemu tcg: add options for enabling MTTCG 2018-03-02 09:25:01 -05:00
config.h
elf.h fix merge conflicts 2017-03-10 21:04:33 +08:00
glib_compat.h qapi: Improve qobject input visitor error reporting 2018-03-02 12:05:53 -05:00
qemu-common.h tcg: Add EXCP_ATOMIC 2018-02-27 11:57:58 -05:00