RFR: 8193559: ugly DO_JAVA_THREADS macro should be replaced [v4]

Daniel D.Daugherty dcubed at openjdk.java.net
Fri Jul 30 16:29:34 UTC 2021


On Fri, 30 Jul 2021 04:33:28 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Daniel D. Daugherty has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8193559.kbarrett.part1 - Kim's proposed rewrite using newer C++ features.
>
> src/hotspot/share/runtime/threadSMR.inline.hpp line 53:
> 
>> 51:   assert_not_singular();
>> 52:   assert_same_list(i);
>> 53:   return _thread_ptr != i._thread_ptr;
> 
> Better might be to have the entire body consist of `return operator==(i);`.

I think what's there is more clear. If we switch to `return operator==(i)`,
then I think that will lead to some head scratching. Especially since it's
making me wonder right now...

> src/hotspot/share/runtime/threadSMR.inline.hpp line 59:
> 
>> 57:   assert_not_singular();
>> 58:   assert_dereferenceable();
>> 59:   Prefetch::read(const_cast<JavaThread**>(_thread_ptr), PrefetchScanIntervalInBytes);
> 
> This prefetch is included because the old code had it.  But I'm dubious about it.  This is just linear iteration through an array, which seems like the canonical best case for leaving it to the hardware, rather than doing cachelinesize/ptrsize software prefetches per cache line.  I'm hoping the original authors can comment.

The original author that added the prefetch is @fisk. He's reviewed an earlier
version of this fix and I'm hoping he's around to review this version.

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

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



More information about the hotspot-gc-dev mailing list