[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/15] tcg: Restart TB generation after constant pool
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 11/15] tcg: Restart TB generation after constant pool overflow |
Date: |
Fri, 26 Apr 2019 10:24:17 -0700 |
This is part b of relocation overflow handling.
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/tcg-pool.inc.c | 12 +++++++-----
tcg/tcg.c | 9 +++++----
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/tcg/tcg-pool.inc.c b/tcg/tcg-pool.inc.c
index 7af5513ff3..4eaa84b631 100644
--- a/tcg/tcg-pool.inc.c
+++ b/tcg/tcg-pool.inc.c
@@ -121,14 +121,14 @@ static inline void new_pool_l8(TCGContext *s, int rtype,
tcg_insn_unit *label,
/* To be provided by cpu/tcg-target.inc.c. */
static void tcg_out_nop_fill(tcg_insn_unit *p, int count);
-static bool tcg_out_pool_finalize(TCGContext *s)
+static int tcg_out_pool_finalize(TCGContext *s)
{
TCGLabelPoolData *p = s->pool_labels;
TCGLabelPoolData *l = NULL;
void *a;
if (p == NULL) {
- return true;
+ return 0;
}
/* ??? Round up to qemu_icache_linesize, but then do not round
@@ -142,15 +142,17 @@ static bool tcg_out_pool_finalize(TCGContext *s)
size_t size = sizeof(tcg_target_ulong) * p->nlong;
if (!l || l->nlong != p->nlong || memcmp(l->data, p->data, size)) {
if (unlikely(a > s->code_gen_highwater)) {
- return false;
+ return -1;
}
memcpy(a, p->data, size);
a += size;
l = p;
}
- patch_reloc(p->label, p->rtype, (intptr_t)a - size, p->addend);
+ if (!patch_reloc(p->label, p->rtype, (intptr_t)a - size, p->addend)) {
+ return -2;
+ }
}
s->code_ptr = a;
- return true;
+ return 0;
}
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 752c45a0ec..0394e8ab34 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1019,8 +1019,8 @@ void tcg_prologue_init(TCGContext *s)
#ifdef TCG_TARGET_NEED_POOL_LABELS
/* Allow the prologue to put e.g. guest_base into a pool entry. */
{
- bool ok = tcg_out_pool_finalize(s);
- tcg_debug_assert(ok);
+ int result = tcg_out_pool_finalize(s);
+ tcg_debug_assert(result == 0);
}
#endif
@@ -4005,8 +4005,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
}
#endif
#ifdef TCG_TARGET_NEED_POOL_LABELS
- if (!tcg_out_pool_finalize(s)) {
- return -1;
+ i = tcg_out_pool_finalize(s);
+ if (i < 0) {
+ return i;
}
#endif
if (!tcg_resolve_relocs(s)) {
--
2.17.1
- [Qemu-devel] [PULL 00/15] tcg patch queue, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 01/15] tcg: Implement tcg_gen_extract2_{i32, i64}, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 03/15] tcg: Use deposit and extract2 in tcg_gen_shifti_i64, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 04/15] tcg: Use extract2 in tcg_gen_deposit_{i32, i64}, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 05/15] tcg/i386: Support INDEX_op_extract2_{i32, i64}, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 02/15] tcg: Add INDEX_op_extract2_{i32,i64}, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 06/15] tcg/arm: Support INDEX_op_extract2_i32, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 07/15] tcg/aarch64: Support INDEX_op_extract2_{i32, i64}, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 09/15] tcg: Restart after TB code generation overflow, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 08/15] tcg: Hoist max_insns computation to tb_gen_code, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 11/15] tcg: Restart TB generation after constant pool overflow,
Richard Henderson <=
- [Qemu-devel] [PULL 10/15] tcg: Restart TB generation after relocation overflow, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 12/15] tcg: Restart TB generation after out-of-line ldst overflow, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 13/15] tcg/ppc: Allow the constant pool to overflow at 32k, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 14/15] tcg/arm: Restrict constant pool displacement to 12 bits, Richard Henderson, 2019/04/26
- [Qemu-devel] [PULL 15/15] cputlb: Fix io_readx() to respect the access_type, Richard Henderson, 2019/04/26
- Re: [Qemu-devel] [PULL 00/15] tcg patch queue, no-reply, 2019/04/26
- Re: [Qemu-devel] [PULL 00/15] tcg patch queue, Peter Maydell, 2019/04/28