RFR: 8366671: Refactor Thread::SpinAcquire and Thread::SpinRelease [v9]

Anton Artemov aartemov at openjdk.org
Mon Dec 1 10:18:49 UTC 2025


On Tue, 25 Nov 2025 08:14:14 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> I think this looks good, but we should add a `NoSafepointVerifier` to this `SpinCriticalSection` RAII object. Polling for a safepoint inside a SpinLock should never be allowed.

Adding a `NoSafepointVerifier` before `spin_acquire()` breaks creation of the main thread. The problem is in `ParkEvent::Allocate(this)`. And there is a comment in park.cpp: "Caveat: Allocate() and Release() may be called from threads other than the thread associated with the Event!". So it breaks the assert in `Thread::current()`. Any other way how to ensure no polling for safepoint?

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

PR Comment: https://git.openjdk.org/jdk/pull/28264#issuecomment-3595724880


More information about the hotspot-dev mailing list