RFR: 8315884: New Object to ObjectMonitor mapping [v15]
Axel Boldt-Christmas
aboldtch at openjdk.org
Thu Aug 15 06:01:02 UTC 2024
On Wed, 14 Aug 2024 20:58:24 GMT, Daniel D. Daugherty <dcubed at openjdk.org> 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
More information about the core-libs-dev
mailing list