Richard Henderson <r...@twiddle.net> writes: > On 04/25/2016 04:46 PM, Emilio G. Cota wrote: >> + /* >> + * write the prologue into buf2. This is safe because we'll later call >> + * tcg_prologue_init on buf1, from which we'll start execution. >> + */ >> + tcg_ctx.code_gen_buffer = code_gen_buf2; >> + tcg_prologue_init(&tcg_ctx); >> + > > Ah, no. Write only one prologue, not one per buffer. > > If they're sufficiently close (i.e. one allocation under the max size), > then the same one can be used for both halves. > > The global variables that you didn't see in this revision are: > > aarch64/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > arm/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > i386/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > ia64/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > ia64/tcg-target.inc.c: tcg_insn_unit *thunks[8] = { }; > mips/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > ppc/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > s390/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > sparc/tcg-target.inc.c:static tcg_insn_unit *qemu_ld_trampoline[16]; > sparc/tcg-target.inc.c:static tcg_insn_unit *qemu_st_trampoline[16];
Aside from the existing code structure is there any reason to have only one prologue? It doesn't seem to be a large amount of code and in the case of having smaller translation regions I would posit having a "local" prologue/epilogue would make the jumps cheaper. > > > r~ -- Alex Bennée