On Tue, 11 Nov 2025 11:15:15 GMT, Serguei Spitsyn <[email protected]> wrote:

>> src/hotspot/share/runtime/objectMonitor.cpp line 1108:
>> 
>>> 1106:   assert(currentNode->_thread == current, "invariant");
>>> 1107:   assert(_waiters > 0, "invariant");
>>> 1108:   assert_mark_word_consistency();
>> 
>> Why remove call to `assert_mark_word_consistency();`?
>
> Same question from me. :)

This assert only works in a non-blocked state. The call to `reenter_internal` 
is now done in a blocked state, I also changed the assertion on the state from 
`!=` to `==` a few lines above it. 

`assert_mark_word_consistency()` calls `object()` which calls 
`check_object_context()`, which can pass only if the state is either 
`_thread_in_vm` or `_thread_in_Java`. Since the call is now made from a blocked 
state, the assert has to be removed. 

`assert_mark_word_consistency()` is called after the thread is back to a 
non-blocked state.

>> src/hotspot/share/runtime/objectMonitor.cpp line 1186:
>> 
>>> 1184:   // Current has acquired the lock -- Unlink current from the 
>>> _entry_list.
>>> 1185:   assert(has_owner(current), "invariant");
>>> 1186:   assert_mark_word_consistency();
>> 
>> Why remove call to `assert_mark_word_consistency();`?
>
> Same question from me. :)

Same answer as above, it only works in a non-blocked state, but that is no 
longer the case here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27040#discussion_r2513991947
PR Review Comment: https://git.openjdk.org/jdk/pull/27040#discussion_r2513993815

Reply via email to