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

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


On Sat, 13 Feb 2021 15:24:33 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> 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();`
>
> default_name, it's not long enough to abbreviate...  but yes. thanks!

And it looks like making is_JavaThread_protected() a protected function doesn't work either since `JavaThread::get_thread_name()` can't call it:

./open/src/hotspot/share/runtime/thread.cpp:2857:15: error: 'is_JavaThread_protected' is a protected member of 'Thread'
  if (thread->is_JavaThread_protected(this)) {
              ^
./open/src/hotspot/share/runtime/thread.cpp:488:14: note: can only access this member on an object of type 'JavaThread'
bool Thread::is_JavaThread_protected(const JavaThread* p) {
             ^
1 error generated.

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

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


More information about the hotspot-runtime-dev mailing list