75
76 static const size_t WordAllClean = SIZE_MAX;
77 static const size_t WordAllDirty = 0;
78
79 STATIC_ASSERT(BitsPerByte == 8);
80 static const size_t WordAlreadyScanned = (SIZE_MAX / 255) * g1_card_already_scanned;
81
82 G1CardTable(MemRegion whole_heap): CardTable(whole_heap, /* scanned concurrently */ true), _listener() {
83 _listener.set_card_table(this);
84 }
85
86 static CardValue g1_young_card_val() { return g1_young_gen; }
87
88 void verify_g1_young_region(MemRegion mr) PRODUCT_RETURN;
89 void g1_mark_as_young(const MemRegion& mr);
90
91 size_t index_for_cardvalue(CardValue const* p) const {
92 return pointer_delta(p, _byte_map, sizeof(CardValue));
93 }
94
95 // Mark the given card as Dirty if it is Clean.
96 inline void mark_clean_as_dirty(size_t card_index);
97
98 // Change Clean cards in a (large) area on the card table as Dirty, preserving
99 // already scanned cards. Assumes that most cards in that area are Clean.
100 inline void mark_region_dirty(size_t start_card_index, size_t num_cards);
101
102 // Mark the given range of cards as Scanned. All of these cards must be Dirty.
103 inline void mark_as_scanned(size_t start_card_index, size_t num_cards);
104
105 inline uint region_idx_for(CardValue* p);
106
107 static size_t compute_size(size_t mem_region_size_in_words) {
108 size_t number_of_slots = (mem_region_size_in_words / card_size_in_words);
109 return ReservedSpace::allocation_align_size_up(number_of_slots);
110 }
111
112 // Returns how many bytes of the heap a single byte of the Card Table corresponds to.
113 static size_t heap_map_factor() { return card_size; }
114
115 void initialize() {}
116 void initialize(G1RegionToSpaceMapper* mapper);
117
118 virtual void resize_covered_region(MemRegion new_region) { ShouldNotReachHere(); }
119
120 virtual bool is_in_young(oop obj) const;
|
75
76 static const size_t WordAllClean = SIZE_MAX;
77 static const size_t WordAllDirty = 0;
78
79 STATIC_ASSERT(BitsPerByte == 8);
80 static const size_t WordAlreadyScanned = (SIZE_MAX / 255) * g1_card_already_scanned;
81
82 G1CardTable(MemRegion whole_heap): CardTable(whole_heap, /* scanned concurrently */ true), _listener() {
83 _listener.set_card_table(this);
84 }
85
86 static CardValue g1_young_card_val() { return g1_young_gen; }
87
88 void verify_g1_young_region(MemRegion mr) PRODUCT_RETURN;
89 void g1_mark_as_young(const MemRegion& mr);
90
91 size_t index_for_cardvalue(CardValue const* p) const {
92 return pointer_delta(p, _byte_map, sizeof(CardValue));
93 }
94
95 // Mark the given card as Dirty if it is Clean. Returns the number of dirtied
96 // cards that were not yet dirty. This result may be inaccurate as it does not
97 // perform the dirtying atomically.
98 inline size_t mark_clean_as_dirty(size_t card_index);
99
100 // Change Clean cards in a (large) area on the card table as Dirty, preserving
101 // already scanned cards. Assumes that most cards in that area are Clean.
102 // Returns the number of dirtied cards that were not yet dirty. This result may
103 // be inaccurate as it does not perform the dirtying atomically.
104 inline size_t mark_region_dirty(size_t start_card_index, size_t num_cards);
105
106 // Mark the given range of cards as Scanned. All of these cards must be Dirty.
107 inline void mark_as_scanned(size_t start_card_index, size_t num_cards);
108
109 inline uint region_idx_for(CardValue* p);
110
111 static size_t compute_size(size_t mem_region_size_in_words) {
112 size_t number_of_slots = (mem_region_size_in_words / card_size_in_words);
113 return ReservedSpace::allocation_align_size_up(number_of_slots);
114 }
115
116 // Returns how many bytes of the heap a single byte of the Card Table corresponds to.
117 static size_t heap_map_factor() { return card_size; }
118
119 void initialize() {}
120 void initialize(G1RegionToSpaceMapper* mapper);
121
122 virtual void resize_covered_region(MemRegion new_region) { ShouldNotReachHere(); }
123
124 virtual bool is_in_young(oop obj) const;
|