In recent changes in JDK-8073321 the shared code for full gc has been cleaned up a bit.
There is still opportunity to improve the code further:
- braces after "if" in CompactibleSpace::clear_empty_region
- in CompactibleSpace::scan_and_compact, space->_first_dead can be extracted into a local variable instead of repeated access. Other methods repeatedly read the same variable (like CompactibleSpace::verify_up_to_first_dead) too. Not so much because of performance, but it makes the code easier to read.
- instead of space->bottom(), cur_obj could(!) be used to tighten the code further. There are arguments against it, but it should be thought about again.
All this would tighten the code a bit, making it more readable.