RFR: 8268855: Cleanup name handling in the Thread class and subclasses
Coleen Phillimore
coleenp at openjdk.java.net
Wed Jun 23 22:32:29 UTC 2021
On Wed, 23 Jun 2021 06:21:43 GMT, David Holmes <dholmes at openjdk.org> wrote:
> Please review this small cleanup item.
>
> We can simplify and cleanup up name() management:
>
> - make name() return "const char *" and only cast away constness at API boundaries when essential
> - add type_name() so that we can avoid code like "if (t->is_VM_Thread()) print("VMThread");
> - Rename JavaThread::get_thread_name() to name() (no need for the extra indirection)
>
> There are a couple of minor changes to the appearance of some internal threads in the hs_err log e.g.
>
> 0x000055af03e5b1b0 WatcherThread [stack: 0x00007f685df00000,0x00007f685e000000] [id=15952]
>
> is now:
>
> 0x000055af03e5b1b0 WatcherThread "VM Periodic Task Thread" [stack: 0x00007f685df00000,0x00007f685e000000] [id=15952]
>
> but this shouldn't affect anything and makes things more consistent.
>
> Notes:
>
> 1. While "override" is the ideal style when declaring overriding methods it has to be applied to all virtual methods in a class. So unless "override" is already used in a class, I did not start using it. I have filed a separate RFE to convert the Thread classes to use "override" consistently.
> 2. While there is no need to redeclare a virtual method as "virtual" I kept to the existing style in those classes where changes were made.
> 3. I did not override type_name() for all the JavaThread subclasses as it seemed unnecessary, but happy to hear other views on this.
>
> Testing (in progress):
> - All builds in tiers 1-5
> - GHA
> - tiers 1-3 as a sanity test
>
> Thanks,
> David
This looks good.
-------------
Marked as reviewed by coleenp (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/4569
More information about the hotspot-dev
mailing list