RFR: 8305896: Alternative full GC forwarding [v20]

Thomas Stuefe stuefe at openjdk.org
Wed May 3 11:20:23 UTC 2023


On Wed, 3 May 2023 11:13:47 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> src/hotspot/share/gc/shared/slidingForwarding.cpp line 153:
>> 
>>> 151:   // Set from and to in new or found entry.
>>> 152:   entry->_from = from;
>>> 153:   entry->_to   = to;
>> 
>> Why so complicated? Proposal:
>> 
>> while (entry != nullptr && entry->_from != from) {
>>   entry = entry->_next;
>> }
>> if (entry == nullptr) {
>>   FallbackTableEntry* new_entry = NEW_C_HEAP_OBJ(FallbackTableEntry, mtGC);
>>   new_entry->next = head;
>>   new_entry->_from = from;
>>   head = entry = new_entry;
>> }
>> entry->_to = to;
>
> Uhm, so this would not change the actual head
> 
>> Why so complicated? Proposal:
>> 
>> ```
>> while (entry != nullptr && entry->_from != from) {
>>   entry = entry->_next;
>> }
>> if (entry == nullptr) {
>>   FallbackTableEntry* new_entry = NEW_C_HEAP_OBJ(FallbackTableEntry, mtGC);
>>   new_entry->next = head;
>>   new_entry->_from = from;
>>   head = entry = new_entry;
>> }
>> entry->_to = to;
>> ```
> 
> Remember that head points into the array. We cannot actually prepend the new entry, we can only insert it as the first linked entry after head. If I see it correctly, it would not actually change the head-entry (the stuff in the array) except for its _to field. Also, the new_entry would not get linked anywhere. Or what am I missing?

Ah, sorry, I just realized you inlined the head elements into the table. Okay, never mind then.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13582#discussion_r1183553784


More information about the hotspot-gc-dev mailing list