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

David Holmes dholmes at openjdk.java.net
Thu Apr 15 02:25:35 UTC 2021


On Thu, 8 Apr 2021 06:52:15 GMT, David Holmes <dholmes at openjdk.org> wrote:

> The existing JRT_ENTRY (and related) macros require the function to which they are applied to declare a parameter "JavaThread* thread" which represents the current thread. These functions are all implicitly "traps" functions as they can result in exceptions, but they are not declared with TRAPS because the only caller of these functions is the runtime itself (via call_VM) and no callers need to be aware to use CHECK; further they need a JavaThread. So the macro declares the THREAD variable for use with other exception-producing functions and assigns it from "thread".
> 
> The majority of this change replaces the parameter name "thread" with "current" so that it is clear that we are always dealing with the current thread. This affects the entry functions as well as the functions called therefrom.
> 
> We can then also replace the use of "THREAD" with "current", in contexts that are not related to exception processing.
> 
> Some methods called by entry functions were declared to have both a "thread" parameter and a "TRAPS" parameter - with nothing to tell you these are always the same, current, thread. So the "thread" parameter is removed and replaced with a local variable "current" obtained from THREAD->as_Java_thread().
> 
> Some missing CHECK_ uses were added.
> 
> Testing:
>   - tiers 1-3
> 
> Thanks,
> David

This pull request has now been integrated.

Changeset: 79bff21b
Author:    David Holmes <dholmes at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/79bff21b
Stats:     936 lines in 23 files changed: 16 ins; 29 del; 891 mod

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

Reviewed-by: coleenp, hseigel, iklam, kvn

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

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


More information about the hotspot-compiler-dev mailing list