RFR: 8268368: Adopt cast notation for JavaThread conversions
Guoxiong Li
gli at openjdk.java.net
Tue Jun 22 01:22:46 UTC 2021
Hi all,
Considering the consistency of `JavaThread` and other threads, such as WorkerThread and CompilerThread, `JavaThread` could use a method named `cast` to replace the method `Thread::as_Java_thread()`. It can reduce the Thread's knowledge about the subtypes.
This patch removes two methods, `JavaThread* Thread::as_Java_thread()` and `const JavaThread* Thread::as_Java_thread() const`, of the class `Thread` and adds two static methods, `JavaThread* cast(Thread* t)` and `const JavaThread* cast(const Thread* t)`, to the class `JavaThread`. Correspondingly, the code of the method `JavaThread::current()` need to be adjusted and many places where the method `Thread::as_Java_thread()` is used need to use `JavaThread::cast` instead.
Test:
tier1 passed locally.
Thanks for taking the time to review.
Best Regards,
-- Guoxiong
-------------
Commit messages:
- 8268368: Adopt cast notation for JavaThread conversions
Changes: https://git.openjdk.java.net/jdk/pull/4546/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4546&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8268368
Stats: 159 lines in 64 files changed: 13 ins; 19 del; 127 mod
Patch: https://git.openjdk.java.net/jdk/pull/4546.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4546/head:pull/4546
PR: https://git.openjdk.java.net/jdk/pull/4546
More information about the serviceability-dev
mailing list