mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
tcg: Limit the number of ops in a TB
In6001f7729e
we partially attempt to address the branch displacement overflow caused by15fa08f845
. However, gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqtbX.c is a testcase that contains a TB so large as to overflow anyway. The limit here of 8000 ops produces a maximum output TB size of 24112 bytes on a ppc64le host with that test case. This is still much less than the maximum forward branch distance of 32764 bytes. Cc: qemu-stable@nongnu.org Fixes:15fa08f845
("tcg: Dynamically allocate TCGOps") Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
7eb30ef0ba
commit
abebf92597
2 changed files with 10 additions and 1 deletions
|
@ -655,6 +655,7 @@ struct TCGContext {
|
|||
int nb_globals;
|
||||
int nb_temps;
|
||||
int nb_indirects;
|
||||
int nb_ops;
|
||||
|
||||
/* goto_tb support */
|
||||
tcg_insn_unit *code_buf;
|
||||
|
@ -844,7 +845,12 @@ static inline TCGOp *tcg_last_op(void)
|
|||
/* Test for whether to terminate the TB for using too many opcodes. */
|
||||
static inline bool tcg_op_buf_full(void)
|
||||
{
|
||||
return false;
|
||||
/* This is not a hard limit, it merely stops translation when
|
||||
* we have produced "enough" opcodes. We want to limit TB size
|
||||
* such that a RISC host can reasonably use a 16-bit signed
|
||||
* branch within the TB.
|
||||
*/
|
||||
return tcg_ctx->nb_ops >= 8000;
|
||||
}
|
||||
|
||||
/* pool based memory allocation */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue