On Thu, 3 Dec 2026 10:59:04 GMT, Viktor Klang <[email protected]> wrote:

>> Alan Bateman has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Drop observable change to direct calls to FJT.getSurplusQueuedTaskCount
>
> src/java.base/share/classes/java/lang/VirtualThread.java line 613:
> 
>> 611:             // random submit if there are no tasks in the local task 
>> queue
>> 612:             if (currentThread() instanceof CarrierThread ct && 
>> ct.getQueuedTaskCount() == 0) {
>> 613:                 randomSubmitRunContinuation();
> 
> This means two calls to Thread.currentThread()—one here, and one inside 
> randomSubmitRunContinuation(). Not for this PR, but it might make sense to 
> take a stab at a refactor of the submission-methods as a separate PR, perhaps 
> for JDK29.

randomSubmitRunContinuation is only currently called in the context of the 
carrier to complete Thread.yield. It could be dropped but the temptation to use 
it in other contexts is there so this is the reason for the guard. Also 
currentThread and currentCarrierThread have instrinics.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/34118#discussion_r4783749827

Reply via email to