94 } |
94 } |
95 |
95 |
96 // The declaration order of these const fields is important; see the |
96 // The declaration order of these const fields is important; see the |
97 // constructor before changing. |
97 // constructor before changing. |
98 const MemRegion _whole_heap; // the region covered by the card table |
98 const MemRegion _whole_heap; // the region covered by the card table |
99 const size_t _guard_index; // index of very last element in the card |
99 size_t _guard_index; // index of very last element in the card |
100 // table; it is set to a guard value |
100 // table; it is set to a guard value |
101 // (last_card) and should never be modified |
101 // (last_card) and should never be modified |
102 const size_t _last_valid_index; // index of the last valid element |
102 size_t _last_valid_index; // index of the last valid element |
103 const size_t _page_size; // page size used when mapping _byte_map |
103 const size_t _page_size; // page size used when mapping _byte_map |
104 const size_t _byte_map_size; // in bytes |
104 size_t _byte_map_size; // in bytes |
105 jbyte* _byte_map; // the card marking array |
105 jbyte* _byte_map; // the card marking array |
106 |
106 |
107 int _cur_covered_regions; |
107 int _cur_covered_regions; |
108 // The covered regions should be in address order. |
108 // The covered regions should be in address order. |
109 MemRegion* _covered; |
109 MemRegion* _covered; |
121 MemRegion _guard_region; |
121 MemRegion _guard_region; |
122 |
122 |
123 protected: |
123 protected: |
124 // Initialization utilities; covered_words is the size of the covered region |
124 // Initialization utilities; covered_words is the size of the covered region |
125 // in, um, words. |
125 // in, um, words. |
126 inline size_t cards_required(size_t covered_words); |
126 inline size_t cards_required(size_t covered_words) { |
|
127 // Add one for a guard card, used to detect errors. |
|
128 const size_t words = align_size_up(covered_words, card_size_in_words); |
|
129 return words / card_size_in_words + 1; |
|
130 } |
|
131 |
127 inline size_t compute_byte_map_size(); |
132 inline size_t compute_byte_map_size(); |
128 |
133 |
129 // Finds and return the index of the region, if any, to which the given |
134 // Finds and return the index of the region, if any, to which the given |
130 // region would be contiguous. If none exists, assign a new region and |
135 // region would be contiguous. If none exists, assign a new region and |
131 // returns its index. Requires that no more than the maximum number of |
136 // returns its index. Requires that no more than the maximum number of |
135 // Same as above, but finds the region containing the given address |
140 // Same as above, but finds the region containing the given address |
136 // instead of starting at a given base address. |
141 // instead of starting at a given base address. |
137 int find_covering_region_containing(HeapWord* addr); |
142 int find_covering_region_containing(HeapWord* addr); |
138 |
143 |
139 // Resize one of the regions covered by the remembered set. |
144 // Resize one of the regions covered by the remembered set. |
140 void resize_covered_region(MemRegion new_region); |
145 virtual void resize_covered_region(MemRegion new_region); |
141 |
146 |
142 // Returns the leftmost end of a committed region corresponding to a |
147 // Returns the leftmost end of a committed region corresponding to a |
143 // covered region before covered region "ind", or else "NULL" if "ind" is |
148 // covered region before covered region "ind", or else "NULL" if "ind" is |
144 // the first covered region. |
149 // the first covered region. |
145 HeapWord* largest_prev_committed_end(int ind) const; |
150 HeapWord* largest_prev_committed_end(int ind) const; |
280 } |
285 } |
281 |
286 |
282 CardTableModRefBS(MemRegion whole_heap, int max_covered_regions); |
287 CardTableModRefBS(MemRegion whole_heap, int max_covered_regions); |
283 ~CardTableModRefBS(); |
288 ~CardTableModRefBS(); |
284 |
289 |
|
290 virtual void initialize(); |
|
291 |
285 // *** Barrier set functions. |
292 // *** Barrier set functions. |
286 |
293 |
287 bool has_write_ref_pre_barrier() { return false; } |
294 bool has_write_ref_pre_barrier() { return false; } |
288 |
295 |
289 // Record a reference update. Note that these versions are precise! |
296 // Record a reference update. Note that these versions are precise! |