RFR (M): 8213996: Remove one of the SparsePRT entry tables

Thomas Schatzl thomas.schatzl at oracle.com
Fri Nov 16 14:19:42 UTC 2018

Hi all,

  can I have reviews for this change that removes one of the SparsePRT
entry tables?

In the SparsePRT code there is this comment:

//  Iterations are done on the _cur hash table, since they only need to
//  see entries visible at the start of a collection pause.
//  All other operations are done using the _next hash table.
RSHashTable* _cur;
RSHashTable* _next;

indicating that internally this PRT has actually two storage areas for
remembered set entries, one for iterating, one for adding.

However, this feature has never been used, and would be broken by
design: adding to a remembered set while it is iterated gives all kinds
of headaches; there is also really no need to iterate and add to a
remembered set at the same time with the current code, and it is only
this kind of PRT to have this "feature" (i.e. the HeapRegionRemSet as a
whole does not support it), and the existing code goes through a lot of
pain to keep the current and next table in sync before iteration.
Which btw means that _in the existing code_ iterating and adding at the
same time would break everything already.

This change removes these dual-set approach, as it just complicates
everything for no gain. Further it makes some future improvements much
more complicated than necessary.

>From a historical POV this feature has never been used in production my
recollection (at least >= JDK7), and was broken anyway in several ways
as mentioned above, so what was left was some complicated data
structure and dance in various phases to always iterate over the right
table, and to make sure to release resources correctly.

This change just removes all that code with no obvious penalties.

local gc jtreg testing, hs-tier1-5 (still running, but almost done w/o


More information about the hotspot-gc-dev mailing list