541
542 if (!g1h->is_obj_dead(obj)) {
543 if (next < end || !obj->is_objArray()) {
544 // This object either does not span the MemRegion
545 // boundary, or if it does it's not an array.
546 // Apply closure to whole object.
547 obj->oop_iterate(cl);
548 } else {
549 // This obj is an array that spans the boundary.
550 // Stop at the boundary.
551 obj->oop_iterate(cl, mr);
552 }
553 }
554 cur = next;
555 }
556 return NULL;
557 }
558
559 // Code roots support
560
561 void HeapRegion::add_strong_code_root(nmethod* nm) {
562 HeapRegionRemSet* hrrs = rem_set();
563 hrrs->add_strong_code_root(nm);
564 }
565
566 void HeapRegion::remove_strong_code_root(nmethod* nm) {
567 HeapRegionRemSet* hrrs = rem_set();
568 hrrs->remove_strong_code_root(nm);
569 }
570
571 void HeapRegion::migrate_strong_code_roots() {
572 assert(in_collection_set(), "only collection set regions");
573 assert(!isHumongous(),
574 err_msg("humongous region "HR_FORMAT" should not have been added to collection set",
575 HR_FORMAT_PARAMS(this)));
576
577 HeapRegionRemSet* hrrs = rem_set();
578 hrrs->migrate_strong_code_roots();
579 }
580
581 void HeapRegion::strong_code_roots_do(CodeBlobClosure* blk) const {
582 HeapRegionRemSet* hrrs = rem_set();
583 hrrs->strong_code_roots_do(blk);
584 }
585
586 class VerifyStrongCodeRootOopClosure: public OopClosure {
587 const HeapRegion* _hr;
588 nmethod* _nm;
589 bool _failures;
590 bool _has_oops_in_region;
591
592 template <class T> void do_oop_work(T* p) {
593 T heap_oop = oopDesc::load_heap_oop(p);
594 if (!oopDesc::is_null(heap_oop)) {
595 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
596
597 // Note: not all the oops embedded in the nmethod are in the
598 // current region. We only look at those which are.
|
541
542 if (!g1h->is_obj_dead(obj)) {
543 if (next < end || !obj->is_objArray()) {
544 // This object either does not span the MemRegion
545 // boundary, or if it does it's not an array.
546 // Apply closure to whole object.
547 obj->oop_iterate(cl);
548 } else {
549 // This obj is an array that spans the boundary.
550 // Stop at the boundary.
551 obj->oop_iterate(cl, mr);
552 }
553 }
554 cur = next;
555 }
556 return NULL;
557 }
558
559 // Code roots support
560
561 void HeapRegion::lock_add_strong_code_root(nmethod* nm) {
562 HeapRegionRemSet* hrrs = rem_set();
563 hrrs->lock_add_strong_code_root(nm);
564 }
565
566 void HeapRegion::add_strong_code_root(nmethod* nm) {
567 assert_locked_or_safepoint(CodeCache_lock);
568 HeapRegionRemSet* hrrs = rem_set();
569 hrrs->add_strong_code_root(nm);
570 }
571
572 void HeapRegion::remove_strong_code_root(nmethod* nm) {
573 HeapRegionRemSet* hrrs = rem_set();
574 hrrs->remove_strong_code_root(nm);
575 }
576
577 void HeapRegion::strong_code_roots_do(CodeBlobClosure* blk) const {
578 HeapRegionRemSet* hrrs = rem_set();
579 hrrs->strong_code_roots_do(blk);
580 }
581
582 class VerifyStrongCodeRootOopClosure: public OopClosure {
583 const HeapRegion* _hr;
584 nmethod* _nm;
585 bool _failures;
586 bool _has_oops_in_region;
587
588 template <class T> void do_oop_work(T* p) {
589 T heap_oop = oopDesc::load_heap_oop(p);
590 if (!oopDesc::is_null(heap_oop)) {
591 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
592
593 // Note: not all the oops embedded in the nmethod are in the
594 // current region. We only look at those which are.
|