RFR: JDK-8073321: assert(q > prev_q) failed: we should be moving forward through memory
bengt.rutisson at oracle.com
Wed Apr 13 14:54:03 UTC 2016
Could I have a couple of reviews for this change?
The assert happens in scan_and_adjust_pointers() and it could happen if
scan_and_forward() is not behaving properly. What could happen is that
the all object up to _first_dead should not be moved, which means that
they should all be "unmarked" even though they are under the _first_dead
value. However, the code just checks the first object. So, if
scan_and_forward() would for some reason happen to mark the first object
but not the rest we will read a mark word instead of a pointer to a live
object in scan_and_adjust_pointers().
I have not been able to reproduce this problem. But I changed the code
in scan_and_adjust_pointers() to not just check the first object, but
instead treat all objects up to _first_dead as non-moved objects. This
should make the code more stable.
To be able to understand the code while I was trying to look for a
problem in it I had to rename some variables and make some refactorings.
I think it is worth pushing this renamed and refactored code. And I
think it is worth closing JDK-8073321 even if I have not been able to
prove that my patch actually fixes the specific issue in the bug report.
The problem has only ever happened twice so I think that with the better
assert message added by JDK-8153203 we have a better chance of catching
any other problems if it happens again and JDK-8073321 is closed.
Here are some incremental webrevs to make it easier to review this change:
Renaming variables in scan_and_adjust_pointers():
The fix to make sure to treat all objects below _first_dead correctly:
Renaming variable in scan_and_forward() (and some small refactoring):
Refactoring of scan_and_forward(), in particular introducing a
DeadSpacer class to handle the special case for the non-G1 case:
(BTW, I would very much appreciate suggestions for a better name for
Renaming variables in scan_and_compact():
More information about the hotspot-gc-dev