RFR: 8254739: G1: Optimize evacuation failure for regions with few failed objects [v19]

Thomas Schatzl tschatzl at openjdk.java.net
Fri Nov 5 11:15:20 UTC 2021


On Fri, 5 Nov 2021 11:02:26 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> Since `drop_all()` resets all counters (e.g. `_num_allocated_nodes`), the subsequent iteration will think the array is empty, won't it?
>
> For example, we modify the code as below:
> 
>> void HeapRegion::iterate_evac_failure_objs(ObjectClosure* closure) {
>>   _evac_failure_objs.iterate(closure);
>>   _evac_failure_objs.iterate(closure);
>> }
> 
> For the second time iteration, all thing will be empty, so iterate_nodes will be an empty operation, QuickSort::sort too,  and iterate_internal too. These empty operations will not do harm things.

@Hamlin-Li : I think @albertnetymk concern is that typically an `iterate` method does not modify the list itself. That is surprising for readers. The documentation also does not indicate any of that. I do not think he believes this will cause a VM failure.

Maybe change `HeapRegion::iterate_evac_failure_objs` to call a (new) `drop()` method on `_evac_failure_objs`?

I think such a change would solve Albert's concerns.

An alternative could be renaming `iterate` to something else.

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

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


More information about the hotspot-gc-dev mailing list