Wed, 12 Mar 2014 17:13:48 +0100
8038412: Move object_iterate_careful down from Space to ContigousSpace and CFLSpace
Summary: Only declare the functions where they are actually needed.
Reviewed-by: tschatzl, stefank
1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Wed Mar 12 15:22:45 2014 +0100 1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Wed Mar 12 17:13:48 2014 +0100 1.3 @@ -907,39 +907,6 @@ 1.4 } 1.5 } 1.6 1.7 -// Callers of this iterator beware: The closure application should 1.8 -// be robust in the face of uninitialized objects and should (always) 1.9 -// return a correct size so that the next addr + size below gives us a 1.10 -// valid block boundary. [See for instance, 1.11 -// ScanMarkedObjectsAgainCarefullyClosure::do_object_careful() 1.12 -// in ConcurrentMarkSweepGeneration.cpp.] 1.13 -HeapWord* 1.14 -CompactibleFreeListSpace::object_iterate_careful(ObjectClosureCareful* cl) { 1.15 - assert_lock_strong(freelistLock()); 1.16 - HeapWord *addr, *last; 1.17 - size_t size; 1.18 - for (addr = bottom(), last = end(); 1.19 - addr < last; addr += size) { 1.20 - FreeChunk* fc = (FreeChunk*)addr; 1.21 - if (fc->is_free()) { 1.22 - // Since we hold the free list lock, which protects direct 1.23 - // allocation in this generation by mutators, a free object 1.24 - // will remain free throughout this iteration code. 1.25 - size = fc->size(); 1.26 - } else { 1.27 - // Note that the object need not necessarily be initialized, 1.28 - // because (for instance) the free list lock does NOT protect 1.29 - // object initialization. The closure application below must 1.30 - // therefore be correct in the face of uninitialized objects. 1.31 - size = cl->do_object_careful(oop(addr)); 1.32 - if (size == 0) { 1.33 - // An unparsable object found. Signal early termination. 1.34 - return addr; 1.35 - } 1.36 - } 1.37 - } 1.38 - return NULL; 1.39 -} 1.40 1.41 // Callers of this iterator beware: The closure application should 1.42 // be robust in the face of uninitialized objects and should (always)
2.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Wed Mar 12 15:22:45 2014 +0100 2.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Wed Mar 12 17:13:48 2014 +0100 2.3 @@ -376,11 +376,8 @@ 2.4 // terminate the iteration and return the address of the start of the 2.5 // subregion that isn't done. Return of "NULL" indicates that the 2.6 // interation completed. 2.7 - virtual HeapWord* 2.8 - object_iterate_careful_m(MemRegion mr, 2.9 - ObjectClosureCareful* cl); 2.10 - virtual HeapWord* 2.11 - object_iterate_careful(ObjectClosureCareful* cl); 2.12 + HeapWord* object_iterate_careful_m(MemRegion mr, 2.13 + ObjectClosureCareful* cl); 2.14 2.15 // Override: provides a DCTO_CL specific to this kind of space. 2.16 DirtyCardToOopClosure* new_dcto_cl(ExtendedOopClosure* cl,
3.1 --- a/src/share/vm/memory/space.cpp Wed Mar 12 15:22:45 2014 +0100 3.2 +++ b/src/share/vm/memory/space.cpp Wed Mar 12 17:13:48 2014 +0100 3.3 @@ -551,17 +551,6 @@ 3.4 object_iterate(&blk2); 3.5 } 3.6 3.7 -HeapWord* Space::object_iterate_careful(ObjectClosureCareful* cl) { 3.8 - guarantee(false, "NYI"); 3.9 - return bottom(); 3.10 -} 3.11 - 3.12 -HeapWord* Space::object_iterate_careful_m(MemRegion mr, 3.13 - ObjectClosureCareful* cl) { 3.14 - guarantee(false, "NYI"); 3.15 - return bottom(); 3.16 -} 3.17 - 3.18 bool Space::obj_is_alive(const HeapWord* p) const { 3.19 assert (block_is_obj(p), "The address should point to an object"); 3.20 return true;
4.1 --- a/src/share/vm/memory/space.hpp Wed Mar 12 15:22:45 2014 +0100 4.2 +++ b/src/share/vm/memory/space.hpp Wed Mar 12 17:13:48 2014 +0100 4.3 @@ -188,17 +188,6 @@ 4.4 // objects whose internal references point to objects in the space. 4.5 virtual void safe_object_iterate(ObjectClosure* blk) = 0; 4.6 4.7 - // Iterate over as many initialized objects in the space as possible, 4.8 - // calling "cl.do_object_careful" on each. Return NULL if all objects 4.9 - // in the space (at the start of the iteration) were iterated over. 4.10 - // Return an address indicating the extent of the iteration in the 4.11 - // event that the iteration had to return because of finding an 4.12 - // uninitialized object in the space, or if the closure "cl" 4.13 - // signalled early termination. 4.14 - virtual HeapWord* object_iterate_careful(ObjectClosureCareful* cl); 4.15 - virtual HeapWord* object_iterate_careful_m(MemRegion mr, 4.16 - ObjectClosureCareful* cl); 4.17 - 4.18 // Create and return a new dirty card to oop closure. Can be 4.19 // overriden to return the appropriate type of closure 4.20 // depending on the type of space in which the closure will 4.21 @@ -551,7 +540,14 @@ 4.22 // For contiguous spaces this method will iterate safely over objects 4.23 // in the space (i.e., between bottom and top) when at a safepoint. 4.24 void safe_object_iterate(ObjectClosure* blk); 4.25 - // iterates on objects up to the safe limit 4.26 + 4.27 + // Iterate over as many initialized objects in the space as possible, 4.28 + // calling "cl.do_object_careful" on each. Return NULL if all objects 4.29 + // in the space (at the start of the iteration) were iterated over. 4.30 + // Return an address indicating the extent of the iteration in the 4.31 + // event that the iteration had to return because of finding an 4.32 + // uninitialized object in the space, or if the closure "cl" 4.33 + // signaled early termination. 4.34 HeapWord* object_iterate_careful(ObjectClosureCareful* cl); 4.35 HeapWord* concurrent_iteration_safe_limit() { 4.36 assert(_concurrent_iteration_safe_limit <= top(),