The current implementation of the G1 sparse remembered sets we use CardIdx_t as elements for SparsePRTEntrys, which are ints, while card offsets within a region can only range [0, 0xffff], since regions are capped at 32 MB.
The reason for this is that -1 is used to represent null value entries in SparsePRTEntry.
A key observation is that all the null entries are at the end of the array in SparsePRTEntry,
which means that adding an integer field _next_null, will be sufficient to keep track of the null entries.
This also means that clearing an array can be made faster, since it just involves setting this integer.
The reason for this is that -1 is used to represent null value entries in SparsePRTEntry.
A key observation is that all the null entries are at the end of the array in SparsePRTEntry,
which means that adding an integer field _next_null, will be sufficient to keep track of the null entries.
This also means that clearing an array can be made faster, since it just involves setting this integer.