RFR: 8320318: ObjectMonitor Responsible thread

David Holmes dholmes at openjdk.org
Thu Sep 12 00:07:04 UTC 2024


On Wed, 11 Sep 2024 12:45:56 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:

>> On x86 `membar(LoadStore | StoreStore /* release */)` would be a nop. Not sure if adding it before nulling the pointer would make things clearer.
>> 
>> `membar(StoreLoad);` is all that we need between clearing the owner and checking the queues / successor.
>
> As @xmas92 wrote, membar(StoreLoad); is all that we need between clearing the owner and checking the queues / successor. And, since I use membar(StoreLoad) in all other platforms, I wanted it to be consistent.
> Also if you look in [ObjectMonitor::exit](https://github.com/openjdk/jdk/blob/f9ddfc6fb0780a7d6e933a40ecd3cd458a058f04/src/hotspot/share/runtime/objectMonitor.cpp#L1132C6-L1132C25)() you'll see that this there is a call to [OrderAccess::storeload](https://github.com/openjdk/jdk/blob/f9ddfc6fb0780a7d6e933a40ecd3cd458a058f04/src/hotspot/share/runtime/objectMonitor.cpp#L1184)() just after [release_clear_owner](https://github.com/openjdk/jdk/blob/f9ddfc6fb0780a7d6e933a40ecd3cd458a058f04/src/hotspot/share/runtime/objectMonitor.cpp#L1183)(), so I'm just doing the same as has been done in the C++ slow-path for long.

When the key change here is "add in the missing fence that otherwise allowed stranding" then I would really like something to include the word "fence". Very few people will understand/recall the equivalence with storeload. A comment will suffice.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19454#discussion_r1755882189


More information about the hotspot-dev mailing list