RFR: 8263709: Cleanup THREAD/TRAPS/CHECK usage in JRT_ENTRY routines
David Holmes
dholmes at openjdk.java.net
Fri Mar 19 00:00:42 UTC 2021
On Thu, 18 Mar 2021 21:57:23 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> All JRT_ENTRY routines are required to have a parameter, "JavaThread* thread", which must be the current thread. The JRT_ENTRY, and related macros, then use this parameter and also expose it as THREAD for use with exception macros. But the fact "thread" is the current thread is lost in some routines and we see strange calls to other code that pass both "thread" and "THREAD" as distinct parameters - primarily when a TRAPS method is involved.
>>
>> This should be cleaned up along with a general check on misuse of TRAPS/THREAD.
>>
>> Testing: tiers 1-3
>>
>> Thanks,
>> David
>
> src/hotspot/share/runtime/sharedRuntime.cpp line 1661:
>
>> 1659:
>> 1660: methodHandle SharedRuntime::handle_ic_miss_helper(TRAPS) {
>> 1661: JavaThread* thread = THREAD->as_Java_thread();
>
> A general comment about the functions that took both `thread` and `TRAPS`, where you removed the `thread`:
>
> Are we sure they cannot be called on a non-current thread?
Everything goes back to the JRT macros where THREAD is created from thread, so they are always the same current thread instance.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3062
More information about the hotspot-runtime-dev
mailing list