comparison src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp @ 452:00b023ae2d78

6722113: CMS: Incorrect overflow handling during precleaning of Reference lists Summary: When we encounter marking stack overflow during precleaning of Reference lists, we were using the overflow list mechanism, which can cause problems on account of mutating the mark word of the header because of conflicts with mutator accesses and updates of that field. Instead we should use the usual mechanism for overflow handling in concurrent phases, namely dirtying of the card on which the overflowed object lies. Since precleaning effectively does a form of discovered list processing, albeit with discovery enabled, we needed to adjust some code to be correct in the face of interleaved processing and discovery. Reviewed-by: apetrusenko, jcoomes
author ysr
date Thu, 20 Nov 2008 12:27:41 -0800
parents b5489bb705c9
children 05f89f00a864 148e5441d916
comparison
equal deleted inserted replaced
443:b5e603f2e024 452:00b023ae2d78
323 }; 323 };
324 324
325 // For objects in CMS generation, this closure marks 325 // For objects in CMS generation, this closure marks
326 // given objects (transitively) as being reachable/live. 326 // given objects (transitively) as being reachable/live.
327 // This is currently used during the (weak) reference object 327 // This is currently used during the (weak) reference object
328 // processing phase of the CMS final checkpoint step. 328 // processing phase of the CMS final checkpoint step, as
329 // well as during the concurrent precleaning of the discovered
330 // reference lists.
329 class CMSKeepAliveClosure: public OopClosure { 331 class CMSKeepAliveClosure: public OopClosure {
330 private: 332 private:
331 CMSCollector* _collector; 333 CMSCollector* _collector;
332 const MemRegion _span; 334 const MemRegion _span;
333 CMSMarkStack* _mark_stack; 335 CMSMarkStack* _mark_stack;
334 CMSBitMap* _bit_map; 336 CMSBitMap* _bit_map;
337 bool _concurrent_precleaning;
335 protected: 338 protected:
336 DO_OOP_WORK_DEFN 339 DO_OOP_WORK_DEFN
337 public: 340 public:
338 CMSKeepAliveClosure(CMSCollector* collector, MemRegion span, 341 CMSKeepAliveClosure(CMSCollector* collector, MemRegion span,
339 CMSBitMap* bit_map, CMSMarkStack* mark_stack): 342 CMSBitMap* bit_map, CMSMarkStack* mark_stack,
343 bool cpc):
340 _collector(collector), 344 _collector(collector),
341 _span(span), 345 _span(span),
342 _bit_map(bit_map), 346 _bit_map(bit_map),
343 _mark_stack(mark_stack) { 347 _mark_stack(mark_stack),
348 _concurrent_precleaning(cpc) {
344 assert(!_span.is_empty(), "Empty span could spell trouble"); 349 assert(!_span.is_empty(), "Empty span could spell trouble");
345 } 350 }
351 bool concurrent_precleaning() const { return _concurrent_precleaning; }
346 virtual void do_oop(oop* p); 352 virtual void do_oop(oop* p);
347 virtual void do_oop(narrowOop* p); 353 virtual void do_oop(narrowOop* p);
348 inline void do_oop_nv(oop* p) { CMSKeepAliveClosure::do_oop_work(p); } 354 inline void do_oop_nv(oop* p) { CMSKeepAliveClosure::do_oop_work(p); }
349 inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); } 355 inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); }
350 }; 356 };