code question

Thomas Schatzl thomas.schatzl at oracle.com
Mon Jun 8 14:37:10 UTC 2015


Hi Joe,

On Thu, 2015-06-04 at 15:12 -0400, Joseph Provino wrote:
> I just ran across some code in 
> g1CollectedHeap::collection_set_iterate_from()
> that looks a little strange.  It's been there since the first revision 342.
> 
>      if (cl->doHeapRegion(cur) && false) {
>        cl->incomplete();
>        return;
>      }
> 
> Is there any reason why this isn't just
> 
>        cl->doHeapRegion(cur);

  file a bug and enjoy an easy cleanup for your path to a Committer...

The HeapRegionClosure has a way of sending an "abort" notification due
to error to the caller, which is that "cl->incomplete()" call.
However in many if not all cases it is not used because either the work
that needs to be done cannot fail, or any failure is really fatal
anyway.

That's probably why the strange code - but you'll probably find more of
that the deeper you dig.

I would replace that code by the call to cl->doHeapRegion() and
guarantee() that its return value is always true in this case.

Thanks,
  Thomas





More information about the hotspot-gc-dev mailing list