206 if (left_chunk_end < len) {
207 bool pushed = q->push(ShenandoahMarkTask(array, true, weak, left_chunk, pow));
208 assert(pushed, "overflow queue should always succeed pushing");
209 chunk = right_chunk;
210 last_idx = left_chunk_end;
211 } else {
212 chunk = left_chunk;
213 }
214 }
215
216 // Process the irregular tail, if present
217 int from = last_idx;
218 if (from < len) {
219 array->oop_iterate_elements_range(cl, from, len);
220 }
221 }
222 }
223
224 template <class T>
225 inline void ShenandoahMark::do_chunked_array(ShenandoahObjToScanQueue* q, T* cl, oop obj, int chunk, int pow, bool weak) {
226 assert(obj->is_objArray(), "expect object array");
227 objArrayOop array = objArrayOop(obj);
228
229 // Split out tasks, as suggested in ShenandoahMarkTask docs. Avoid pushing tasks that
230 // are known to start beyond the array.
231 while ((1 << pow) > (int)ObjArrayMarkingStride && (chunk*2 < ShenandoahMarkTask::chunk_size())) {
232 pow--;
233 chunk *= 2;
234 bool pushed = q->push(ShenandoahMarkTask(array, true, weak, chunk - 1, pow));
235 assert(pushed, "overflow queue should always succeed pushing");
236 }
237
238 int chunk_size = 1 << pow;
239
240 int from = (chunk - 1) * chunk_size;
241 int to = chunk * chunk_size;
242
243 #ifdef ASSERT
244 int len = array->length();
245 assert (0 <= from && from < len, "from is sane: %d/%d", from, len);
246 assert (0 < to && to <= len, "to is sane: %d/%d", to, len);
|
206 if (left_chunk_end < len) {
207 bool pushed = q->push(ShenandoahMarkTask(array, true, weak, left_chunk, pow));
208 assert(pushed, "overflow queue should always succeed pushing");
209 chunk = right_chunk;
210 last_idx = left_chunk_end;
211 } else {
212 chunk = left_chunk;
213 }
214 }
215
216 // Process the irregular tail, if present
217 int from = last_idx;
218 if (from < len) {
219 array->oop_iterate_elements_range(cl, from, len);
220 }
221 }
222 }
223
224 template <class T>
225 inline void ShenandoahMark::do_chunked_array(ShenandoahObjToScanQueue* q, T* cl, oop obj, int chunk, int pow, bool weak) {
226 assert(obj->is_refArray(), "expect object array");
227 objArrayOop array = objArrayOop(obj);
228
229 // Split out tasks, as suggested in ShenandoahMarkTask docs. Avoid pushing tasks that
230 // are known to start beyond the array.
231 while ((1 << pow) > (int)ObjArrayMarkingStride && (chunk*2 < ShenandoahMarkTask::chunk_size())) {
232 pow--;
233 chunk *= 2;
234 bool pushed = q->push(ShenandoahMarkTask(array, true, weak, chunk - 1, pow));
235 assert(pushed, "overflow queue should always succeed pushing");
236 }
237
238 int chunk_size = 1 << pow;
239
240 int from = (chunk - 1) * chunk_size;
241 int to = chunk * chunk_size;
242
243 #ifdef ASSERT
244 int len = array->length();
245 assert (0 <= from && from < len, "from is sane: %d/%d", from, len);
246 assert (0 < to && to <= len, "to is sane: %d/%d", to, len);
|