On Wed, 3 Nov 2021 01:21:50 GMT, David Holmes <[email protected]> wrote:
>> Daniel D. Daugherty has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> 8249004.cr2.patch
>
> src/hotspot/share/runtime/thread.cpp line 446:
>
>> 444: Thread* current_thread = nullptr;
>> 445: if (checkTLHOnly) {
>> 446: current_thread = Thread::current();
>
> This seems redundant due to line 463. You can just have a `if
> (!checkTLHOnly)` block here.
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?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4677