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

Daniel D.Daugherty dcubed at openjdk.java.net
Sat Jul 3 03:40:15 UTC 2021


On Fri, 2 Jul 2021 21:56:55 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:
>> 
>>   kbarrett CR - delete unused _list member.
>
> src/hotspot/share/runtime/thread.cpp line 2470:
> 
>> 2468: 
>> 2469:     JavaThreadPrefetchedIterator(ThreadsList* list) :
>> 2470:       _list(list), _end(list->threads() + list->length()), _current(list->threads()) {}
> 
> I don't see any uses of the `_list` member.

Nice catch. I don't see any either.

> src/hotspot/share/runtime/thread.cpp line 2484:
> 
>> 2482: 
>> 2483: #define DO_JAVA_THREADS(LIST, X) \
>> 2484:   for (JavaThreadPrefetchedIterator iter(LIST); JavaThread* X = iter.current(); iter.next())
> 
> The condition is an implicit conversion to bool, which is disallowed
> by the style guide.  In fact, it's a declaration, which is
> specifically called out by the style guide.  When I revised the style
> guide I made explicit mention of that usage because I'd tried to use
> that sort of thing several years ago and got several complaints.  So
> it's not that I personally think that usage is bad; rather, I was
> hoping someone would take on the little project of convincing the team
> it was good.  I don't have any objection to this part of the change.

I'll take a look at fixing that.

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

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



More information about the hotspot-gc-dev mailing list