RFR: 8249004: Reduce ThreadsListHandle overhead in relation to direct handshakes [v6]
Daniel D.Daugherty
dcubed at openjdk.java.net
Mon Nov 1 16:10:11 UTC 2021
On Sat, 16 Oct 2021 15:58:21 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:
>> The `NULL` target thread being passed in is actually handled by the baseline code:
>>
>>
>> ThreadsListHandle tlh;
>> if (tlh.includes(target)) {
>>
>>
>> `tlh.includes(target)` returns `false` when `target` is `NULL/nullptr`.
>> I just made the already handled situation more explicit.
>>
>>> Why would the caller not check if the target is dead?
>>
>> Hmmm... It's hard for me to answer that question since I didn't write
>> the original code. The test code that calls `WB_HandshakeWalkStack()`
>> or `WB_AsyncHandshakeWalkStack()` can call those functions with
>> a `thread_handle` that translates into a `thread_oop` that returns a
>> `NULL` `JavaThread*`.
>>
>> See the comment that I added to `WB_AsyncHandshakeWalkStack()` above.
>
> Update: I've added comments to WB_HandshakeReadMonitors() and
> WB_HandshakeWalkStack() to clarify their expectations.
Update again: I took a closer look at `WB_AsyncHandshakeWalkStack()`,
`WB_HandshakeReadMonitors()` and `WB_HandshakeWalkStack()` and
I realized that those functions were not properly converting a `jobject` into
a protected JavaThread*. I've updated them to call the proper conversion
function and I've changed this code to `guarantee()` that the target is not
`nullptr`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4677
More information about the serviceability-dev
mailing list