RFR: 8150676: Use BufferNode index

Kim Barrett kim.barrett at oracle.com
Fri Mar 4 00:01:22 UTC 2016


>> One thing that makes it tricky is the aforesaid line 136 assertion,
>> which I found very helpful, but which requires some additional code
>> (such as line 132) to make it work. That is, this suffices,
>> 
>>   for ( ; src < dst; ++src) {
>>     if (retain_entry(entry, g1h)) {
>>       while (src < --dst) {
>>         if (!retain_entry(*dst, g1h)) {
>>           *dst = entry;
>>           break;
>>         }
>>       }
>>     }
>>   }
>>   _index = pointer_delta(dst, buf, 1);
>> 
>> but I find it less convincing without the final assert, which doesn't
>> hold with this version.

After thinking about it some more, I’m planning to switch to the above version,
and just avoid the complexity needed to arrange the final assert(src == dst).
Of course, keeping comments similar to the previous version about the search
stages, plus a comment at the end of the loop that dst points to the lowest retained
entry, or the end of the buffer if all entries are filtered out.  I was also going to
describe the final value of src too, but then asked myself why I was describing the
somewhat complicated state of a dead variable.



More information about the hotspot-gc-dev mailing list