RFR: 8268164: Adopt cast notation for WorkerThread conversions [v2]

Albert Mingkun Yang ayang at openjdk.java.net
Thu Jun 3 20:56:00 UTC 2021


On Thu, 3 Jun 2021 13:02:56 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/runtime/nonJavaThread.hpp line 111:
>> 
>>> 109: 
>>> 110:   static WorkerThread* cast(Thread* t) {
>>> 111:     assert(t->is_Worker_thread(), "incorrect cast to const WorkerThread");
>> 
>> It should probably not say *const* here.
>
> `as_Worker_thread()` used const so I wonder whether the new cast function should too?

You mean `static const WorkerThread* cast(const Thread* t) { ... }`? As the implementation of this method is nothing but a `static_cast` (and it will probably stay that way in the future), having `const Thread*` won't really catch anything interesting, IMO.

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

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


More information about the hotspot-dev mailing list