Integrated: 8305425: Thread.isAlive0 doesn't need to call into the VM

David Holmes dholmes at openjdk.org
Wed Apr 5 21:58:27 UTC 2023


On Mon, 3 Apr 2023 07:17:59 GMT, David Holmes <dholmes at openjdk.org> wrote:

> We have the strange situation where calling `t.isAlive()` on a `java.lang.Thread` `t`, will call into the VM (via `alive()` then `isAlive0()`) where the VM then examines the `eetop` field of `t` to extract its `JavaThread` pointer and compare it to null. We can simply read `eetop` directly in `Thread.alive()`:
> 
> boolean alive() {
>   return eetop != 0;
> } 
> 
> I also updated a comment in relation to `eetop`.
> 
> Testing: tiers 1-3
> 
> Thanks

This pull request has now been integrated.

Changeset: 35cb303a
Author:    David Holmes <dholmes at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/35cb303a2c0c8b32de257c02e012a1928a6b4594
Stats:     142 lines in 7 files changed: 123 ins; 12 del; 7 mod

8305425: Thread.isAlive0 doesn't need to call into the VM

Co-authored-by: Aleksey Shipilev <shade at openjdk.org>
Reviewed-by: shade, coleenp, alanb

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

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



More information about the build-dev mailing list