RFR: 8310031: Parallel: Implement better work distribution for large object arrays in old gen [v24]

Richard Reingruber rrich at openjdk.org
Thu Oct 19 20:34:12 UTC 2023


On Thu, 19 Oct 2023 14:51:52 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Richard Reingruber has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   preprocess_card_table_parallel should be private
>
> src/hotspot/share/gc/parallel/psCardTable.cpp line 235:
> 
>> 233:         }
>> 234:       }
>> 235:     }
> 
> I think this code becomes more clear if the nested-ifs are replaced by negation and `continue`. I also added some additional comments giving reasons for the conditions.
> 
> Suggestion:
> 
>   for (CardValue* cur_card = byte_for(old_gen_bottom) + stripe_index * num_cards_in_stripe; // this may be left outside, your call, it is a bit long.
>        cur_card < end_card;
>        cur_card += num_cards_in_slice) {
>     HeapWord* stripe_addr = addr_for(cur_card);
>     if (is_dirty(cur_card) {
>       // The first card of this stripe is already dirty, no need to see if the reaching-in object is a potentially imprecisely marked non-array object.
>       continue;
>     }
>     HeapWord* first_obj_addr = object_start(stripe_addr);
>     if (first_obj_addr == stripe_addr) {                             // (random comment) can't be > I think
>       // No object reaching into this stripe.
>       continue;
>     }
>     oop first_obj = cast_to_oop(first_obj_addr);
>     if (!first_obj->is_array() && is_dirty(byte_for(first_obj_addr))) {
>       // Found a non-array object reaching into the stripe assigned to this thread that has potentially been marked imprecisely.
>       // Mark first card of stripe dirty so that this thread will process it later.
>       *cur_card = dirty_card_val();
>     }
>   }

It's actually just a minor detail that the thread that marks the first card dirty will also process that stripe. The assignment could be changed without effect. I'll leave that part out.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14846#discussion_r1366079466


More information about the hotspot-gc-dev mailing list