static bool tcg_out_pool_finalize(TCGContext *s) { TCGLabelPoolData *p = s->pool_labels; TCGLabelPoolData *l = NULL; void *a; if (p == NULL) { return true; } /* ??? Round up to qemu_icache_linesize, but then do not round again when allocating the next TranslationBlock structure. */ a = (void *)ROUND_UP((uintptr_t)s->code_ptr, sizeof(tcg_target_ulong) * p->nlong); tcg_out_nop_fill(s->code_ptr, (tcg_insn_unit *)a - s->code_ptr); s->data_gen_ptr = a; for (; p != NULL; p = p->next) { 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; } memcpy(a, p->data, size); a += size; l = p; } patch_reloc(p->label, p->rtype, (intptr_t)a - size, p->addend); } s->code_ptr = a; return true; }
static bool tcg_out_pool_finalize(TCGContext *s) { TCGLabelPoolData *p = s->pool_labels; tcg_target_ulong d, *a; if (p == NULL) { return true; } /* ??? Round up to qemu_icache_linesize, but then do not round again when allocating the next TranslationBlock structure. */ a = (void *)ROUND_UP((uintptr_t)s->code_ptr, sizeof(tcg_target_ulong)); tcg_out_nop_fill(s->code_ptr, (tcg_insn_unit *)a - s->code_ptr); s->data_gen_ptr = a; /* Ensure the first comparison fails. */ d = p->data + 1; for (; p != NULL; p = p->next) { if (p->data != d) { d = p->data; if (unlikely((void *)a > s->code_gen_highwater)) { return false; } *a++ = d; } patch_reloc(p->label, p->type, (intptr_t)(a - 1), p->addend); } s->code_ptr = (void *)a; return true; }