RFR: 8276824: refactor Thread::is_JavaThread_protected

Daniel D.Daugherty dcubed at openjdk.java.net
Tue Nov 9 15:25:46 UTC 2021


On Tue, 9 Nov 2021 15:07:58 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

> Refactor `Thread::is_JavaThread_protected(const JavaThread* p, bool checkTLHOnly)`
> into: `bool Thread::is_JavaThread_protected(const JavaThread* p)`
> and: `Thread::is_JavaThread_protected_by_TLH(const JavaThread* p)`.
> Also change callers that passed `checkTLHOnly == true` into calls to
> `Thread::is_JavaThread_protected_by_TLH(const JavaThread* p)`.
> 
> This refactoring is being tested with Mach5 Tier[1-3] (in process).
> 
> In the "Files changed" view, enable "Settings -> Hide whitespace" for an easier review.

@coleenp, @dholmes-ora and @robehn - since the three of you were involved in the
review for: "JDK-8249004 Reduce ThreadsListHandle overhead in relation to direct handshakes"
I would like you to chime in on this refactoring. Thanks!

Advantages to this version (from my POV):
- `Thread::is_JavaThread_protected()` is smaller and simpler without the flag.
- `Thread::is_JavaThread_protected_by_TLH()` is very small and straight forward.

Disadvantages to this version (from my POV):
- current_thread is materialized in both functions instead of just once.

@dholmes-ora says that materializing current_thread is no longer as expensive as
it used to be so I'm not worried about the disadvantage anymore.

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

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


More information about the hotspot-runtime-dev mailing list