RFR: 8249004: Reduce ThreadsListHandle overhead in relation to direct handshakes [v10]

Daniel D.Daugherty dcubed at openjdk.java.net
Thu Nov 4 17:09:14 UTC 2021


On Thu, 4 Nov 2021 01:16:03 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> I suspect that the way that git is displaying the diffs is confusing you.
>> 
>> We need `current_thread` set if we get to line 474 so we have to init
>> `current_thread` on line 446 for the `checkTLHOnly == true` case and
>> on line 463 for the `checkTLHOnly == false` case.
>> 
>> I could simplify the logic by always setting current thread when it is
>> declared on 444, but I was trying to avoid the call to `Thread::current()`
>> until I actually needed it. I thought `Thread::current()` can be expensive.
>> Is this no longer the case?
>
> Sorry I missed that line 463 is still within the else from line 447.
> 
> Thread::current() is a compiler-defined thread-local access so should be relatively cheap these days, but I have no numbers.

I'm really tempted to go ahead and change it to always set
current thread when it is declared and then clean things up a bit.

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

PR: https://git.openjdk.java.net/jdk/pull/4677


More information about the serviceability-dev mailing list