From 732d58979c9d6ab1b955b65264a15d0696ea477e Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 19 Jun 2021 06:32:03 -0700 Subject: [PATCH] tcg: Restart when exhausting the stack frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Assume that we'll have fewer temps allocated after restarting with a fewer number of instructions. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tcg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index bdeea18234..5e53c3348f 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3038,7 +3038,11 @@ static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) assert(align <= TCG_TARGET_STACK_ALIGN); off = ROUND_UP(s->current_frame_offset, align); - assert(off + size <= s->frame_end); + + /* If we've exhausted the stack frame, restart with a smaller TB. */ + if (off + size > s->frame_end) { + tcg_raise_tb_overflow(s); + } s->current_frame_offset = off + size; ts->mem_offset = off;