On Tue, 25 Aug 2026 18:03:37 GMT, Jorn Vernee <[email protected]> wrote:

>> Per Minborg has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Allow negative addresses and improve initial zeroing
>
> src/java.base/share/classes/jdk/internal/foreign/ConfinedSegmentPool.java 
> line 253:
> 
>> 251:     @ForceInline
>> 252:     private static Thread cacheOwner(Thread thread) {
>> 253:         return thread.isVirtual() ? JLA.currentCarrierThread() : thread;
> 
> Is it safe to access the carrier thread like this? Are we sure a virtual 
> thread can not be moved to another thread while we are looking at the pools?

A very good question.  A mounted virtual thread can *only* be moved to another 
carrier thread if the virtual thread yields and _not_ arbitrarily (e.g., at a 
safepoint). I will make sure to add comments for this in the code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31365#discussion_r3863974698

Reply via email to