[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 01/31] tcg: Adjust TCGContext.temps_in_use check
From: |
Richard Henderson |
Subject: |
[PATCH v4 01/31] tcg: Adjust TCGContext.temps_in_use check |
Date: |
Sun, 26 Feb 2023 19:36:31 -1000 |
Change the temps_in_use check to use assert not fprintf.
Move the assert for double-free before the check for count,
since that is the more immediate problem.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/tcg.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index a4a3da6804..06209e6160 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1375,16 +1375,14 @@ void tcg_temp_free_internal(TCGTemp *ts)
g_assert_not_reached();
}
-#if defined(CONFIG_DEBUG_TCG)
- s->temps_in_use--;
- if (s->temps_in_use < 0) {
- fprintf(stderr, "More temporaries freed than allocated!\n");
- }
-#endif
-
tcg_debug_assert(ts->temp_allocated != 0);
ts->temp_allocated = 0;
+#if defined(CONFIG_DEBUG_TCG)
+ assert(s->temps_in_use > 0);
+ s->temps_in_use--;
+#endif
+
idx = temp_idx(ts);
k = ts->base_type + (ts->kind == TEMP_NORMAL ? 0 : TCG_TYPE_COUNT);
set_bit(idx, s->free_temps[k].l);
--
2.34.1
- [PATCH v4 00/31] tcg: Simplify temporary usage, Richard Henderson, 2023/02/27
- [PATCH v4 01/31] tcg: Adjust TCGContext.temps_in_use check,
Richard Henderson <=
- [PATCH v4 02/31] accel/tcg: Pass max_insn to gen_intermediate_code by pointer, Richard Henderson, 2023/02/27
- [PATCH v4 03/31] accel/tcg: Use more accurate max_insns for tb_overflow, Richard Henderson, 2023/02/27
- [PATCH v4 04/31] tcg: Remove branch-to-next regardless of reference count, Richard Henderson, 2023/02/27
- [PATCH v4 05/31] tcg: Rename TEMP_LOCAL to TEMP_TB, Richard Henderson, 2023/02/27
- [PATCH v4 06/31] tcg: Use noinline for major tcg_gen_code subroutines, Richard Henderson, 2023/02/27
- [PATCH v4 07/31] tcg: Add liveness_pass_0, Richard Henderson, 2023/02/27
- [PATCH v4 08/31] tcg: Remove TEMP_NORMAL, Richard Henderson, 2023/02/27
- [PATCH v4 09/31] tcg: Pass TCGTempKind to tcg_temp_new_internal, Richard Henderson, 2023/02/27
- [PATCH v4 11/31] tcg: Add tcg_gen_movi_ptr, Richard Henderson, 2023/02/27