RFR: 6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp

Per Liden per.liden at oracle.com
Mon Nov 2 10:02:29 UTC 2015

Hi Kim,

On 2015-10-31 01:04, Kim Barrett wrote:
> Please review this cleanup of various issues in ptrQueue and related
> classes, e.g. ObjPtrQueue, DirtyCardQueue, and the associated XxxSet
> classes.  This is in preparation for some structural improvements.
> Remove unused DirtyCardQueue::set_buf() and PtrQueue::index_to_byte_index().
> Renamed PtrQueue::_perm to _permanent, to match reader function.
> Changed iteration over PtrQueue buffer to use element indexing rather
> than bytes converted to elements on each iteration.  For SATB buffer
> filtering, directly use pointer-based iteration.
> Fixed index types for byte_index_to_index to be size_t rather than
> int, eliminating the need for a bunch of conversion casts.
> In PtrQueue, use sizeof(void*) rather than oopSize for byte
> adjustments. This class shouldn't know anything about oops.
> More restrictive access to various members, including non-public
> constructor and destructor for PtrQueue and PtrQueueSet base classes.
> In queue constructors, fixed type of associated set to match the queue
> type, e.g. DirtyCardQueue requires a DirtyCardQueueSet rather than
> just any old PtrQueueSet.
> debug_only => DEBUG_ONLY.
> CR:
> https://bugs.openjdk.java.net/browse/JDK-6899049
> Webrev:
> http://cr.openjdk.java.net/~kbarrett/6899049/webrev.00/
> Testing:
> JPRT, Aurora ad hoc GC/Runtime Nightly

Looks good. Just found two small things. I leave it up to you if you 
want to fix them or not. I don't need to see another webrev.

  125   while (limit < src) {

Since limit is the constant here I find easier to read it like:

  while (src >= limit)

  175   size_t sz = _sz;
  176   size_t all_entries = sz / sizeof(void*);
  177   size_t retained_entries = (sz - _index) / sizeof(void*);

How about removing the local sz, like you did in ObjPtrQueue::filter()?


More information about the hotspot-gc-dev mailing list