On Fri, 24 May 2024 14:19:13 GMT, Scott Gibbons <sgibb...@openjdk.org> wrote:
>> the RIP-relative lea should have a shorter encoding. I think something like >> `lea(r15, ExternalAddress(small_jump_table))` should produce it (untested) > > Just did the experiment and it turns out that `mov64(r15, > (int64_t)small_jump_table)` and `lea(r15, ExternalAddress(small_jump_table))` > produce exactly the same code: > > `0x00007fffe463d68b: 49 bf a0 d5 63 e4 ff 7f 00 00 movabs > r15,0x7fffe463d5a0` > > The code in `MacroAssembler` for `lea` calls `mov_literal64` with no check > for whether it can be ip-relative. > > I tried doing it myself via `leaq(r15, Address(rip, (int64_t)small_jump_table > - (int64_t)(__ pc())))` but there is no definition in `register_x86.hpp` for > register `rip`. So I'm not sure exactly how to produce RIP-relative > addressing. Thanks for checking. Well I know that the `MacroAssembler::movdqu(XMMRegister dst, AddressLiteral src, Register rscratch)` method actually generates rip-relative addresses. Maybe we could copy some of that code. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16753#discussion_r1613603833