On Mon, 3 Apr 2023 07:17:59 GMT, David Holmes <dhol...@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

src/java.base/share/classes/java/lang/Thread.java line 231:

> 229:     /* Reserved for exclusive use by the JVM. Cannot be moved to 
> FieldHolder
> 230:        as it needs to be set by the VM before executing the constructor 
> that
> 231:        will set FieldHolder.

"will set FieldHolder" is a bit confusing. It creates the FieldHolder and sets 
the field "holder" so I think the comment could be a bit clearer.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13287#discussion_r1155601934

Reply via email to