RFR: 8263709: Cleanup THREAD/TRAPS/CHECK usage in JRT_ENTRY routines

Coleen Phillimore coleenp at openjdk.java.net
Fri Mar 19 01:51:41 UTC 2021


On Thu, 18 Mar 2021 21:51:30 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 1231:
> 
>> 1229: methodHandle SharedRuntime::resolve_helper(bool is_virtual, bool is_optimized, TRAPS) {
>> 1230:   methodHandle callee_method;
>> 1231:   callee_method = resolve_sub_helper(is_virtual, is_optimized, THREAD);
> 
> The two occurrences of  `THREAD` in this function seem fishy. Maybe they can be replaced with CHECK? But it's unrelated to this PR so probably should be done in a separate REF.

This seems like a case where you should have removed the trailing THREAD and not the leading 'thread'.

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

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


More information about the hotspot-runtime-dev mailing list