tcg: Restart when exhausting the stack frame
authorRichard Henderson <richard.henderson@linaro.org>
Sat, 19 Jun 2021 13:32:03 +0000 (06:32 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Sat, 19 Jun 2021 21:51:51 +0000 (14:51 -0700)
Assume that we'll have fewer temps allocated after
restarting with a fewer number of instructions.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/tcg.c

index bdeea18234ff509e9161f8afb3dc8b43b6baf713..5e53c3348f8e163da06d35a78f02cbae1148391a 100644 (file)
--- 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;