445 void ZHeapIterator::follow_array_chunk(const ZHeapIteratorContext& context, const ObjArrayTask& array) {
446 const objArrayOop obj = objArrayOop(array.obj());
447 const int length = obj->length();
448 const int start = array.index();
449 const int stride = MIN2<int>(length - start, (int)ObjArrayMarkingStride);
450 const int end = start + stride;
451
452 // Push remaining array chunk first
453 if (end < length) {
454 context.push_array_chunk(ObjArrayTask(obj, end));
455 }
456
457 // Follow array chunk
458 ZHeapIteratorOopClosure<false /* VisitReferents */> cl(this, context, obj);
459 ZIterator::oop_iterate_range(obj, &cl, start, end);
460 }
461
462 template <bool VisitWeaks>
463 void ZHeapIterator::follow(const ZHeapIteratorContext& context, oop obj) {
464 // Follow
465 if (obj->is_objArray()) {
466 follow_array(context, obj);
467 } else {
468 follow_object<VisitWeaks>(context, obj);
469 }
470 }
471
472 template <bool VisitWeaks>
473 void ZHeapIterator::visit_and_follow(const ZHeapIteratorContext& context, oop obj) {
474 if (should_visit_object_at_follow()) {
475 context.visit_object(obj);
476 }
477
478 follow<VisitWeaks>(context, obj);
479 }
480
481 template <bool VisitWeaks>
482 void ZHeapIterator::drain(const ZHeapIteratorContext& context) {
483 ObjArrayTask array;
484 oop obj;
485
|
445 void ZHeapIterator::follow_array_chunk(const ZHeapIteratorContext& context, const ObjArrayTask& array) {
446 const objArrayOop obj = objArrayOop(array.obj());
447 const int length = obj->length();
448 const int start = array.index();
449 const int stride = MIN2<int>(length - start, (int)ObjArrayMarkingStride);
450 const int end = start + stride;
451
452 // Push remaining array chunk first
453 if (end < length) {
454 context.push_array_chunk(ObjArrayTask(obj, end));
455 }
456
457 // Follow array chunk
458 ZHeapIteratorOopClosure<false /* VisitReferents */> cl(this, context, obj);
459 ZIterator::oop_iterate_range(obj, &cl, start, end);
460 }
461
462 template <bool VisitWeaks>
463 void ZHeapIterator::follow(const ZHeapIteratorContext& context, oop obj) {
464 // Follow
465 if (obj->is_refArray()) {
466 follow_array(context, obj);
467 } else {
468 follow_object<VisitWeaks>(context, obj);
469 }
470 }
471
472 template <bool VisitWeaks>
473 void ZHeapIterator::visit_and_follow(const ZHeapIteratorContext& context, oop obj) {
474 if (should_visit_object_at_follow()) {
475 context.visit_object(obj);
476 }
477
478 follow<VisitWeaks>(context, obj);
479 }
480
481 template <bool VisitWeaks>
482 void ZHeapIterator::drain(const ZHeapIteratorContext& context) {
483 ObjArrayTask array;
484 oop obj;
485
|