The difference between `XMark::follow_object` and `ZMark::follow_object`

Stefan Karlsson stefan.karlsson at oracle.com
Fri Mar 22 07:55:01 UTC 2024


Hi Guoxiong,

On 2024-03-21 14:52, Guoxiong Li wrote:
> Hi all,
>
> I noticed the `XMark::follow_object` invokes the
> `ContinuationGCSupport::relativize_stack_chunk` to transform the pointer.
> But `ZMark::follow_object` only checks if the object is a stack chunk
> by using `oopDesc::is_stackChunk`.

This could be a left-over from when we first wrote the Loom support for 
ZGC. At some point we thought that it we should make explicit calls to 
relativize/transform chunks before iterating over the oops. However, we 
later realized that there were a number of places that iterated over the 
stack chunks without calling relativize/transform, so the code to fix 
that was moved into the oop_oop_iterate functions. It could be that we 
just didn't go back and updated the XMark code. I don't think it hurts 
to do it up-front, but it might be nice to change it to make the code 
more consistent. However, note that you need to perform significant 
amount of testing before such a change will be integrated.

>
> And the `XBarrierSetStackChunk::encode_gc_mode` is an 
> empty implementation.

Non-generational ZGC (X) uses the same oop format for transformed and 
non-transformed stack chunks. Generational ZGC uses two different 
pointer formtas, so it needs to convert the oops via these functions.

Cheers,
StefanK

> Does the `XMark::follow_object` need to invoke 
> `ContinuationGCSupport::relativize_stack_chunk`?
> Or is it just unrelated code which needs to be adjusted?


>
>
> Best Regards,
> -- Guoxiong



More information about the hotspot-gc-dev mailing list