summaryrefslogtreecommitdiff
path: root/tcg/tcg.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2015-12-02 13:59:59 -0800
committerRichard Henderson <rth@twiddle.net>2016-02-09 10:19:32 +1100
commit23dceda62a3643f734b7aa474fa6052593ae1a70 (patch)
tree2d87c66e824a2fcd02556700ae3a3df6b0a5d296 /tcg/tcg.c
parente4a096b1cd4350eeca5dcdc391ab333d2083d7fd (diff)
downloadqemu-23dceda62a3643f734b7aa474fa6052593ae1a70.zip
tcg: Respect highwater in tcg_out_tb_finalize
Undo the workaround at b17a6d3390f87620735f7efb03bb1c96682ff449. If there are lots of memory operations in a TB, the slow path code can exceed the highwater reservation. Add a check within the loop. Tested-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r--tcg/tcg.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index be765ad3a8..cd62d81c2a 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -111,7 +111,7 @@ static void tcg_out_call(TCGContext *s, tcg_insn_unit *target);
static int tcg_target_const_match(tcg_target_long val, TCGType type,
const TCGArgConstraint *arg_ct);
static void tcg_out_tb_init(TCGContext *s);
-static void tcg_out_tb_finalize(TCGContext *s);
+static bool tcg_out_tb_finalize(TCGContext *s);
@@ -389,11 +389,7 @@ void tcg_prologue_init(TCGContext *s)
/* Compute a high-water mark, at which we voluntarily flush the buffer
and start over. The size here is arbitrary, significantly larger
than we expect the code generation for any one opcode to require. */
- /* ??? We currently have no good estimate for, or checks in,
- tcg_out_tb_finalize. If there are quite a lot of guest memory ops,
- the number of out-of-line fragments could be quite high. In the
- short-term, increase the highwater buffer. */
- s->code_gen_highwater = s->code_gen_buffer + (total_size - 64*1024);
+ s->code_gen_highwater = s->code_gen_buffer + (total_size - 1024);
tcg_register_jit(s->code_gen_buffer, total_size);
@@ -2456,7 +2452,9 @@ int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf)
s->gen_insn_end_off[num_insns] = tcg_current_code_size(s);
/* Generate TB finalization at the end of block */
- tcg_out_tb_finalize(s);
+ if (!tcg_out_tb_finalize(s)) {
+ return -1;
+ }
/* flush instruction cache */
flush_icache_range((uintptr_t)s->code_buf, (uintptr_t)s->code_ptr);