Right now, at the beginning of a GC pause, we scan all pending update buffers, scan all cards pointed to by said update buffers, and update all remembered sets accordingly. It turns out, however, that there are a couple of opportunities for optimization. 1) We don't need to update remembered sets of any of the regions in the collection set. We explicitly keep track of references into the collection set during remembered set scanning, so there's no point in actually updating the remembered sets. Also, after the collection, all regions in the collection set will be reclaimed, along with their remembered set, so it is pointless to actually update their remembered sets. 2) We don't need to actually scan cards that are included in the collection set, as we will scan the objects in the collection when they are evacuated. The only problem with doing the above two optimizations is that if an evacuation failure happens, the heap will be left in an inconsistent state with lots of missing remembered sets, as some of the regions in the collection set will not actually move. The solution is to explicitly scan regions with evacuation failure at the end of the collection in order to update any remembered sets we're still missing.
|