468 // it to the reference processor for secondary filtering
469 // of references based on reachability of referent;
470 // see role of _is_alive_non_header closure in the
471 // ReferenceProcessor class.
472 // For objects in the CMS generation, this closure checks
473 // if the object is "live" (reachable). Used in weak
474 // reference processing.
475 class CMSIsAliveClosure: public BoolObjectClosure {
476 const MemRegion _span;
477 const CMSBitMap* _bit_map;
478
479 friend class CMSCollector;
480 public:
481 CMSIsAliveClosure(MemRegion span,
482 CMSBitMap* bit_map):
483 _span(span),
484 _bit_map(bit_map) {
485 assert(!span.is_empty(), "Empty span could spell trouble");
486 }
487
488 void do_object(oop obj) {
489 assert(false, "not to be invoked");
490 }
491
492 bool do_object_b(oop obj);
493 };
494
495
496 // Implements AbstractRefProcTaskExecutor for CMS.
497 class CMSRefProcTaskExecutor: public AbstractRefProcTaskExecutor {
498 public:
499
500 CMSRefProcTaskExecutor(CMSCollector& collector)
501 : _collector(collector)
502 { }
503
504 // Executes a task using worker threads.
505 virtual void execute(ProcessTask& task);
506 virtual void execute(EnqueueTask& task);
507 private:
508 CMSCollector& _collector;
509 };
510
511
1519 #endif // ASSERT
1520 _parallel(false),
1521 _bit_map(bit_map),
1522 _scan_closure(cl) { }
1523
1524 ScanMarkedObjectsAgainClosure(CMSCollector* collector,
1525 MemRegion span,
1526 ReferenceProcessor* rp,
1527 CMSBitMap* bit_map,
1528 OopTaskQueue* work_queue,
1529 Par_MarkRefsIntoAndScanClosure* cl):
1530 #ifdef ASSERT
1531 _collector(collector),
1532 _span(span),
1533 _work_queue(work_queue),
1534 #endif // ASSERT
1535 _parallel(true),
1536 _bit_map(bit_map),
1537 _par_scan_closure(cl) { }
1538
1539 void do_object(oop obj) {
1540 guarantee(false, "Call do_object_b(oop, MemRegion) instead");
1541 }
1542 bool do_object_b(oop obj) {
1543 guarantee(false, "Call do_object_b(oop, MemRegion) form instead");
1544 return false;
1545 }
1546 bool do_object_bm(oop p, MemRegion mr);
1547 };
1548
1549 // This closure is used during the second checkpointing phase
1550 // to rescan the marked objects on the dirty cards in the mod
1551 // union table and the card table proper. It invokes
1552 // ScanMarkedObjectsAgainClosure above to accomplish much of its work.
1553 // In the parallel case, the bit map is shared and requires
1554 // synchronized access.
1555 class MarkFromDirtyCardsClosure: public MemRegionClosure {
1556 CompactibleFreeListSpace* _space;
1557 ScanMarkedObjectsAgainClosure _scan_cl;
1558 size_t _num_dirty_cards;
1559
1560 public:
1561 MarkFromDirtyCardsClosure(CMSCollector* collector,
|
468 // it to the reference processor for secondary filtering
469 // of references based on reachability of referent;
470 // see role of _is_alive_non_header closure in the
471 // ReferenceProcessor class.
472 // For objects in the CMS generation, this closure checks
473 // if the object is "live" (reachable). Used in weak
474 // reference processing.
475 class CMSIsAliveClosure: public BoolObjectClosure {
476 const MemRegion _span;
477 const CMSBitMap* _bit_map;
478
479 friend class CMSCollector;
480 public:
481 CMSIsAliveClosure(MemRegion span,
482 CMSBitMap* bit_map):
483 _span(span),
484 _bit_map(bit_map) {
485 assert(!span.is_empty(), "Empty span could spell trouble");
486 }
487
488 bool do_object_b(oop obj);
489 };
490
491
492 // Implements AbstractRefProcTaskExecutor for CMS.
493 class CMSRefProcTaskExecutor: public AbstractRefProcTaskExecutor {
494 public:
495
496 CMSRefProcTaskExecutor(CMSCollector& collector)
497 : _collector(collector)
498 { }
499
500 // Executes a task using worker threads.
501 virtual void execute(ProcessTask& task);
502 virtual void execute(EnqueueTask& task);
503 private:
504 CMSCollector& _collector;
505 };
506
507
1515 #endif // ASSERT
1516 _parallel(false),
1517 _bit_map(bit_map),
1518 _scan_closure(cl) { }
1519
1520 ScanMarkedObjectsAgainClosure(CMSCollector* collector,
1521 MemRegion span,
1522 ReferenceProcessor* rp,
1523 CMSBitMap* bit_map,
1524 OopTaskQueue* work_queue,
1525 Par_MarkRefsIntoAndScanClosure* cl):
1526 #ifdef ASSERT
1527 _collector(collector),
1528 _span(span),
1529 _work_queue(work_queue),
1530 #endif // ASSERT
1531 _parallel(true),
1532 _bit_map(bit_map),
1533 _par_scan_closure(cl) { }
1534
1535 bool do_object_b(oop obj) {
1536 guarantee(false, "Call do_object_b(oop, MemRegion) form instead");
1537 return false;
1538 }
1539 bool do_object_bm(oop p, MemRegion mr);
1540 };
1541
1542 // This closure is used during the second checkpointing phase
1543 // to rescan the marked objects on the dirty cards in the mod
1544 // union table and the card table proper. It invokes
1545 // ScanMarkedObjectsAgainClosure above to accomplish much of its work.
1546 // In the parallel case, the bit map is shared and requires
1547 // synchronized access.
1548 class MarkFromDirtyCardsClosure: public MemRegionClosure {
1549 CompactibleFreeListSpace* _space;
1550 ScanMarkedObjectsAgainClosure _scan_cl;
1551 size_t _num_dirty_cards;
1552
1553 public:
1554 MarkFromDirtyCardsClosure(CMSCollector* collector,
|