code question

Joseph Provino joseph.provino at
Mon Jun 8 14:43:30 UTC 2015

On 6/8/2015 10:37 AM, Thomas Schatzl wrote:
> 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.
I see two calls to collection_set_iterate_from() with different closures.
cl->doHeapRegion() always returns false in both cases.  So I think I should
guarantee false.  Right?


> Thanks,
>    Thomas

More information about the hotspot-gc-dev mailing list