RFR: 8282475: SafeFetch should not rely on existence of Thread::current [v6]

Andrew Haley aph at openjdk.java.net
Fri Mar 11 09:36:45 UTC 2022


On Thu, 10 Mar 2022 14:09:24 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

> > Depending on what the pthread library call does, and if it's a real function call into a library, it would be more expensive than that.
> 
> Yes, unfortunately we need something like this.

But we don't need to speculate. If thread-local variables are cheap on MacOS, and there is no reason why they should be expensive, then we can stop worrying and just use a thread-local variable for WX state. We can measure how long it takes, and we only have to care about one platform, MacOS/AArch64.

We could also redefine SafeFetch on MacOS/AArch64 to not need WX. We could do this by statically generating SafeFetch on that platform, and it wouldn't be in the JIT region at all. Why not just do that?

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

PR: https://git.openjdk.java.net/jdk/pull/7727


More information about the serviceability-dev mailing list