code question

Joseph Provino joseph.provino at oracle.com
Mon Jun 8 15:03:31 UTC 2015


On 6/8/2015 10:44 AM, Stefan Karlsson wrote:
> On 2015-06-08 16:37, 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.
>
> You should probably change G1CollectedHeap::collection_set_iteratate 
> as well, since none of the callers pass a closure that returns true 
> from doHeapRegion.
okay.
>
> Erik H suggested that we should create new closure named 
> AbortableHeapRegionClosure and get rid of the abort mechanism from 
> HeapRegionClosure.
Wouldn't the iterator have to know the abort happened?

joe

>
> StefanK
>
>>
>> Thanks,
>>    Thomas
>>
>>
>




More information about the hotspot-gc-dev mailing list