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

David Holmes dholmes at openjdk.java.net
Fri Jul 30 02:33:33 UTC 2021


On Fri, 30 Jul 2021 00:00:56 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> This is a simple rewrite of what is "Possibly the ugliest for loop the world has seen."
>> Thanks to @stefank for the draft proposed fix. Thanks to @fisk for providing this
>> piece of history that I'm finally getting around to cleaning up. While this macro has
>> been with us for a long time, its time has passed...
>> 
>> Tested with Mach5 Tier[1-3].
>
> 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.

Hi Dan,

I can't comment on all the details of C++ Iterator definitions etc but these new foreach loops are definitely not ugly.  :)

Looks good!

Thanks,
David

src/hotspot/share/runtime/threadSMR.cpp line 638:

> 636: 
> 637: uint ThreadsList::Iterator::check_index(ThreadsList* list, uint i) {
> 638:   assert(i <= list->length(), "invalid index %u", i);

Shouldn't that just be a '<' check?

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

Marked as reviewed by dholmes (Reviewer).

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


More information about the hotspot-gc-dev mailing list