1688 }
1689 }
1690
1691 void G1ConcurrentMark::swapMarkBitMaps() {
1692 G1CMBitMap* temp = _prevMarkBitMap;
1693 _prevMarkBitMap = _nextMarkBitMap;
1694 _nextMarkBitMap = temp;
1695 }
1696
1697 // Closure for marking entries in SATB buffers.
1698 class G1CMSATBBufferClosure : public SATBBufferClosure {
1699 private:
1700 G1CMTask* _task;
1701 G1CollectedHeap* _g1h;
1702
1703 // This is very similar to G1CMTask::deal_with_reference, but with
1704 // more relaxed requirements for the argument, so this must be more
1705 // circumspect about treating the argument as an object.
1706 void do_entry(void* entry) const {
1707 _task->increment_refs_reached();
1708 HeapRegion* hr = _g1h->heap_region_containing(entry);
1709 if (entry < hr->next_top_at_mark_start()) {
1710 // Until we get here, we don't know whether entry refers to a valid
1711 // object; it could instead have been a stale reference.
1712 oop obj = static_cast<oop>(entry);
1713 assert(obj->is_oop(true /* ignore mark word */),
1714 "Invalid oop in SATB buffer: " PTR_FORMAT, p2i(obj));
1715 _task->make_reference_grey(obj);
1716 }
1717 }
1718
1719 public:
1720 G1CMSATBBufferClosure(G1CMTask* task, G1CollectedHeap* g1h)
1721 : _task(task), _g1h(g1h) { }
1722
1723 virtual void do_buffer(void** buffer, size_t size) {
1724 for (size_t i = 0; i < size; ++i) {
1725 do_entry(buffer[i]);
1726 }
1727 }
1728 };
1729
1730 class G1RemarkThreadsClosure : public ThreadClosure {
1731 G1CMSATBBufferClosure _cm_satb_cl;
1732 G1CMOopClosure _cm_cl;
1733 MarkingCodeBlobClosure _code_cl;
1734 int _thread_parity;
1735
1736 public:
|
1688 }
1689 }
1690
1691 void G1ConcurrentMark::swapMarkBitMaps() {
1692 G1CMBitMap* temp = _prevMarkBitMap;
1693 _prevMarkBitMap = _nextMarkBitMap;
1694 _nextMarkBitMap = temp;
1695 }
1696
1697 // Closure for marking entries in SATB buffers.
1698 class G1CMSATBBufferClosure : public SATBBufferClosure {
1699 private:
1700 G1CMTask* _task;
1701 G1CollectedHeap* _g1h;
1702
1703 // This is very similar to G1CMTask::deal_with_reference, but with
1704 // more relaxed requirements for the argument, so this must be more
1705 // circumspect about treating the argument as an object.
1706 void do_entry(void* entry) const {
1707 _task->increment_refs_reached();
1708 oop const obj = static_cast<oop>(entry);
1709 _task->make_reference_grey(obj);
1710 }
1711
1712 public:
1713 G1CMSATBBufferClosure(G1CMTask* task, G1CollectedHeap* g1h)
1714 : _task(task), _g1h(g1h) { }
1715
1716 virtual void do_buffer(void** buffer, size_t size) {
1717 for (size_t i = 0; i < size; ++i) {
1718 do_entry(buffer[i]);
1719 }
1720 }
1721 };
1722
1723 class G1RemarkThreadsClosure : public ThreadClosure {
1724 G1CMSATBBufferClosure _cm_satb_cl;
1725 G1CMOopClosure _cm_cl;
1726 MarkingCodeBlobClosure _code_cl;
1727 int _thread_parity;
1728
1729 public:
|