On Thu, 11 Nov 2021 18:15:08 GMT, Florian Weimer <fwei...@openjdk.org> wrote:
> > > > Am I right is saying that for Macos, all generated code is remapped RO > > > > before execution? > > > > > > > > > Ah, no, it seems the code cache is not RWX all the time as far as Java > > > threads are concerned. The Macos/AArch64 code is strategically calling > > > pthread_jit_write_protect_np at Java <-> JVM transition points. > > > > > > And this requires magic kernel support. I did mention it to a kernel > > engineer who wasn't very impressed, but I think it's pretty cool. > > It's possible to emulate this to some extent with memory protection keys on > POWER and (recent) x86. See `pkey_alloc`. I don't think this does exactly what we need, because (at least according to the docs) it does it for the whole process, not just the jit threads. Unless I've read the docs wrongly. ------------- PR: https://git.openjdk.java.net/jdk/pull/6334