RFR: 8241403: JavaThread::get_thread_name() should be ThreadSMR-aware [v6]

David Holmes dholmes at openjdk.java.net
Thu Feb 25 23:01:45 UTC 2021


On Thu, 25 Feb 2021 22:44:07 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> A minor fix to add a new function:
>> 
>>     bool Thread::is_JavaThread_protected(const JavaThread* p)
>> 
>> that returns true when the target JavaThread* is protected and false
>> otherwise. Update JavaThread::get_thread_name() to create a
>> ThreadsListHandle and use the new is_JavaThread_protected(). Also
>> update JvmtiTrace::safe_get_thread_name() to use the new
>> is_JavaThread_protected().
>> 
>> This fix is tested via a Mach5 Tier[1-8] run.
>
> Daniel D. Daugherty has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address dholmes-ora CR3 comments.

Hi Dan,

I'm good with holding the Threads_lock remaining as a safe condition for use of get_thread_name().

Minor comments on code placement that should have been made earlier - sorry.

Thanks,
David

src/hotspot/share/runtime/thread.cpp line 520:

> 518:   guarantee(false, "current_thread=" INTPTR_FORMAT " is not protecting p="
> 519:             INTPTR_FORMAT, p2i(current_thread), p2i(p));
> 520: 

This will be deleted before pushing - right?

src/hotspot/share/compiler/compileBroker.cpp line 1028:

> 1026:       assert(ct != NULL, "should have been handled for initial thread");
> 1027:       ThreadsListHandle tlh;  // get_thread_name() depends on the TLH.
> 1028:       assert(tlh.includes(ct), "ct=" INTPTR_FORMAT " exited unexpectedly.", p2i(ct));

This can be placed inside the if-clause where the MutexLocker was.

src/hotspot/share/compiler/compileBroker.cpp line 1115:

> 1113:       if (ct == NULL) break;
> 1114:       ThreadsListHandle tlh;  // get_thread_name() depends on the TLH.
> 1115:       assert(tlh.includes(ct), "ct=" INTPTR_FORMAT " exited unexpectedly.", p2i(ct));

This can be placed inside the if-clause where the MutexLocker was.

src/hotspot/share/compiler/compileBroker.cpp line 1136:

> 1134:       if (ct == NULL) break;
> 1135:       ThreadsListHandle tlh;  // get_thread_name() depends on the TLH.
> 1136:       assert(tlh.includes(ct), "ct=" INTPTR_FORMAT " exited unexpectedly.", p2i(ct));

This can be placed inside the if-clause where the MutexLocker was.

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

Marked as reviewed by dholmes (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/2535


More information about the serviceability-dev mailing list