RFR: 8289743: AArch64: Clean up patching logic [v9]

Andrew Dinn adinn at openjdk.org
Mon Jul 18 12:57:13 UTC 2022


On Mon, 18 Jul 2022 10:33:33 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Andrew Haley has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - 8289743: AArch64: Clean up patching logic
>>  - 8289743: AArch64: Clean up patching logic
>>  - 8289743: AArch64: Clean up patching logic
>
> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 461:
> 
>> 459:     uint32_t insn = ((uint32_t*)insn_addr)[0];
>> 460:     int *insn3_addr = &((int*)insn_addr)[2];
>> 461:     uint32_t insn3 = (uint32_t)SafeFetch32(insn3_addr, -1);
> 
> I'm wondering if this is safe. Maybe something like `adrp;movk` could be followed by not-an-instruction which looked like an offset. However, I think that's impossible because anything following would be executed immediately following the `movk`. For the same reason, the `adrp;movk` can't be at the very end of an executable page, so I suppose the use of `SafeFetch32` is unnecessary too.
> It's still a code smell, though, even if it is safe.

Yes, I agree that the word succeeding the movk has to be an instruction when this is code generated by the JIT. That implies as a clear corollary that the `adrp;movk` sequence can't be at the very end of an executable page. So, the use of SafeFetch32 is unnecessary.

-------------

PR: https://git.openjdk.org/jdk/pull/9398


More information about the hotspot-dev mailing list