G1 uses two different versions of the marking information:
- "prev" is the last one completed (which is guaranteed to be consistent and complete, i.e., no live object should be pointing to a dead object, but maybe no up-to-date) and
- "next" is the marking information that is being computed next (and which might be incomplete, as we might be half-way through completing it)
Heap verification in G1 also checks the consistency of the "prev" marking information (given that it's the only marking information that we can trust to be complete). However, we would also like to check the consistency of the "next" marking information at the only place where we can, which is the end of the remark phase.
This CR proposes to change the G1 verification code to either use the "prev" or "next" marking info, depending on what the caller needs.
Additionally, it adds verification of the "next" marking info at the end of the remark (conditional on the VerifyDuringGC flag) and removes the #ifndef PRODUCT from the verification at the end of cleanup (it's good to be able to do heap / marking verification in a product build).