RFR (M): 8087198: G1 card refinement: batching, sorting

Man Cao manc at google.com
Tue Nov 19 20:02:01 UTC 2019

Thanks for the feedback. I will address them soon.

One question about casting:

> I would prefer leaving the type alone here and instead using
>   static_cast<CardTable::CardValue*>(_node_buffer[i])
> (maybe packaged in a little helper here).
> But I have a strong dislike for reinterpret_cast (with whatever
> spelling) where it can reasonably be avoided.

There is a problem with G1RemSet::clean_card_before_refine(CardValue*&
that it needs to modify the card_ptr. In order to make the code clean for
two-finger compaction, the code needs to call
clean_card_before_refine(_node_buffer[i]) and able to modify
_node_buffer[i] in-place.

If we have "void** _node_buffer", then it cannot do

I found a workaround:
Change to:
G1RemSet::clean_card_before_refine(CardValue** card_ptr_addr);
void* card_addr = &_node_buffer[i];

However, I think this is
basically reinterpret_cast<CardValue**>(&_node_buffer[i]).
Any suggestion on a better casting approach?


More information about the hotspot-gc-dev mailing list