diff mbox series

[v2,3/3] tcg: Restart when exhausting the stack frame

Message ID 20210619134216.590423-4-richard.henderson@linaro.org
State New
Headers show
Series tcg: Fixes for temp_allocate_frame | expand

Commit Message

Richard Henderson June 19, 2021, 1:42 p.m. UTC
Assume that we'll have fewer temps allocated after
restarting with a fewer number of instructions.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/tcg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé June 19, 2021, 2:37 p.m. UTC | #1
On 6/19/21 3:42 PM, Richard Henderson wrote:
> Assume that we'll have fewer temps allocated after
> restarting with a fewer number of instructions.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  tcg/tcg.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/tcg/tcg.c b/tcg/tcg.c
index 47cc66f159..fec922fa9e 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3039,7 +3039,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;