RFR: 8328306: AArch64: MacOS lazy JIT "write xor execute" switching [v3]

Dean Long dlong at openjdk.org
Fri Aug 15 19:44:18 UTC 2025


On Fri, 15 Aug 2025 16:50:26 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp line 80:
>> 
>>> 78: // Used in the runtime linkage of calls; see class CompiledIC.
>>> 79: void NativeCall::set_destination_mt_safe(address dest) {
>>> 80:   MACOS_AARCH64_ONLY(os::thread_wx_enable_write());
>> 
>> Probably not needed.  set_destination() should take care of this.
>
>> Probably not needed. set_destination() should take care of this.
> 
> I guess so, given that we just updated the stub before changing the call to point to the stub. But `set_destination_mt_safe` is a public method, shouldn't it do the right thing here?
> Maybe I could just assert we're in `WXWrite` mode?

In other places we call set_destination() directly, so it acts like a public entry point, and then this function looks a little like a wrapper.  But having an extra call here is harmless and helps to document what we are doing, so leaving it fine too.  If having redundant calls to thread_wx_enable_write() was expensive then it might be worth it to optimize their placement, but I think thread_wx_enable_write() is cheap enough that trying to over-optimize can quickly turn into bikeshedding.
An assert would be OK, but then it brings up the question of whether we should use it in other places.  And the signal handler safety net makes asserts less useful.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26562#discussion_r2279757324


More information about the hotspot-dev mailing list