diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2019-04-15 22:06:39 -1000 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2019-04-24 13:04:33 -0700 |
commit | 6e6c4efed995d9eca6ae0cfdb2252df830262f50 (patch) | |
tree | 89c518ebe67031eded9b892e7a2fad26286c736a /tcg | |
parent | 8b86d6d25807e13a63ab6ea879f976b9f18cc45a (diff) |
tcg: Restart after TB code generation overflow
If a TB generates too much code, try again with fewer insns.
Fixes: https://bugs.launchpad.net/bugs/1824853
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r-- | tcg/tcg.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -3996,6 +3996,10 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) if (unlikely((void *)s->code_ptr > s->code_gen_highwater)) { return -1; } + /* Test for TB overflow, as seen by gen_insn_end_off. */ + if (unlikely(tcg_current_code_size(s) > UINT16_MAX)) { + return -2; + } } tcg_debug_assert(num_insns >= 0); s->gen_insn_end_off[num_insns] = tcg_current_code_size(s); |