126 #if PRT_COUNT_OCCUPIED
127 _occupied++;
128 #endif
129 }
130 }
131 }
132
133 void add_reference_work(OopOrNarrowOopStar from, bool par) {
134 // Must make this robust in case "from" is not in "_hr", because of
135 // concurrency.
136
137 #if HRRS_VERBOSE
138 gclog_or_tty->print_cr(" PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").",
139 from, *from);
140 #endif
141
142 HeapRegion* loc_hr = hr();
143 // If the test below fails, then this table was reused concurrently
144 // with this operation. This is OK, since the old table was coarsened,
145 // and adding a bit to the new table is never incorrect.
146 if (loc_hr->is_in_reserved(from)) {
147 size_t hw_offset = pointer_delta((HeapWord*)from, loc_hr->bottom());
148 CardIdx_t from_card = (CardIdx_t)
149 hw_offset >> (CardTableModRefBS::card_shift - LogHeapWordSize);
150
151 assert(0 <= from_card && (size_t)from_card < HeapRegion::CardsPerRegion,
152 "Must be in range.");
153 add_card_work(from_card, par);
154 }
155 }
156
157 public:
158
159 HeapRegion* hr() const { return _hr; }
160
161 #if PRT_COUNT_OCCUPIED
162 jint occupied() const {
163 // Overkill, but if we ever need it...
164 // guarantee(_occupied == _bm.count_one_bits(), "Check");
165 return _occupied;
166 }
|
126 #if PRT_COUNT_OCCUPIED
127 _occupied++;
128 #endif
129 }
130 }
131 }
132
133 void add_reference_work(OopOrNarrowOopStar from, bool par) {
134 // Must make this robust in case "from" is not in "_hr", because of
135 // concurrency.
136
137 #if HRRS_VERBOSE
138 gclog_or_tty->print_cr(" PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").",
139 from, *from);
140 #endif
141
142 HeapRegion* loc_hr = hr();
143 // If the test below fails, then this table was reused concurrently
144 // with this operation. This is OK, since the old table was coarsened,
145 // and adding a bit to the new table is never incorrect.
146 // If the table used to belong to a continues humongous region and is
147 // now reused for the corresponding start humongous region, we need to
148 // make sure that we detect this. Thus, we call is_in_reserved_raw()
149 // instead of just is_in_reserved() here.
150 if (loc_hr->is_in_reserved_raw(from)) {
151 size_t hw_offset = pointer_delta((HeapWord*)from, loc_hr->bottom());
152 CardIdx_t from_card = (CardIdx_t)
153 hw_offset >> (CardTableModRefBS::card_shift - LogHeapWordSize);
154
155 assert(0 <= from_card && (size_t)from_card < HeapRegion::CardsPerRegion,
156 "Must be in range.");
157 add_card_work(from_card, par);
158 }
159 }
160
161 public:
162
163 HeapRegion* hr() const { return _hr; }
164
165 #if PRT_COUNT_OCCUPIED
166 jint occupied() const {
167 // Overkill, but if we ever need it...
168 // guarantee(_occupied == _bm.count_one_bits(), "Check");
169 return _occupied;
170 }
|