RFR: 8318986: Improve GenericWaitBarrier performance [v3]

Robbin Ehn rehn at openjdk.org
Tue Nov 7 09:24:33 UTC 2023


On Tue, 7 Nov 2023 09:19:37 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> src/hotspot/share/utilities/waitBarrier_generic.cpp line 163:
>> 
>>> 161:     int s = Atomic::load_acquire(&_state);
>>> 162:     assert(s > 0, "Mid disarm: Should be armed. State: %d", s);
>>> 163:     if (Atomic::cmpxchg(&_state, s, -s) == s) {
>> 
>> When we hit this branch we have effectively left the outer loop.
>> I think it will read easier if this scope actually was outside the scope of the outer loop, no?
>
> Oh, you mean break out here, and just do the rest outside the loop. Yes, we can do that.

Yes, I think it will be easier to read. But do as you will, just a suggestion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16404#discussion_r1384608906


More information about the hotspot-dev mailing list