20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "gc/cms/cmsHeap.hpp" 27 #include "gc/cms/cmsLockVerifier.hpp" 28 #include "gc/cms/compactibleFreeListSpace.hpp" 29 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp" 30 #include "gc/cms/concurrentMarkSweepThread.hpp" 31 #include "gc/shared/blockOffsetTable.inline.hpp" 32 #include "gc/shared/collectedHeap.inline.hpp" 33 #include "gc/shared/space.inline.hpp" 34 #include "gc/shared/spaceDecorator.hpp" 35 #include "logging/log.hpp" 36 #include "logging/logStream.hpp" 37 #include "memory/allocation.inline.hpp" 38 #include "memory/resourceArea.hpp" 39 #include "memory/universe.hpp" 40 #include "oops/oop.inline.hpp" 41 #include "runtime/globals.hpp" 42 #include "runtime/handles.inline.hpp" 43 #include "runtime/init.hpp" 44 #include "runtime/java.hpp" 45 #include "runtime/orderAccess.inline.hpp" 46 #include "runtime/vmThread.hpp" 47 #include "utilities/align.hpp" 48 #include "utilities/copy.hpp" 49 50 ///////////////////////////////////////////////////////////////////////// 51 //// CompactibleFreeListSpace 52 ///////////////////////////////////////////////////////////////////////// 53 54 // highest ranked free list lock rank 55 int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3; 56 57 // Defaults are 0 so things will break badly if incorrectly initialized. 58 size_t CompactibleFreeListSpace::IndexSetStart = 0; 59 size_t CompactibleFreeListSpace::IndexSetStride = 0; 2233 // Remark has been completed, the object should be marked 2234 _bit_map->isMarked((HeapWord*)obj); 2235 } 2236 } else { // reference within CMS heap 2237 if (_past_remark) { 2238 // Remark has been completed -- so the referent should have 2239 // been marked, if referring object is. 2240 if (_bit_map->isMarked(_collector->block_start(p))) { 2241 guarantee(_bit_map->isMarked((HeapWord*)obj), "Marking error?"); 2242 } 2243 } 2244 } 2245 } else if (_sp->is_in_reserved(p)) { 2246 // the reference is from FLS, and points out of FLS 2247 guarantee(oopDesc::is_oop(obj), "Should be an oop"); 2248 obj->verify(); 2249 } 2250 } 2251 2252 template <class T> void do_oop_work(T* p) { 2253 T heap_oop = oopDesc::load_heap_oop(p); 2254 if (!oopDesc::is_null(heap_oop)) { 2255 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); 2256 do_oop(p, obj); 2257 } 2258 } 2259 2260 public: 2261 VerifyAllOopsClosure(const CMSCollector* collector, 2262 const CompactibleFreeListSpace* sp, MemRegion span, 2263 bool past_remark, CMSBitMap* bit_map) : 2264 _collector(collector), _sp(sp), _span(span), 2265 _past_remark(past_remark), _bit_map(bit_map) { } 2266 2267 virtual void do_oop(oop* p) { VerifyAllOopsClosure::do_oop_work(p); } 2268 virtual void do_oop(narrowOop* p) { VerifyAllOopsClosure::do_oop_work(p); } 2269 }; 2270 2271 void CompactibleFreeListSpace::verify() const { 2272 assert_lock_strong(&_freelistLock); 2273 verify_objects_initialized(); 2274 MemRegion span = _collector->_span; 2275 bool past_remark = (_collector->abstract_state() == | 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "gc/cms/cmsHeap.hpp" 27 #include "gc/cms/cmsLockVerifier.hpp" 28 #include "gc/cms/compactibleFreeListSpace.hpp" 29 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp" 30 #include "gc/cms/concurrentMarkSweepThread.hpp" 31 #include "gc/shared/blockOffsetTable.inline.hpp" 32 #include "gc/shared/collectedHeap.inline.hpp" 33 #include "gc/shared/space.inline.hpp" 34 #include "gc/shared/spaceDecorator.hpp" 35 #include "logging/log.hpp" 36 #include "logging/logStream.hpp" 37 #include "memory/allocation.inline.hpp" 38 #include "memory/resourceArea.hpp" 39 #include "memory/universe.hpp" 40 #include "oops/access.inline.hpp" 41 #include "oops/compressedOops.inline.hpp" 42 #include "oops/oop.inline.hpp" 43 #include "runtime/globals.hpp" 44 #include "runtime/handles.inline.hpp" 45 #include "runtime/init.hpp" 46 #include "runtime/java.hpp" 47 #include "runtime/orderAccess.inline.hpp" 48 #include "runtime/vmThread.hpp" 49 #include "utilities/align.hpp" 50 #include "utilities/copy.hpp" 51 52 ///////////////////////////////////////////////////////////////////////// 53 //// CompactibleFreeListSpace 54 ///////////////////////////////////////////////////////////////////////// 55 56 // highest ranked free list lock rank 57 int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3; 58 59 // Defaults are 0 so things will break badly if incorrectly initialized. 60 size_t CompactibleFreeListSpace::IndexSetStart = 0; 61 size_t CompactibleFreeListSpace::IndexSetStride = 0; 2235 // Remark has been completed, the object should be marked 2236 _bit_map->isMarked((HeapWord*)obj); 2237 } 2238 } else { // reference within CMS heap 2239 if (_past_remark) { 2240 // Remark has been completed -- so the referent should have 2241 // been marked, if referring object is. 2242 if (_bit_map->isMarked(_collector->block_start(p))) { 2243 guarantee(_bit_map->isMarked((HeapWord*)obj), "Marking error?"); 2244 } 2245 } 2246 } 2247 } else if (_sp->is_in_reserved(p)) { 2248 // the reference is from FLS, and points out of FLS 2249 guarantee(oopDesc::is_oop(obj), "Should be an oop"); 2250 obj->verify(); 2251 } 2252 } 2253 2254 template <class T> void do_oop_work(T* p) { 2255 T heap_oop = RawAccess<>::oop_load(p); 2256 if (!CompressedOops::is_null(heap_oop)) { 2257 oop obj = CompressedOops::decode_not_null(heap_oop); 2258 do_oop(p, obj); 2259 } 2260 } 2261 2262 public: 2263 VerifyAllOopsClosure(const CMSCollector* collector, 2264 const CompactibleFreeListSpace* sp, MemRegion span, 2265 bool past_remark, CMSBitMap* bit_map) : 2266 _collector(collector), _sp(sp), _span(span), 2267 _past_remark(past_remark), _bit_map(bit_map) { } 2268 2269 virtual void do_oop(oop* p) { VerifyAllOopsClosure::do_oop_work(p); } 2270 virtual void do_oop(narrowOop* p) { VerifyAllOopsClosure::do_oop_work(p); } 2271 }; 2272 2273 void CompactibleFreeListSpace::verify() const { 2274 assert_lock_strong(&_freelistLock); 2275 verify_objects_initialized(); 2276 MemRegion span = _collector->_span; 2277 bool past_remark = (_collector->abstract_state() == |