src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp

changeset 8281
71f6bbeb6026
parent 7828
cbc7c4c9e11c
child 8316
626f594dffa6
equal deleted inserted replaced
8280:f3f2f71d2dc8 8281:71f6bbeb6026
1 /* 1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
117 } 117 }
118 } 118 }
119 119
120 public: 120 public:
121 121
122 HeapRegion* hr() const { return _hr; } 122 HeapRegion* hr() const {
123 return (HeapRegion*) OrderAccess::load_ptr_acquire(&_hr);
124 }
123 125
124 jint occupied() const { 126 jint occupied() const {
125 // Overkill, but if we ever need it... 127 // Overkill, but if we ever need it...
126 // guarantee(_occupied == _bm.count_one_bits(), "Check"); 128 // guarantee(_occupied == _bm.count_one_bits(), "Check");
127 return _occupied; 129 return _occupied;
130 void init(HeapRegion* hr, bool clear_links_to_all_list) { 132 void init(HeapRegion* hr, bool clear_links_to_all_list) {
131 if (clear_links_to_all_list) { 133 if (clear_links_to_all_list) {
132 set_next(NULL); 134 set_next(NULL);
133 set_prev(NULL); 135 set_prev(NULL);
134 } 136 }
135 _hr = hr;
136 _collision_list_next = NULL; 137 _collision_list_next = NULL;
137 _occupied = 0; 138 _occupied = 0;
138 _bm.clear(); 139 _bm.clear();
140 // Make sure that the bitmap clearing above has been finished before publishing
141 // this PRT to concurrent threads.
142 OrderAccess::release_store_ptr(&_hr, hr);
139 } 143 }
140 144
141 void add_reference(OopOrNarrowOopStar from) { 145 void add_reference(OopOrNarrowOopStar from) {
142 add_reference_work(from, /*parallel*/ true); 146 add_reference_work(from, /*parallel*/ true);
143 } 147 }
439 443
440 if (FromCardCache::contains_or_replace((uint)tid, cur_hrm_ind, from_card)) { 444 if (FromCardCache::contains_or_replace((uint)tid, cur_hrm_ind, from_card)) {
441 if (G1TraceHeapRegionRememberedSet) { 445 if (G1TraceHeapRegionRememberedSet) {
442 gclog_or_tty->print_cr(" from-card cache hit."); 446 gclog_or_tty->print_cr(" from-card cache hit.");
443 } 447 }
444 assert(contains_reference(from), "We just added it!"); 448 assert(contains_reference(from), err_msg("We just found " PTR_FORMAT " in the FromCardCache", from));
445 return; 449 return;
446 } 450 }
447 451
448 // Note that this may be a continued H region. 452 // Note that this may be a continued H region.
449 HeapRegion* from_hr = _g1h->heap_region_containing_raw(from); 453 HeapRegion* from_hr = _g1h->heap_region_containing_raw(from);
452 // If the region is already coarsened, return. 456 // If the region is already coarsened, return.
453 if (_coarse_map.at(from_hrm_ind)) { 457 if (_coarse_map.at(from_hrm_ind)) {
454 if (G1TraceHeapRegionRememberedSet) { 458 if (G1TraceHeapRegionRememberedSet) {
455 gclog_or_tty->print_cr(" coarse map hit."); 459 gclog_or_tty->print_cr(" coarse map hit.");
456 } 460 }
457 assert(contains_reference(from), "We just added it!"); 461 assert(contains_reference(from), err_msg("We just found " PTR_FORMAT " in the Coarse table", from));
458 return; 462 return;
459 } 463 }
460 464
461 // Otherwise find a per-region table to add it to. 465 // Otherwise find a per-region table to add it to.
462 size_t ind = from_hrm_ind & _mod_max_fine_entries_mask; 466 size_t ind = from_hrm_ind & _mod_max_fine_entries_mask;
486 } 490 }
487 } 491 }
488 if (G1TraceHeapRegionRememberedSet) { 492 if (G1TraceHeapRegionRememberedSet) {
489 gclog_or_tty->print_cr(" added card to sparse table."); 493 gclog_or_tty->print_cr(" added card to sparse table.");
490 } 494 }
491 assert(contains_reference_locked(from), "We just added it!"); 495 assert(contains_reference_locked(from), err_msg("We just added " PTR_FORMAT " to the Sparse table", from));
492 return; 496 return;
493 } else { 497 } else {
494 if (G1TraceHeapRegionRememberedSet) { 498 if (G1TraceHeapRegionRememberedSet) {
495 gclog_or_tty->print_cr(" [tid %d] sparse table entry " 499 gclog_or_tty->print_cr(" [tid %d] sparse table entry "
496 "overflow(f: %d, t: %u)", 500 "overflow(f: %d, t: %u)",
545 align_size_down(uintptr_t(from), 549 align_size_down(uintptr_t(from),
546 CardTableModRefBS::card_size), 550 CardTableModRefBS::card_size),
547 hr()->bottom(), from); 551 hr()->bottom(), from);
548 } 552 }
549 } 553 }
550 assert(contains_reference(from), "We just added it!"); 554 assert(contains_reference(from), err_msg("We just added " PTR_FORMAT " to the PRT", from));
551 } 555 }
552 556
553 PerRegionTable* 557 PerRegionTable*
554 OtherRegionsTable::find_region_table(size_t ind, HeapRegion* hr) const { 558 OtherRegionsTable::find_region_table(size_t ind, HeapRegion* hr) const {
555 assert(0 <= ind && ind < _max_fine_entries, "Preconditions."); 559 assert(0 <= ind && ind < _max_fine_entries, "Preconditions.");

mercurial