On Wed, 5 Apr 2023 02:30:15 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 > > David Holmes has updated the pull request incrementally with two additional > commits since the last revision: > > - Switch from using synchronized to using a volatile eetop field > - Added Shipilev's test (with a small addition) src/java.base/share/classes/java/lang/Thread.java line 1846: > 1844: /** > 1845: * Returns true if this thread is alive. > 1846: * This method is non-final so it can be overridden. Suggestion: * This method is non-final so it can be overridden by VirtualThread. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13287#discussion_r1157995444