52 friend class VMStructs;
53 friend class CardTableRS;
54 friend class CheckForUnmarkedOops; // Needs access to raw card bytes.
55 friend class SharkBuilder;
56 #ifndef PRODUCT
57 // For debugging.
58 friend class GuaranteeNotModClosure;
59 #endif
60 protected:
61
62 enum CardValues {
63 clean_card = -1,
64 // The mask contains zeros in places for all other values.
65 clean_card_mask = clean_card - 31,
66
67 dirty_card = 0,
68 precleaned_card = 1,
69 claimed_card = 2,
70 deferred_card = 4,
71 last_card = 8,
72 CT_MR_BS_last_reserved = 16
73 };
74
75 // a word's worth (row) of clean card values
76 static const intptr_t clean_card_row = (intptr_t)(-1);
77
78 // dirty and precleaned are equivalent wrt younger_refs_iter.
79 static bool card_is_dirty_wrt_gen_iter(jbyte cv) {
80 return cv == dirty_card || cv == precleaned_card;
81 }
82
83 // Returns "true" iff the value "cv" will cause the card containing it
84 // to be scanned in the current traversal. May be overridden by
85 // subtypes.
86 virtual bool card_will_be_scanned(jbyte cv) {
87 return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv);
88 }
89
90 // Returns "true" iff the value "cv" may have represented a dirty card at
91 // some point.
92 virtual bool card_may_have_been_dirty(jbyte cv) {
256 MemRegion chunk_mr,
257 MemRegion used,
258 jbyte** lowest_non_clean,
259 uintptr_t lowest_non_clean_base_chunk_index,
260 size_t lowest_non_clean_chunk_size);
261
262 public:
263 // Constants
264 enum SomePublicConstants {
265 card_shift = 9,
266 card_size = 1 << card_shift,
267 card_size_in_words = card_size / sizeof(HeapWord)
268 };
269
270 static int clean_card_val() { return clean_card; }
271 static int clean_card_mask_val() { return clean_card_mask; }
272 static int dirty_card_val() { return dirty_card; }
273 static int claimed_card_val() { return claimed_card; }
274 static int precleaned_card_val() { return precleaned_card; }
275 static int deferred_card_val() { return deferred_card; }
276
277 // For RTTI simulation.
278 bool is_a(BarrierSet::Name bsn) {
279 return bsn == BarrierSet::CardTableModRef || ModRefBarrierSet::is_a(bsn);
280 }
281
282 CardTableModRefBS(MemRegion whole_heap, int max_covered_regions);
283 ~CardTableModRefBS();
284
285 // *** Barrier set functions.
286
287 bool has_write_ref_pre_barrier() { return false; }
288
289 // Record a reference update. Note that these versions are precise!
290 // The scanning code has to handle the fact that the write barrier may be
291 // either precise or imprecise. We make non-virtual inline variants of
292 // these functions here for performance.
293 protected:
294 void write_ref_field_work(oop obj, size_t offset, oop newVal);
295 virtual void write_ref_field_work(void* field, oop newVal);
461 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
462 p, _whole_heap.start(), _whole_heap.end()));
463 return byte_for(p) - _byte_map;
464 }
465
466 const jbyte* byte_for_index(const size_t card_index) const {
467 return _byte_map + card_index;
468 }
469
470 // Print a description of the memory for the barrier set
471 virtual void print_on(outputStream* st) const;
472
473 void verify();
474 void verify_guard();
475
476 // val_equals -> it will check that all cards covered by mr equal val
477 // !val_equals -> it will check that all cards covered by mr do not equal val
478 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN;
479 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN;
480 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
481
482 static size_t par_chunk_heapword_alignment() {
483 return ParGCCardsPerStrideChunk * card_size_in_words;
484 }
485
486 };
487
488 class CardTableRS;
489
490 // A specialization for the CardTableRS gen rem set.
491 class CardTableModRefBSForCTRS: public CardTableModRefBS {
492 CardTableRS* _rs;
493 protected:
494 bool card_will_be_scanned(jbyte cv);
495 bool card_may_have_been_dirty(jbyte cv);
496 public:
497 CardTableModRefBSForCTRS(MemRegion whole_heap,
498 int max_covered_regions) :
499 CardTableModRefBS(whole_heap, max_covered_regions) {}
500
|
52 friend class VMStructs;
53 friend class CardTableRS;
54 friend class CheckForUnmarkedOops; // Needs access to raw card bytes.
55 friend class SharkBuilder;
56 #ifndef PRODUCT
57 // For debugging.
58 friend class GuaranteeNotModClosure;
59 #endif
60 protected:
61
62 enum CardValues {
63 clean_card = -1,
64 // The mask contains zeros in places for all other values.
65 clean_card_mask = clean_card - 31,
66
67 dirty_card = 0,
68 precleaned_card = 1,
69 claimed_card = 2,
70 deferred_card = 4,
71 last_card = 8,
72 CT_MR_BS_last_reserved = 16,
73 g1_young_gen = 32
74 };
75
76 // a word's worth (row) of clean card values
77 static const intptr_t clean_card_row = (intptr_t)(-1);
78
79 // dirty and precleaned are equivalent wrt younger_refs_iter.
80 static bool card_is_dirty_wrt_gen_iter(jbyte cv) {
81 return cv == dirty_card || cv == precleaned_card;
82 }
83
84 // Returns "true" iff the value "cv" will cause the card containing it
85 // to be scanned in the current traversal. May be overridden by
86 // subtypes.
87 virtual bool card_will_be_scanned(jbyte cv) {
88 return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv);
89 }
90
91 // Returns "true" iff the value "cv" may have represented a dirty card at
92 // some point.
93 virtual bool card_may_have_been_dirty(jbyte cv) {
257 MemRegion chunk_mr,
258 MemRegion used,
259 jbyte** lowest_non_clean,
260 uintptr_t lowest_non_clean_base_chunk_index,
261 size_t lowest_non_clean_chunk_size);
262
263 public:
264 // Constants
265 enum SomePublicConstants {
266 card_shift = 9,
267 card_size = 1 << card_shift,
268 card_size_in_words = card_size / sizeof(HeapWord)
269 };
270
271 static int clean_card_val() { return clean_card; }
272 static int clean_card_mask_val() { return clean_card_mask; }
273 static int dirty_card_val() { return dirty_card; }
274 static int claimed_card_val() { return claimed_card; }
275 static int precleaned_card_val() { return precleaned_card; }
276 static int deferred_card_val() { return deferred_card; }
277 static int g1_young_card_val() { return g1_young_gen; }
278
279 // For RTTI simulation.
280 bool is_a(BarrierSet::Name bsn) {
281 return bsn == BarrierSet::CardTableModRef || ModRefBarrierSet::is_a(bsn);
282 }
283
284 CardTableModRefBS(MemRegion whole_heap, int max_covered_regions);
285 ~CardTableModRefBS();
286
287 // *** Barrier set functions.
288
289 bool has_write_ref_pre_barrier() { return false; }
290
291 // Record a reference update. Note that these versions are precise!
292 // The scanning code has to handle the fact that the write barrier may be
293 // either precise or imprecise. We make non-virtual inline variants of
294 // these functions here for performance.
295 protected:
296 void write_ref_field_work(oop obj, size_t offset, oop newVal);
297 virtual void write_ref_field_work(void* field, oop newVal);
463 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
464 p, _whole_heap.start(), _whole_heap.end()));
465 return byte_for(p) - _byte_map;
466 }
467
468 const jbyte* byte_for_index(const size_t card_index) const {
469 return _byte_map + card_index;
470 }
471
472 // Print a description of the memory for the barrier set
473 virtual void print_on(outputStream* st) const;
474
475 void verify();
476 void verify_guard();
477
478 // val_equals -> it will check that all cards covered by mr equal val
479 // !val_equals -> it will check that all cards covered by mr do not equal val
480 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN;
481 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN;
482 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
483 void verify_g1_young_region(MemRegion mr) PRODUCT_RETURN;
484
485 static size_t par_chunk_heapword_alignment() {
486 return ParGCCardsPerStrideChunk * card_size_in_words;
487 }
488
489 };
490
491 class CardTableRS;
492
493 // A specialization for the CardTableRS gen rem set.
494 class CardTableModRefBSForCTRS: public CardTableModRefBS {
495 CardTableRS* _rs;
496 protected:
497 bool card_will_be_scanned(jbyte cv);
498 bool card_may_have_been_dirty(jbyte cv);
499 public:
500 CardTableModRefBSForCTRS(MemRegion whole_heap,
501 int max_covered_regions) :
502 CardTableModRefBS(whole_heap, max_covered_regions) {}
503
|