Currently there are two members in HeapRegion used to index a CSet, one if the region is young and one if the region is optional:
uint _index_in_opt_cset;
int _young_index_in_cset;
What CSet the region belongs to is stored in the InCSetState. Using this information we should be able to only keep one index member.
Currently one problem with this is that the _young_index_in_cset makes use of the fact that the default value for old regions is -1 and if adding 1 we get the valid index 0 with is used to keep surviving bytes into old.
uint _index_in_opt_cset;
int _young_index_in_cset;
What CSet the region belongs to is stored in the InCSetState. Using this information we should be able to only keep one index member.
Currently one problem with this is that the _young_index_in_cset makes use of the fact that the default value for old regions is -1 and if adding 1 we get the valid index 0 with is used to keep surviving bytes into old.