RFR: 8274987 G1: reuse the newly allocated G1SegmentedArrayBuffer even if current thread failed the race [v3]

Hamlin Li mli at openjdk.java.net
Thu Oct 21 01:57:09 UTC 2021


On Wed, 20 Oct 2021 12:14:29 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix cransh on Mac; remove unnecessary code
>
> src/hotspot/share/gc/g1/g1SegmentedArray.inline.hpp line 70:
> 
>> 68: template<MEMFLAGS flag>
>> 69: void G1SegmentedArrayBufferList<flag>::add(G1SegmentedArrayBuffer<flag>& elem) {
>> 70:   _list.prepend(elem);
> 
> Not sure why the `prepend` is used here, but probably because of the previous implementation which has been dead code.
> I do not see an advantage pushing this element onto the bottom of the stack. I.e. I'd just `push()` it.
> 
> Note that this change (in general) also breaks the assumptions stated in the documentation of `G1SegmentedArrayBufferList` - that's not a problem as far as I can see (push/pop use the correct synchronization), but the text needs to be adapted.

Do you mean modify it to something like:

// Set of (free) G1SegmentedArrayBuffers.
// Every action may be performed by multiple threads at the same time.
// Counts and memory usage are current on a best-effort basis if accessed concurrently.

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

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



More information about the hotspot-gc-dev mailing list