RFR: JDK-8260200 G1: Remove unnecessary update in FreeRegionList::remove_starting_at [v4]

Stefan Johansson sjohanss at openjdk.java.net
Tue Jan 26 08:56:45 UTC 2021


On Tue, 26 Jan 2021 01:36:56 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> optimize FreeRegionList::remove_starting_at by removing unnecessary reading and setting
>> 
>> FreeRegionList::remove_starting_at(...) traverses from a node and removes subsequent N nodes from free list. But when traverses the free list, it removes nodes one by one by setting the prev and next pointers of prev and next node. it's not necessary do these settings for every node, as we can remove target nodes at once and just set prev and next pointers for just 2 nodes.
>
> Hamlin Li has updated the pull request incrementally with one additional commit since the last revision:
> 
>   JDK-8260200: G1: Remove unnecessary update in FreeRegionList::remove_starting_at

Latest update looks good, just a few new comments.

src/hotspot/share/gc/g1/heapRegionSet.cpp line 234:

> 232:   assert_free_region_list(_head != next, "invariant");
> 233:   if (next != NULL) {
> 234:     assert_free_region_list(next->prev() != NULL, "invariant");

This assert could be next->prev() == curr, or am I missing some case?

src/hotspot/share/gc/g1/heapRegionSet.hpp line 230:

> 228:   void abandon();
> 229: 
> 230:   void verify_region_to_remove(HeapRegion* curr, HeapRegion* next) NOT_DEBUG_RETURN;

Please move this to the private section, right below the `add_list_common`-functions would be fine.

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

Changes requested by sjohanss (Reviewer).

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



More information about the hotspot-gc-dev mailing list