46
47 // Forward declarations
48 class HeapRegion;
49 class HRRSCleanupTask;
50 class GenerationSpec;
51 class OopsInHeapRegionClosure;
52 class G1KlassScanClosure;
53 class G1ScanHeapEvacClosure;
54 class ObjectClosure;
55 class SpaceClosure;
56 class CompactibleSpaceClosure;
57 class Space;
58 class G1CollectorPolicy;
59 class GenRemSet;
60 class G1RemSet;
61 class HeapRegionRemSetIterator;
62 class ConcurrentMark;
63 class ConcurrentMarkThread;
64 class ConcurrentG1Refine;
65 class GenerationCounters;
66
67 typedef OverflowTaskQueue<StarTask, mtGC> RefToScanQueue;
68 typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet;
69
70 typedef int RegionIdx_t; // needs to hold [ 0..max_regions() )
71 typedef int CardIdx_t; // needs to hold [ 0..CardsPerRegion )
72
73 enum GCAllocPurpose {
74 GCAllocForTenured,
75 GCAllocForSurvived,
76 GCAllocPurposeCount
77 };
78
79 class YoungList : public CHeapObj<mtGC> {
80 private:
81 G1CollectedHeap* _g1h;
82
83 HeapRegion* _head;
84
85 HeapRegion* _survivor_head;
1612 HeapWord* top_at_mark_start(HeapRegion* hr, VerifyOption vo);
1613 bool is_marked(oop obj, VerifyOption vo);
1614 const char* top_at_mark_start_str(VerifyOption vo);
1615
1616 ConcurrentMark* concurrent_mark() const { return _cm; }
1617
1618 // Refinement
1619
1620 ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; }
1621
1622 // The dirty cards region list is used to record a subset of regions
1623 // whose cards need clearing. The list if populated during the
1624 // remembered set scanning and drained during the card table
1625 // cleanup. Although the methods are reentrant, population/draining
1626 // phases must not overlap. For synchronization purposes the last
1627 // element on the list points to itself.
1628 HeapRegion* _dirty_cards_region_list;
1629 void push_dirty_cards_region(HeapRegion* hr);
1630 HeapRegion* pop_dirty_cards_region();
1631
1632 // Verification
1633
1634 // The following is just to alert the verification code
1635 // that a full collection has occurred and that the
1636 // remembered sets are no longer up to date.
1637 bool _full_collection;
1638 void set_full_collection() { _full_collection = true;}
1639 void clear_full_collection() {_full_collection = false;}
1640 bool full_collection() {return _full_collection;}
1641
1642 // Perform any cleanup actions necessary before allowing a verification.
1643 virtual void prepare_for_verify();
1644
1645 // Perform verification.
1646
1647 // vo == UsePrevMarking -> use "prev" marking information,
1648 // vo == UseNextMarking -> use "next" marking information
1649 // vo == UseMarkWord -> use the mark word in the object header
1650 //
1651 // NOTE: Only the "prev" marking information is guaranteed to be
|
46
47 // Forward declarations
48 class HeapRegion;
49 class HRRSCleanupTask;
50 class GenerationSpec;
51 class OopsInHeapRegionClosure;
52 class G1KlassScanClosure;
53 class G1ScanHeapEvacClosure;
54 class ObjectClosure;
55 class SpaceClosure;
56 class CompactibleSpaceClosure;
57 class Space;
58 class G1CollectorPolicy;
59 class GenRemSet;
60 class G1RemSet;
61 class HeapRegionRemSetIterator;
62 class ConcurrentMark;
63 class ConcurrentMarkThread;
64 class ConcurrentG1Refine;
65 class GenerationCounters;
66 class nmethod;
67
68 typedef OverflowTaskQueue<StarTask, mtGC> RefToScanQueue;
69 typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet;
70
71 typedef int RegionIdx_t; // needs to hold [ 0..max_regions() )
72 typedef int CardIdx_t; // needs to hold [ 0..CardsPerRegion )
73
74 enum GCAllocPurpose {
75 GCAllocForTenured,
76 GCAllocForSurvived,
77 GCAllocPurposeCount
78 };
79
80 class YoungList : public CHeapObj<mtGC> {
81 private:
82 G1CollectedHeap* _g1h;
83
84 HeapRegion* _head;
85
86 HeapRegion* _survivor_head;
1613 HeapWord* top_at_mark_start(HeapRegion* hr, VerifyOption vo);
1614 bool is_marked(oop obj, VerifyOption vo);
1615 const char* top_at_mark_start_str(VerifyOption vo);
1616
1617 ConcurrentMark* concurrent_mark() const { return _cm; }
1618
1619 // Refinement
1620
1621 ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; }
1622
1623 // The dirty cards region list is used to record a subset of regions
1624 // whose cards need clearing. The list if populated during the
1625 // remembered set scanning and drained during the card table
1626 // cleanup. Although the methods are reentrant, population/draining
1627 // phases must not overlap. For synchronization purposes the last
1628 // element on the list points to itself.
1629 HeapRegion* _dirty_cards_region_list;
1630 void push_dirty_cards_region(HeapRegion* hr);
1631 HeapRegion* pop_dirty_cards_region();
1632
1633 // Optimized nmethod scanning support routines
1634
1635 // Register the given nmethod with the G1 heap
1636 virtual void register_nmethod(nmethod* nm);
1637
1638 // Unregister the given nmethod from the G1 heap
1639 virtual void unregister_nmethod(nmethod* nm);
1640
1641 // Migrate the nmethods in the code root lists of the regions
1642 // in the collection set to regions in to-space. In the event
1643 // of an evacuation failure, nmethods that reference objects
1644 // that were not successfullly evacuated are not migrated.
1645 void migrate_strong_code_roots();
1646
1647 // During an initial mark pause, mark all the code roots that
1648 // point into regions *not* in the collection set.
1649 void mark_strong_code_roots(uint worker_id);
1650
1651 // Rebuild the stong code root lists for each region
1652 // after a full GC
1653 void rebuild_strong_code_roots();
1654
1655 // Verification
1656
1657 // The following is just to alert the verification code
1658 // that a full collection has occurred and that the
1659 // remembered sets are no longer up to date.
1660 bool _full_collection;
1661 void set_full_collection() { _full_collection = true;}
1662 void clear_full_collection() {_full_collection = false;}
1663 bool full_collection() {return _full_collection;}
1664
1665 // Perform any cleanup actions necessary before allowing a verification.
1666 virtual void prepare_for_verify();
1667
1668 // Perform verification.
1669
1670 // vo == UsePrevMarking -> use "prev" marking information,
1671 // vo == UseNextMarking -> use "next" marking information
1672 // vo == UseMarkWord -> use the mark word in the object header
1673 //
1674 // NOTE: Only the "prev" marking information is guaranteed to be
|