On Tue, 6 Dec 2022 08:56:47 GMT, Doug Simon <dnsi...@openjdk.org> wrote:

>> src/hotspot/share/jvmci/jvmci.cpp line 234:
>> 
>>> 232:     if (thread != nullptr && thread->is_Java_thread()) {
>>> 233:       ResourceMark rm;
>>> 234:       JavaThreadState state = ((JavaThread*) thread)->thread_state();
>> 
>> Please use `JavaThread::cast(thread)`
>
> I've made this change. Out of interest, I grep'ed through `src/hotspot` and 
> found a few other instances of `(JavaThread*)` style casts. While most of 
> these are probably older code, I'm wondering what the guidelines are in this 
> area. I assume `JavaThread::cast` should be preferred always given the 
> assertion checking it does?

Yes `JavaThread::cast(t)` is preferred. We did a lot of cleanup work ensuring 
we use `JavaThread` when always dealing with a `JavaThread`, and so reduce the 
places we need to cast. I'm a little surprised we still have some raw casts 
left as I thought we had cleaned them all up. I will check and file another 
cleanup RFE. Thanks.

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

PR: https://git.openjdk.org/jdk/pull/11513

Reply via email to