RFR: 8324881: ObjectSynchronizer::inflate(Thread* current...) is invoked for non-current thread [v4]
Axel Boldt-Christmas
aboldtch at openjdk.org
Thu Feb 1 12:24:10 UTC 2024
On Thu, 1 Feb 2024 11:02:52 GMT, Richard Reingruber <rrich at openjdk.org> wrote:
>> Axel Boldt-Christmas has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>>
>> - Introduce separate API for enter from a different thread
>> - Merge remote-tracking branch 'upstream_jdk/master' into JDK-8324881
>> - More restrictive API
>> - Add regression test
>> - 8324881: ObjectSynchronizer::inflate(Thread* current...) is invoked for non-current thread
>
> src/hotspot/share/runtime/objectMonitor.cpp line 345:
>
>> 343: // success will only be false if this races with something other than
>> 344: // deflation.
>> 345: success = try_set_owner_from(nullptr, locking_thread) == nullptr;
>
> No other race than the race with deflation should be allowed because the current thread would be busy waiting. Better assert success?
I was unsure if the `ObjectMonitor::enter_for` should assert this or put it on the caller.
`ObjectSynchronizer::enter_for` currently asserts `assert(monitor->is_being_async_deflated(), "must be");` when `ObjectMonitor::enter_for` return false. (An equivalent property)
But I can move it into `ObjectMonitor::enter_for` and attach some more information to the assert such as the prev_owner. Sounds better to me.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17626#discussion_r1474372456
More information about the hotspot-dev
mailing list