Tue, 03 Nov 2009 16:43:16 -0800
6801625: CDS: HeapDump tests crash with internal error in compactingPermGenGen.cpp
Summary: Allow iteration over the shared spaces when using CDS, repealing previous proscription. Deferred further required CDS-related cleanups of perm gen to CR 6897789.
Reviewed-by: phh, jmasa
1.1 --- a/src/share/vm/memory/compactingPermGenGen.cpp Fri Oct 30 13:31:11 2009 -0400 1.2 +++ b/src/share/vm/memory/compactingPermGenGen.cpp Tue Nov 03 16:43:16 2009 -0800 1.3 @@ -352,15 +352,19 @@ 1.4 } 1.5 1.6 1.7 +// Do not use in time-critical operations due to the possibility of paging 1.8 +// in otherwise untouched or previously unread portions of the perm gen, 1.9 +// for instance, the shared spaces. NOTE: Because CompactingPermGenGen 1.10 +// derives from OneContigSpaceCardGeneration which is supposed to have a 1.11 +// single space, and does not override its object_iterate() method, 1.12 +// object iteration via that interface does not look at the objects in 1.13 +// the shared spaces when using CDS. This should be fixed; see CR 6897798. 1.14 void CompactingPermGenGen::space_iterate(SpaceClosure* blk, bool usedOnly) { 1.15 OneContigSpaceCardGeneration::space_iterate(blk, usedOnly); 1.16 if (spec()->enable_shared_spaces()) { 1.17 -#ifdef PRODUCT 1.18 // Making the rw_space walkable will page in the entire space, and 1.19 - // is to be avoided. However, this is required for Verify options. 1.20 - ShouldNotReachHere(); 1.21 -#endif 1.22 - 1.23 + // is to be avoided in the case of time-critical operations. 1.24 + // However, this is required for Verify and heap dump operations. 1.25 blk->do_space(ro_space()); 1.26 blk->do_space(rw_space()); 1.27 }
2.1 --- a/src/share/vm/memory/compactingPermGenGen.hpp Fri Oct 30 13:31:11 2009 -0400 2.2 +++ b/src/share/vm/memory/compactingPermGenGen.hpp Tue Nov 03 16:43:16 2009 -0800 2.3 @@ -29,6 +29,9 @@ 2.4 class PermanentGenerationSpec; 2.5 2.6 // This is the "generation" view of a CompactingPermGen. 2.7 +// NOTE: the shared spaces used for CDS are here handled in 2.8 +// a somewhat awkward and potentially buggy fashion, see CR 6801625. 2.9 +// This infelicity should be fixed, see CR 6897789. 2.10 class CompactingPermGenGen: public OneContigSpaceCardGeneration { 2.11 friend class VMStructs; 2.12 // Abstractly, this is a subtype that gets access to protected fields. 2.13 @@ -47,7 +50,7 @@ 2.14 OffsetTableContigSpace* _ro_space; 2.15 OffsetTableContigSpace* _rw_space; 2.16 2.17 - // With shared spaces there is a dicotomy in the use of the 2.18 + // With shared spaces there is a dichotomy in the use of the 2.19 // _virtual_space of the generation. There is a portion of the 2.20 // _virtual_space that is used for the unshared part of the 2.21 // permanent generation and a portion that is reserved for the shared part.
3.1 --- a/src/share/vm/memory/generation.cpp Fri Oct 30 13:31:11 2009 -0400 3.2 +++ b/src/share/vm/memory/generation.cpp Tue Nov 03 16:43:16 2009 -0800 3.3 @@ -606,6 +606,13 @@ 3.4 void OneContigSpaceCardGeneration::prepare_for_verify() {} 3.5 3.6 3.7 +// Override for a card-table generation with one contiguous 3.8 +// space. NOTE: For reasons that are lost in the fog of history, 3.9 +// this code is used when you iterate over perm gen objects, 3.10 +// even when one uses CDS, where the perm gen has a couple of 3.11 +// other spaces; this is because CompactingPermGenGen derives 3.12 +// from OneContigSpaceCardGeneration. This should be cleaned up, 3.13 +// see CR 6897789.. 3.14 void OneContigSpaceCardGeneration::object_iterate(ObjectClosure* blk) { 3.15 _the_space->object_iterate(blk); 3.16 }