GC and pointer masking

Stuart Monteith stuart.monteith at arm.com
Wed May 28 10:14:17 UTC 2025


On 23/05/2025 14:18, Tony Printezis wrote:
> Hi all,
> 
> Pointer masking is available for some architectures (including RISC-V!). This can allow us to mark the top bits of an object reference with what type of objects it is (young / old / humongous / etc.) without needing to clear those bits explicitly before we use the reference. This can be helpful both in the GC itself but also in the barriers (e.g., efficiently filter out young objects in barriers that are not needed on young objects).
> 
> Has anyone already looked into taking advantage of pointer masking in HotSpot? I tried a couple of searches but I didn’t find anything. If there’s been a discussion on this before, can you please point me to it?
> 
> Thanks,
> 
> Tony

Hello Tony,
	I experimented with tagged pointers for the colours in ZGC, using the Aarch64 Top-Byte-Ignore (TBI) feature. This was 
based on the SPARC code that used its ADI feature.

There was a discussion here: https://mail.openjdk.org/pipermail/aarch64-port-dev/2019-May/007293.html

There was a slight problem with tagged pointers being passed to the Linux kernel. libawt was being passed tagged object 
references which ended up in the writev system call. The Linux kernel, on Aarch64, has a feature to accept tagged 
pointers in system calls, although I never went back and checked that. The fix at the time was a trivial change to jni.c 
to filter out the tags.

BR,
	Stuart



More information about the hotspot-gc-dev mailing list