On Mon, 25 Sep 2023 02:08:36 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> Axel Boldt-Christmas has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Update copyright year
>
> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java
>  line 49:
> 
>> 47:     Type monitorListType = db.lookupType("MonitorList");
>> 48:     Address monitorListAddr = 
>> objectSynchronizerType.getField("_in_use_list").getStaticFieldAddress();
>> 49:     inUseListHead = 
>> monitorListType.getAddressField("_head").getAddress(monitorListAddr);
> 
> So is `inUseListHead` effectively a "pointer" to the `_head` field of the 
> `_in_use_list` `MonitorList`, which is dereferenced when we read it? Else I'm 
> not seeing how we iterate the current set of in-use monitors.

It is not. It is the value of `_head` when ObjectSynchronizer is initialised. 
My understanding of the serviceability agent is very limited, but from what I 
understood the JVM does not run when we are attached. So no code should add to 
the list. 

If that was a requirement then both this and the previous implementation are 
completely broken.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15782#discussion_r1335673227

Reply via email to