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

Kim Barrett kim.barrett at oracle.com
Tue Nov 3 02:52:23 UTC 2015


> From: per.liden at oracle.com
> Sent: Monday, November 2, 2015 5:02:31 AM GMT -05:00 US/Canada Eastern

Thanks Per.  Responses inline below.

> 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.
> >
> > [...]
> >
> > CR:
> > https://bugs.openjdk.java.net/browse/JDK-6899049
> >
> > Webrev:
> > http://cr.openjdk.java.net/~kbarrett/6899049/webrev.00/
> 
> 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.

> satbQueue.cpp
> -------------
>   125   while (limit < src) {
> 
> Since limit is the constant here I find easier to read it like:
> 
>   while (src >= limit)

Presumably (wrc > limit) was meant.

I didn't make this change because I prefer the existing order in this
case, for visualization reasons - limit is a lower bound, with src
stepping down from the right (if the buffer indices are viewed as
0...Size).

>   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()?

I simplified it further, eliminating the cancelling divisions by
sizeof(void*) and also eliminated the (I think never needed) cast of
G1SATBBufferEnqueueingThresholdPercent to size_t.

New webrev coming, since this is no longer a *completely* trivial
syntactic change.


More information about the hotspot-gc-dev mailing list