35 // As it currently stands, this barrier is *imprecise*: when a ref field in |
35 // As it currently stands, this barrier is *imprecise*: when a ref field in |
36 // an object "o" is modified, the card table entry for the card containing |
36 // an object "o" is modified, the card table entry for the card containing |
37 // the head of "o" is dirtied, not necessarily the card containing the |
37 // the head of "o" is dirtied, not necessarily the card containing the |
38 // modified field itself. For object arrays, however, the barrier *is* |
38 // modified field itself. For object arrays, however, the barrier *is* |
39 // precise; only the card containing the modified element is dirtied. |
39 // precise; only the card containing the modified element is dirtied. |
40 // Any MemRegionClosures used to scan dirty cards should take these |
40 // Closures used to scan dirty cards should take these |
41 // considerations into account. |
41 // considerations into account. |
42 |
42 |
43 class Generation; |
43 class Generation; |
44 class OopsInGenClosure; |
44 class OopsInGenClosure; |
45 class DirtyCardToOopClosure; |
45 class DirtyCardToOopClosure; |
174 return byte_for(p) + 1; |
174 return byte_for(p) + 1; |
175 } |
175 } |
176 |
176 |
177 // Iterate over the portion of the card-table which covers the given |
177 // Iterate over the portion of the card-table which covers the given |
178 // region mr in the given space and apply cl to any dirty sub-regions |
178 // region mr in the given space and apply cl to any dirty sub-regions |
179 // of mr. Dirty cards are _not_ cleared by the iterator method itself, |
179 // of mr. Clears the dirty cards as they are processed. |
180 // but closures may arrange to do so on their own should they so wish. |
|
181 void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl); |
|
182 |
|
183 // A variant of the above that will operate in a parallel mode if |
|
184 // worker threads are available, and clear the dirty cards as it |
|
185 // processes them. |
|
186 // XXX ??? MemRegionClosure above vs OopsInGenClosure below XXX |
|
187 // XXX some new_dcto_cl's take OopClosure's, plus as above there are |
|
188 // some MemRegionClosures. Clean this up everywhere. XXX |
|
189 void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr, |
180 void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr, |
190 OopsInGenClosure* cl, CardTableRS* ct); |
181 OopsInGenClosure* cl, CardTableRS* ct); |
191 |
182 |
192 private: |
183 private: |
193 // Work method used to implement non_clean_card_iterate_possibly_parallel() |
184 // Work method used to implement non_clean_card_iterate_possibly_parallel() |
376 virtual void invalidate(MemRegion mr, bool whole_heap = false); |
367 virtual void invalidate(MemRegion mr, bool whole_heap = false); |
377 void clear(MemRegion mr); |
368 void clear(MemRegion mr); |
378 void dirty(MemRegion mr); |
369 void dirty(MemRegion mr); |
379 |
370 |
380 // *** Card-table-RemSet-specific things. |
371 // *** Card-table-RemSet-specific things. |
381 |
|
382 // Invoke "cl.do_MemRegion" on a set of MemRegions that collectively |
|
383 // includes all the modified cards (expressing each card as a |
|
384 // MemRegion). Thus, several modified cards may be lumped into one |
|
385 // region. The regions are non-overlapping, and are visited in |
|
386 // *decreasing* address order. (This order aids with imprecise card |
|
387 // marking, where a dirty card may cause scanning, and summarization |
|
388 // marking, of objects that extend onto subsequent cards.) |
|
389 void mod_card_iterate(MemRegionClosure* cl) { |
|
390 non_clean_card_iterate_serial(_whole_heap, cl); |
|
391 } |
|
392 |
|
393 // Like the "mod_cards_iterate" above, except only invokes the closure |
|
394 // for cards within the MemRegion "mr" (which is required to be |
|
395 // card-aligned and sized.) |
|
396 void mod_card_iterate(MemRegion mr, MemRegionClosure* cl) { |
|
397 non_clean_card_iterate_serial(mr, cl); |
|
398 } |
|
399 |
372 |
400 static uintx ct_max_alignment_constraint(); |
373 static uintx ct_max_alignment_constraint(); |
401 |
374 |
402 // Apply closure "cl" to the dirty cards containing some part of |
375 // Apply closure "cl" to the dirty cards containing some part of |
403 // MemRegion "mr". |
376 // MemRegion "mr". |