On Tue, 13 Feb 2024 06:55:46 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> Serguei Spitsyn has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   review: fixed issues in get_object_monitor_usage; extended test coverage 
>> in objmonusage003
>
> src/hotspot/share/runtime/javaThread.cpp line 196:
> 
>> 194: oop JavaThread::vthread_or_thread() const {
>> 195:     oop result = vthread();
>> 196:     if (result == nullptr) {
> 
> Is that really sufficient? If so why do we have `is_vthread_mounted` which 
> checks the continuation?

Thank you for the question.
This function does not care if this is a vthread, or not and if it is mounted 
or not.
We just need a right oop of currently executed thread or vthread.
The `threadOop()` and `vthread()` can return the same oop.
If `vthread()` is not `nullptr` then it can point either to a `j.l.Thread` or a 
`j.lVirtualThread`.
If it is `nullptr` then we have to take `threadOop()`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17680#discussion_r1487374609

Reply via email to