RFR: 8293922: Extend barrier-less Java thread transitions to native transitions

Martin Doerr mdoerr at openjdk.org
Fri Sep 16 11:08:51 UTC 2022


On Fri, 16 Sep 2022 10:01:18 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

> As suggested by @TheRealMDoerr, avoid the fence for native trans when UseSystemMemoryBarrier is enabled.
> 
> Locally I can see methods like Thread.holdsLock() getting a 4 ns speed boost, (~20% faster).
> 
> Running t1-5 with UseSystemMemoryBarrier on.

Very cool! Both, `_thread_state` and `_polling_word` are volatile, so the C++ compiler is not allowed to mess up the accesses. The speedup should more than justify the overhead of the `SYS_membarrier` call. I hope that we can use it in production at some point of time.

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

Marked as reviewed by mdoerr (Reviewer).

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


More information about the hotspot-runtime-dev mailing list