On Wed, 14 Aug 2024 20:58:24 GMT, Daniel D. Daugherty <[email protected]>
wrote:
>> src/hotspot/share/runtime/lightweightSynchronizer.cpp line 341:
>>
>>> 339:
>>> 340: ObjectMonitor*
>>> LightweightSynchronizer::get_or_insert_monitor_from_table(oop object,
>>> JavaThread* current, bool* inserted) {
>>> 341: assert(LockingMode == LM_LIGHTWEIGHT, "must be");
>>
>> Do you want to assert: `inserted != nullptr`?
>
> What was the resolution? I don't see a reply or a change here.
_Must have missed pressing Comment_
The assert does not seem necessary, this member function is local to
LightweightSynchronizer (private) and it will crash hard if it is called with a
bad pointer for the out parameter.
It could have been a reference type here instead. I am not sure what is the
best when it comes to out parameters, all styles have pros and cons. We seem to
use all different combinations throughout hotspot.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20067#discussion_r1717996898