Relates :
|
The methods CompactibleSpace::scan_and_forward() and PSMarkSweepDecorator::precompact() are more or less copy-paste versions of each other. Both these use the LiveRange class. The LiveRange class is used to write to the mark word of a dead object. But no one really cares that the LiveRange class is used. Instead it just gives an extra level of indirection to already complicated code. We also do unnecessary work to keep track of the end of the range even though no one ever gets the end value. We also do duplicate stores to _first_dead in these methods. The methods that consume the values from the LiveRange (CompactibleSpace::scan_and_adjust_pointers() and PSMarkSweepDecorator::adjust_pointers()) don't use the LiveRange class. Instead they use oop()->mark()->decode_pointer(), which is kind of odd considering that this is normally used for forwarded objects. The code would be simpler if we just store and load directly from the memory addresses we are working with. Improving the assert at the end of the CompactibleSpace::scan_and_adjust_pointers() and PSMarkSweepDecorator::adjust_pointers() methods to log the values of q and prev_q will hopefully improve the chances of understanding JDK-8073321 if that ever happens again.