< prev index next >

src/share/vm/gc/g1/g1CollectedHeap.cpp

Print this page
rev 10742 : Make fields used in lock-free algorithms volatile

*** 94,104 **** class RefineCardTableEntryClosure: public CardTableEntryClosure { bool _concurrent; public: RefineCardTableEntryClosure() : _concurrent(true) { } ! bool do_card_ptr(jbyte* card_ptr, uint worker_i) { bool oops_into_cset = G1CollectedHeap::heap()->g1_rem_set()->refine_card(card_ptr, worker_i, false); // This path is executed by the concurrent refine or mutator threads, // concurrently, and so we do not care if card_ptr contains references // that point into the collection set. assert(!oops_into_cset, "should be"); --- 94,104 ---- class RefineCardTableEntryClosure: public CardTableEntryClosure { bool _concurrent; public: RefineCardTableEntryClosure() : _concurrent(true) { } ! bool do_card_ptr(volatile jbyte* card_ptr, uint worker_i) { bool oops_into_cset = G1CollectedHeap::heap()->g1_rem_set()->refine_card(card_ptr, worker_i, false); // This path is executed by the concurrent refine or mutator threads, // concurrently, and so we do not care if card_ptr contains references // that point into the collection set. assert(!oops_into_cset, "should be");
*** 119,129 **** private: size_t _num_dirtied; G1CollectedHeap* _g1h; G1SATBCardTableLoggingModRefBS* _g1_bs; ! HeapRegion* region_for_card(jbyte* card_ptr) const { return _g1h->heap_region_containing(_g1_bs->addr_for(card_ptr)); } bool will_become_free(HeapRegion* hr) const { // A region will be freed by free_collection_set if the region is in the --- 119,129 ---- private: size_t _num_dirtied; G1CollectedHeap* _g1h; G1SATBCardTableLoggingModRefBS* _g1_bs; ! HeapRegion* region_for_card(volatile jbyte* card_ptr) const { return _g1h->heap_region_containing(_g1_bs->addr_for(card_ptr)); } bool will_become_free(HeapRegion* hr) const { // A region will be freed by free_collection_set if the region is in the
*** 133,143 **** public: RedirtyLoggedCardTableEntryClosure(G1CollectedHeap* g1h) : CardTableEntryClosure(), _num_dirtied(0), _g1h(g1h), _g1_bs(g1h->g1_barrier_set()) { } ! bool do_card_ptr(jbyte* card_ptr, uint worker_i) { HeapRegion* hr = region_for_card(card_ptr); // Should only dirty cards in regions that won't be freed. if (!will_become_free(hr)) { *card_ptr = CardTableModRefBS::dirty_card_val(); --- 133,143 ---- public: RedirtyLoggedCardTableEntryClosure(G1CollectedHeap* g1h) : CardTableEntryClosure(), _num_dirtied(0), _g1h(g1h), _g1_bs(g1h->g1_barrier_set()) { } ! bool do_card_ptr(volatile jbyte* card_ptr, uint worker_i) { HeapRegion* hr = region_for_card(card_ptr); // Should only dirty cards in regions that won't be freed. if (!will_become_free(hr)) { *card_ptr = CardTableModRefBS::dirty_card_val();
*** 3015,3025 **** "Found a not-small remembered set here. This is inconsistent with previous assumptions."); G1SATBCardTableLoggingModRefBS* bs = g1h->g1_barrier_set(); HeapRegionRemSetIterator hrrs(r->rem_set()); size_t card_index; while (hrrs.has_next(card_index)) { ! jbyte* card_ptr = (jbyte*)bs->byte_for_index(card_index); // The remembered set might contain references to already freed // regions. Filter out such entries to avoid failing card table // verification. if (g1h->is_in_closed_subset(bs->addr_for(card_ptr))) { if (*card_ptr != CardTableModRefBS::dirty_card_val()) { --- 3015,3025 ---- "Found a not-small remembered set here. This is inconsistent with previous assumptions."); G1SATBCardTableLoggingModRefBS* bs = g1h->g1_barrier_set(); HeapRegionRemSetIterator hrrs(r->rem_set()); size_t card_index; while (hrrs.has_next(card_index)) { ! volatile jbyte* card_ptr = (volatile jbyte*)bs->byte_for_index(card_index); // The remembered set might contain references to already freed // regions. Filter out such entries to avoid failing card table // verification. if (g1h->is_in_closed_subset(bs->addr_for(card_ptr))) { if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
< prev index next >