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

David Holmes david.holmes at oracle.com
Thu Jun 3 22:31:47 UTC 2021


On 4/06/2021 6:56 am, Albert Mingkun Yang wrote:
> 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.

Okay - just asking the question. :) For JavaThread we have a const and 
non-const version (not sure why though).

David

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


More information about the hotspot-dev mailing list