Prepare for verification?

Jesper Wilhelmsson jesper.wilhelmsson at oracle.com
Wed Aug 20 14:23:44 UTC 2014


Hi,

When removing the generations array I ran in to the following question.

In GenCollectedHeap::do_collection() there is this code:

if (VerifyBeforeGC && i >= VerifyGCLevel &&
     total_collections() >= VerifyGCStartAt) {
   HandleMark hm;  // Discard invalid handles created during verification
   if (!prepared_for_verification) {
     prepare_for_verify();
     prepared_for_verification = true;
   }
   Universe::verify(" VerifyBeforeGC:");
}

Note that we make sure to run prepare_for_verify() before calling 
Universe::verify().

Later there is this code:

if (VerifyAfterGC && i >= VerifyGCLevel &&
     total_collections() >= VerifyGCStartAt) {
   HandleMark hm;  // Discard invalid handles created during verification
   Universe::verify(" VerifyAfterGC:");
}

Here we do not prepare for verification.


Now, what happens if we run with VerifyBeforeGC=false and VerifyAfterGC=true?

As far as I can see, only CMS has an implementation for prepare_for_verify(), 
where it does things like CompactibleFreeListSpace::repairLinearAllocationBlocks()

I have been playing around with CMS trying to provoke something here but I can't 
say that I understand the linear allocation blocks well enough to know how to 
create a potentially bad situation. Could there be a problem here or is the 
preparation before verification voluntary?

Since I'm rewriting this code slightly I need to know if I should preserve this 
behavior or make sure that we have prepared in the after GC case as well.

Thanks,
/Jesper



More information about the hotspot-gc-dev mailing list