On Wed, 5 Apr 2023 08:37:26 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 one additional 
> commit since the last revision:
> 
>   Test tweaks

Yes, I suspect having isAlive be synchronized would have had side-effects and 
maybe deadlock in some cases. Volatile-read on the libs side + 
OrderAccess::release in the VM at termination time looks okay.

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

Marked as reviewed by alanb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13287#pullrequestreview-1372446213

Reply via email to