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

Daniel D.Daugherty dcubed at openjdk.java.net
Sat Feb 13 15:16:37 UTC 2021


On Sat, 13 Feb 2021 04:30:48 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> So Thread::is_JavaThread_protected() should be "protected" then, not public.
>> yes, I was suggesting adding a default last parameter like
>>     JavaThread::get_thread_name(char* default = Thread::name());
>> and pass "<NOT_FILLED_IN\>" from JVMTI. Then JVMTI doesn't have to be a friend and have more visibility to the JavaThread class than it should have.
>
> Ahhh.... I think I finally understand what you mean...
> I'll look in the AM after I've had some coffee... :-)

The name "default" is reserved so I went with "def_name".
You can't call Thread::name() from the declaration:
./open/src/hotspot/share/runtime/thread.hpp:1690:62: error: call to non-static member function without an object argument
  const char* get_thread_name(const char* def_name = Thread::name()) const;
                                                     ~~~~~~~~^~~~
so I went with setting `def_name = NULL` in the declaration and decoding that state in get_thread_name():
` return (def_name != NULL) ? def_name : Thread::name();`

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

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


More information about the serviceability-dev mailing list