170 size_t end_card = _array->index_for(end-1);
171 assert(start ==_array->address_for_index(start_card), "Precondition");
172 assert(end ==_array->address_for_index(end_card)+N_words, "Precondition");
173 set_remainder_to_point_to_start_incl(start_card, end_card); // closed interval
174 }
175
176
177 // Unlike the normal convention in this code, the argument here denotes
178 // a closed, inclusive interval: [start_card, end_card], cf set_remainder_to_point_to_start()
179 // above.
180 void
181 BlockOffsetArray::set_remainder_to_point_to_start_incl(size_t start_card, size_t end_card) {
182 if (start_card > end_card) {
183 return;
184 }
185 assert(start_card > _array->index_for(_bottom), "Cannot be first card");
186 assert(_array->offset_array(start_card-1) <= N_words,
187 "Offset card has an unexpected value");
188 size_t start_card_for_region = start_card;
189 u_char offset = max_jubyte;
190 for (int i = 0; i <= N_powers-1; i++) {
191 // -1 so that the the card with the actual offset is counted. Another -1
192 // so that the reach ends in this region and not at the start
193 // of the next.
194 size_t reach = start_card - 1 + (power_to_cards_back(i+1) - 1);
195 offset = N_words + i;
196 if (reach >= end_card) {
197 _array->set_offset_array(start_card_for_region, end_card, offset);
198 start_card_for_region = reach + 1;
199 break;
200 }
201 _array->set_offset_array(start_card_for_region, reach, offset);
202 start_card_for_region = reach + 1;
203 }
204 assert(start_card_for_region > end_card, "Sanity check");
205 DEBUG_ONLY(check_all_cards(start_card, end_card);)
206 }
207
208 // The card-interval [start_card, end_card] is a closed interval; this
209 // is an expensive check -- use with care and only under protection of
210 // suitable flag.
|
170 size_t end_card = _array->index_for(end-1);
171 assert(start ==_array->address_for_index(start_card), "Precondition");
172 assert(end ==_array->address_for_index(end_card)+N_words, "Precondition");
173 set_remainder_to_point_to_start_incl(start_card, end_card); // closed interval
174 }
175
176
177 // Unlike the normal convention in this code, the argument here denotes
178 // a closed, inclusive interval: [start_card, end_card], cf set_remainder_to_point_to_start()
179 // above.
180 void
181 BlockOffsetArray::set_remainder_to_point_to_start_incl(size_t start_card, size_t end_card) {
182 if (start_card > end_card) {
183 return;
184 }
185 assert(start_card > _array->index_for(_bottom), "Cannot be first card");
186 assert(_array->offset_array(start_card-1) <= N_words,
187 "Offset card has an unexpected value");
188 size_t start_card_for_region = start_card;
189 u_char offset = max_jubyte;
190 for (int i = 0; i < N_powers; i++) {
191 // -1 so that the the card with the actual offset is counted. Another -1
192 // so that the reach ends in this region and not at the start
193 // of the next.
194 size_t reach = start_card - 1 + (power_to_cards_back(i+1) - 1);
195 offset = N_words + i;
196 if (reach >= end_card) {
197 _array->set_offset_array(start_card_for_region, end_card, offset);
198 start_card_for_region = reach + 1;
199 break;
200 }
201 _array->set_offset_array(start_card_for_region, reach, offset);
202 start_card_for_region = reach + 1;
203 }
204 assert(start_card_for_region > end_card, "Sanity check");
205 DEBUG_ONLY(check_all_cards(start_card, end_card);)
206 }
207
208 // The card-interval [start_card, end_card] is a closed interval; this
209 // is an expensive check -- use with care and only under protection of
210 // suitable flag.
|