On Fri, 24 May 2024 06:31:40 GMT, Daniel Jeliński <djelin...@openjdk.org> wrote:
>> It may, but I believe the movq is shorter (although maybe not to r15). I'll >> do some experimentation. > > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16753#discussion_r1613560044