Colored pointers are one of the core concepts of ZGC. It enables ZGC to find, mark, locate, and remap the objects. It doesn't support x32 platforms. Implementation of colored points needs virtual address masking, which could be accomplished either in the hardware, operating system, or software. The following diagram shows the 64-bit pointer layout:
As shown in the preceding diagram, the 64-bit object reference is divided as follows:
- 18 bits: Unused bits
- 1-bit: Finalizable
- 1-bit: Remapped
- 1-bit: Marked1
- 1-bit: Marked0
- 42 bits: Object Address
The first 18 bits are reserved for future use. The 42 bits can address up to 4 TB ...