[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH 05/10] tcg: add jr opcode
From: |
Richard Henderson |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH 05/10] tcg: add jr opcode |
Date: |
Sat, 15 Apr 2017 04:40:35 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 04/11/2017 06:17 PM, Emilio G. Cota wrote:
This will be used by TCG targets to implement a fast path
for indirect branches.
I only have implemented and tested this on an i386 host, so
make this opcode optional and mark it as not implemented by
other TCG backends.
I don't think this is quite the right abstraction. In particular, if we can
always return a valid address from the helper, we can eliminate a conditional
branch.
I think this should work as follows:
(1) tb_ret_addr gets moved into TCGContext so that it's available for other
code to see.
(2) Have a generic helper
void *HELPER(lookup_tb_ptr)(CPUArchState *env, target_ulong addr)
{
TranslationBlock *tb = tb_from_jmp_cache(env, addr);
return tb ? tb->tc_ptr : tcg_ctx.tb_ret_addr;
}
(3) Emit TCG opcodes like
call t0,lookup_tb_ptr,env,addr
jmp_tb t0
(4) Emit code for jmp_tb like
mov %rax,%rdx // save target into new register
xor %eax,%eax // set return value a-la exit_tb
jmp *%edx // branch to tb or epilogue.
(5) There needs to be a convenience function in tcg/tcg-op.c. If the host does
not support jmp_tb, we should just generate exit_tb like we do now. There
should be no ifdefs inside target/*.
r~
- [Qemu-arm] [PATCH 08/10] target/arm: optimize indirect branches with TCG's jr op, (continued)
- [Qemu-arm] [PATCH 08/10] target/arm: optimize indirect branches with TCG's jr op, Emilio G. Cota, 2017/04/11
- [Qemu-arm] [PATCH 04/10] target/i386: optimize cross-page block chaining in softmmu, Emilio G. Cota, 2017/04/11
- [Qemu-arm] [PATCH 06/10] tcg: add brcondi_ptr, Emilio G. Cota, 2017/04/11
- [Qemu-arm] [PATCH 10/10] tb-hash: improve tb_jmp_cache hash function in user mode, Emilio G. Cota, 2017/04/11
- [Qemu-arm] [PATCH 03/10] target/arm: optimize cross-page block chaining in softmmu, Emilio G. Cota, 2017/04/11
- [Qemu-arm] [PATCH 05/10] tcg: add jr opcode, Emilio G. Cota, 2017/04/11
- [Qemu-arm] [PATCH 09/10] target/i386: optimize indirect branches with TCG's jr op, Emilio G. Cota, 2017/04/11
- Re: [Qemu-arm] [PATCH 00/10] TCG optimizations for 2.10, Alex Bennée, 2017/04/12