aboutsummaryrefslogtreecommitdiff
path: root/tcg/tcg.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-11-26 15:18:44 -0800
committerRichard Henderson <richard.henderson@linaro.org>2023-01-17 09:55:13 -1000
commitb52a2c03b7d36694c21d70bcd46d68aaba5b0840 (patch)
treed00737c5c74f17be63481174ff1c72c4ecde7e8f /tcg/tcg.c
parent7f83167c612438bb46ef01b5b23f7b2a0827bdc4 (diff)
downloadqemu-b52a2c03b7d36694c21d70bcd46d68aaba5b0840.zip
qemu-b52a2c03b7d36694c21d70bcd46d68aaba5b0840.tar.gz
qemu-b52a2c03b7d36694c21d70bcd46d68aaba5b0840.tar.bz2
tcg: Introduce set_jmp_insn_offset
Similar to the existing set_jmp_reset_offset. Move any assert for TCG_TARGET_HAS_direct_jump into the new function (which now cannot be build-time). Will be unused if TCG_TARGET_HAS_direct_jump is constant 0, but we can't test for constant in the preprocessor, so just mark it G_GNUC_UNUSED. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg/tcg.c')
-rw-r--r--tcg/tcg.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 2574793..4092dac 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -313,6 +313,16 @@ static void set_jmp_reset_offset(TCGContext *s, int which)
s->tb_jmp_reset_offset[which] = tcg_current_code_size(s);
}
+static void G_GNUC_UNUSED set_jmp_insn_offset(TCGContext *s, int which)
+{
+ /*
+ * We will check for overflow at the end of the opcode loop in
+ * tcg_gen_code, where we bound tcg_current_code_size to UINT16_MAX.
+ */
+ tcg_debug_assert(TCG_TARGET_HAS_direct_jump);
+ s->tb_jmp_insn_offset[which] = tcg_current_code_size(s);
+}
+
/* Signal overflow, starting over with fewer guest insns. */
static G_NORETURN
void tcg_raise_tb_overflow(TCGContext *s)