RFR: 8268855: Cleanup name handling in the Thread class and subclasses
David Holmes
dholmes at openjdk.java.net
Wed Jun 23 12:59:49 UTC 2021
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
-------------
Commit messages:
- Missed ShenandoahControlThread
- 8268855: Cleanup name handling in the Thread class and subclasses
Changes: https://git.openjdk.java.net/jdk/pull/4569/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4569&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8268855
Stats: 85 lines in 16 files changed: 34 ins; 14 del; 37 mod
Patch: https://git.openjdk.java.net/jdk/pull/4569.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4569/head:pull/4569
PR: https://git.openjdk.java.net/jdk/pull/4569
More information about the hotspot-dev
mailing list