RFR: 8268164: Adopt cast notation for WorkerThread conversions

Albert Mingkun Yang ayang at openjdk.java.net
Fri Jun 4 08:34:58 UTC 2021


On Thu, 3 Jun 2021 22:33:32 GMT, David Holmes <david.holmes at oracle.com> wrote:

> For JavaThread we have a const and non-const version (not sure why though).

`as_Java_thread` is called with `const Thread*` in two places, listed below. The criteria of having a `const Thread*`-version cast method hinges on the caller, whether it has a `const Thread*` and/or wants a `const XThread*` in return. `as_Java_thread` is called both with and with `const`, while `XThread* cast(Thread* t)` is enough for others currently.


traceid JfrThreadId::id(const Thread* t);

const char* JfrThreadName::name(const Thread* t);

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

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


More information about the hotspot-dev mailing list