@@ -6155,7 +6155,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
dc->insn_pc = dc->pc;
disas_m68k_insn(env, dc);
- } while (!dc->is_jmp && !tcg_op_buf_full() &&
+ } while (!dc->is_jmp && !tcg_op_buf_full() && !tcg_temp_full(64) &&
!cs->singlestep_enabled &&
!singlestep &&
(pc_offset) < (TARGET_PAGE_SIZE - 32) &&
@@ -836,6 +836,12 @@ static inline bool tcg_op_buf_full(void)
{
return false;
}
+/* Test if we overflow the temp variable array */
+
+static inline bool tcg_temp_full(int marging)
+{
+ return tcg_ctx->nb_temps > TCG_MAX_TEMPS - marging;
+}
/* pool based memory allocation */
Since commit 15fa08f845 ("tcg: Dynamically allocate TCGOps") we have no limit to fill the TCGOps cache and we can fill the entire TCG variables array and overflow it. To avoid that, we stop the translation when the array is close to be full. Signed-off-by: Laurent Vivier <laurent@vivier.eu> --- target/m68k/translate.c | 2 +- tcg/tcg.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)