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

Patricio Chilano Mateo pchilanomate at openjdk.org
Tue Nov 18 14:56:51 UTC 2025


On Tue, 18 Nov 2025 13:42:33 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/runtime/objectMonitor.cpp line 320:
>> 
>>> 318:   check_object_context();
>>> 319:   if (_object_strong.is_empty()) {
>>> 320:     auto setObjectStrongLambda = [&](OopHandle& object_strong, const WeakHandle& object) {
>> 
>> I don't understand why we need the complexity of the `SpinSingleSection` and use of lambda's/functors.
>> 
>> This seems like try-lock usage, though I'm not at all sure why (i.e. if we don't get the lock who is taking care of making a strong reference?)
>
> I think we agree about SpinSingleSection that it's sort of overkill we shouldn't add it.

+1 on leaving the code as it was. This makes it harder to read IMO. Also as David points out there is no spinning here so using a SpinSingleSection class would add extra confusion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28264#discussion_r2538511301


More information about the hotspot-dev mailing list