325 |
325 |
326 void HeapRegion::note_self_forwarding_removal_end(bool during_initial_mark, |
326 void HeapRegion::note_self_forwarding_removal_end(bool during_initial_mark, |
327 bool during_conc_mark, |
327 bool during_conc_mark, |
328 size_t marked_bytes) { |
328 size_t marked_bytes) { |
329 assert(marked_bytes <= used(), |
329 assert(marked_bytes <= used(), |
330 err_msg("marked: "SIZE_FORMAT" used: "SIZE_FORMAT, marked_bytes, used())); |
330 err_msg("marked: " SIZE_FORMAT " used: " SIZE_FORMAT, marked_bytes, used())); |
331 _prev_top_at_mark_start = top(); |
331 _prev_top_at_mark_start = top(); |
332 _prev_marked_bytes = marked_bytes; |
332 _prev_marked_bytes = marked_bytes; |
333 } |
333 } |
334 |
334 |
335 HeapWord* |
335 HeapWord* |
502 // current region. We only look at those which are. |
502 // current region. We only look at those which are. |
503 if (_hr->is_in(obj)) { |
503 if (_hr->is_in(obj)) { |
504 // Object is in the region. Check that its less than top |
504 // Object is in the region. Check that its less than top |
505 if (_hr->top() <= (HeapWord*)obj) { |
505 if (_hr->top() <= (HeapWord*)obj) { |
506 // Object is above top |
506 // Object is above top |
507 gclog_or_tty->print_cr("Object "PTR_FORMAT" in region " |
507 gclog_or_tty->print_cr("Object " PTR_FORMAT " in region " |
508 "["PTR_FORMAT", "PTR_FORMAT") is above " |
508 "[" PTR_FORMAT ", " PTR_FORMAT ") is above " |
509 "top "PTR_FORMAT, |
509 "top " PTR_FORMAT, |
510 p2i(obj), p2i(_hr->bottom()), p2i(_hr->end()), p2i(_hr->top())); |
510 p2i(obj), p2i(_hr->bottom()), p2i(_hr->end()), p2i(_hr->top())); |
511 _failures = true; |
511 _failures = true; |
512 return; |
512 return; |
513 } |
513 } |
514 // Nmethod has at least one oop in the current region |
514 // Nmethod has at least one oop in the current region |
538 void do_code_blob(CodeBlob* cb) { |
538 void do_code_blob(CodeBlob* cb) { |
539 nmethod* nm = (cb == NULL) ? NULL : cb->as_nmethod_or_null(); |
539 nmethod* nm = (cb == NULL) ? NULL : cb->as_nmethod_or_null(); |
540 if (nm != NULL) { |
540 if (nm != NULL) { |
541 // Verify that the nemthod is live |
541 // Verify that the nemthod is live |
542 if (!nm->is_alive()) { |
542 if (!nm->is_alive()) { |
543 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has dead nmethod " |
543 gclog_or_tty->print_cr("region [" PTR_FORMAT "," PTR_FORMAT "] has dead nmethod " |
544 PTR_FORMAT" in its strong code roots", |
544 PTR_FORMAT " in its strong code roots", |
545 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm)); |
545 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm)); |
546 _failures = true; |
546 _failures = true; |
547 } else { |
547 } else { |
548 VerifyStrongCodeRootOopClosure oop_cl(_hr, nm); |
548 VerifyStrongCodeRootOopClosure oop_cl(_hr, nm); |
549 nm->oops_do(&oop_cl); |
549 nm->oops_do(&oop_cl); |
550 if (!oop_cl.has_oops_in_region()) { |
550 if (!oop_cl.has_oops_in_region()) { |
551 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has nmethod " |
551 gclog_or_tty->print_cr("region [" PTR_FORMAT "," PTR_FORMAT "] has nmethod " |
552 PTR_FORMAT" in its strong code roots " |
552 PTR_FORMAT " in its strong code roots " |
553 "with no pointers into region", |
553 "with no pointers into region", |
554 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm)); |
554 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm)); |
555 _failures = true; |
555 _failures = true; |
556 } else if (oop_cl.failures()) { |
556 } else if (oop_cl.failures()) { |
557 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has other " |
557 gclog_or_tty->print_cr("region [" PTR_FORMAT "," PTR_FORMAT "] has other " |
558 "failures for nmethod "PTR_FORMAT, |
558 "failures for nmethod " PTR_FORMAT, |
559 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm)); |
559 p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm)); |
560 _failures = true; |
560 _failures = true; |
561 } |
561 } |
562 } |
562 } |
563 } |
563 } |
587 |
587 |
588 // if this region is empty then there should be no entries |
588 // if this region is empty then there should be no entries |
589 // on its strong code root list |
589 // on its strong code root list |
590 if (is_empty()) { |
590 if (is_empty()) { |
591 if (strong_code_roots_length > 0) { |
591 if (strong_code_roots_length > 0) { |
592 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is empty " |
592 gclog_or_tty->print_cr("region [" PTR_FORMAT "," PTR_FORMAT "] is empty " |
593 "but has "SIZE_FORMAT" code root entries", |
593 "but has " SIZE_FORMAT " code root entries", |
594 p2i(bottom()), p2i(end()), strong_code_roots_length); |
594 p2i(bottom()), p2i(end()), strong_code_roots_length); |
595 *failures = true; |
595 *failures = true; |
596 } |
596 } |
597 return; |
597 return; |
598 } |
598 } |
599 |
599 |
600 if (is_continues_humongous()) { |
600 if (is_continues_humongous()) { |
601 if (strong_code_roots_length > 0) { |
601 if (strong_code_roots_length > 0) { |
602 gclog_or_tty->print_cr("region "HR_FORMAT" is a continuation of a humongous " |
602 gclog_or_tty->print_cr("region " HR_FORMAT " is a continuation of a humongous " |
603 "region but has "SIZE_FORMAT" code root entries", |
603 "region but has " SIZE_FORMAT " code root entries", |
604 HR_FORMAT_PARAMS(this), strong_code_roots_length); |
604 HR_FORMAT_PARAMS(this), strong_code_roots_length); |
605 *failures = true; |
605 *failures = true; |
606 } |
606 } |
607 return; |
607 return; |
608 } |
608 } |
623 if (in_collection_set()) |
623 if (in_collection_set()) |
624 st->print(" CS"); |
624 st->print(" CS"); |
625 else |
625 else |
626 st->print(" "); |
626 st->print(" "); |
627 st->print(" TS %5d", _gc_time_stamp); |
627 st->print(" TS %5d", _gc_time_stamp); |
628 st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT, |
628 st->print(" PTAMS " PTR_FORMAT " NTAMS " PTR_FORMAT, |
629 p2i(prev_top_at_mark_start()), p2i(next_top_at_mark_start())); |
629 p2i(prev_top_at_mark_start()), p2i(next_top_at_mark_start())); |
630 G1OffsetTableContigSpace::print_on(st); |
630 G1OffsetTableContigSpace::print_on(st); |
631 } |
631 } |
632 |
632 |
633 class VerifyLiveClosure: public OopClosure { |
633 class VerifyLiveClosure: public OopClosure { |
684 gclog_or_tty->cr(); |
684 gclog_or_tty->cr(); |
685 gclog_or_tty->print_cr("----------"); |
685 gclog_or_tty->print_cr("----------"); |
686 } |
686 } |
687 if (!_g1h->is_in_closed_subset(obj)) { |
687 if (!_g1h->is_in_closed_subset(obj)) { |
688 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); |
688 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); |
689 gclog_or_tty->print_cr("Field "PTR_FORMAT |
689 gclog_or_tty->print_cr("Field " PTR_FORMAT |
690 " of live obj "PTR_FORMAT" in region " |
690 " of live obj " PTR_FORMAT " in region " |
691 "["PTR_FORMAT", "PTR_FORMAT")", |
691 "[" PTR_FORMAT ", " PTR_FORMAT ")", |
692 p2i(p), p2i(_containing_obj), |
692 p2i(p), p2i(_containing_obj), |
693 p2i(from->bottom()), p2i(from->end())); |
693 p2i(from->bottom()), p2i(from->end())); |
694 print_object(gclog_or_tty, _containing_obj); |
694 print_object(gclog_or_tty, _containing_obj); |
695 gclog_or_tty->print_cr("points to obj "PTR_FORMAT" not in the heap", |
695 gclog_or_tty->print_cr("points to obj " PTR_FORMAT " not in the heap", |
696 p2i(obj)); |
696 p2i(obj)); |
697 } else { |
697 } else { |
698 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); |
698 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); |
699 HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj); |
699 HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj); |
700 gclog_or_tty->print_cr("Field "PTR_FORMAT |
700 gclog_or_tty->print_cr("Field " PTR_FORMAT |
701 " of live obj "PTR_FORMAT" in region " |
701 " of live obj " PTR_FORMAT " in region " |
702 "["PTR_FORMAT", "PTR_FORMAT")", |
702 "[" PTR_FORMAT ", " PTR_FORMAT ")", |
703 p2i(p), p2i(_containing_obj), |
703 p2i(p), p2i(_containing_obj), |
704 p2i(from->bottom()), p2i(from->end())); |
704 p2i(from->bottom()), p2i(from->end())); |
705 print_object(gclog_or_tty, _containing_obj); |
705 print_object(gclog_or_tty, _containing_obj); |
706 gclog_or_tty->print_cr("points to dead obj "PTR_FORMAT" in region " |
706 gclog_or_tty->print_cr("points to dead obj " PTR_FORMAT " in region " |
707 "["PTR_FORMAT", "PTR_FORMAT")", |
707 "[" PTR_FORMAT ", " PTR_FORMAT ")", |
708 p2i(obj), p2i(to->bottom()), p2i(to->end())); |
708 p2i(obj), p2i(to->bottom()), p2i(to->end())); |
709 print_object(gclog_or_tty, obj); |
709 print_object(gclog_or_tty, obj); |
710 } |
710 } |
711 gclog_or_tty->print_cr("----------"); |
711 gclog_or_tty->print_cr("----------"); |
712 gclog_or_tty->flush(); |
712 gclog_or_tty->flush(); |
738 if (!_failures) { |
738 if (!_failures) { |
739 gclog_or_tty->cr(); |
739 gclog_or_tty->cr(); |
740 gclog_or_tty->print_cr("----------"); |
740 gclog_or_tty->print_cr("----------"); |
741 } |
741 } |
742 gclog_or_tty->print_cr("Missing rem set entry:"); |
742 gclog_or_tty->print_cr("Missing rem set entry:"); |
743 gclog_or_tty->print_cr("Field "PTR_FORMAT" " |
743 gclog_or_tty->print_cr("Field " PTR_FORMAT " " |
744 "of obj "PTR_FORMAT", " |
744 "of obj " PTR_FORMAT ", " |
745 "in region "HR_FORMAT, |
745 "in region " HR_FORMAT, |
746 p2i(p), p2i(_containing_obj), |
746 p2i(p), p2i(_containing_obj), |
747 HR_FORMAT_PARAMS(from)); |
747 HR_FORMAT_PARAMS(from)); |
748 _containing_obj->print_on(gclog_or_tty); |
748 _containing_obj->print_on(gclog_or_tty); |
749 gclog_or_tty->print_cr("points to obj "PTR_FORMAT" " |
749 gclog_or_tty->print_cr("points to obj " PTR_FORMAT " " |
750 "in region "HR_FORMAT, |
750 "in region " HR_FORMAT, |
751 p2i(obj), |
751 p2i(obj), |
752 HR_FORMAT_PARAMS(to)); |
752 HR_FORMAT_PARAMS(to)); |
753 obj->print_on(gclog_or_tty); |
753 obj->print_on(gclog_or_tty); |
754 gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", |
754 gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", |
755 cv_obj, cv_field); |
755 cv_obj, cv_field); |
781 size_t obj_size = block_size(p); |
781 size_t obj_size = block_size(p); |
782 object_num += 1; |
782 object_num += 1; |
783 |
783 |
784 if (is_region_humongous != g1->is_humongous(obj_size) && |
784 if (is_region_humongous != g1->is_humongous(obj_size) && |
785 !g1->is_obj_dead(obj, this)) { // Dead objects may have bigger block_size since they span several objects. |
785 !g1->is_obj_dead(obj, this)) { // Dead objects may have bigger block_size since they span several objects. |
786 gclog_or_tty->print_cr("obj "PTR_FORMAT" is of %shumongous size (" |
786 gclog_or_tty->print_cr("obj " PTR_FORMAT " is of %shumongous size (" |
787 SIZE_FORMAT" words) in a %shumongous region", |
787 SIZE_FORMAT " words) in a %shumongous region", |
788 p2i(p), g1->is_humongous(obj_size) ? "" : "non-", |
788 p2i(p), g1->is_humongous(obj_size) ? "" : "non-", |
789 obj_size, is_region_humongous ? "" : "non-"); |
789 obj_size, is_region_humongous ? "" : "non-"); |
790 *failures = true; |
790 *failures = true; |
791 return; |
791 return; |
792 } |
792 } |
796 Klass* klass = obj->klass(); |
796 Klass* klass = obj->klass(); |
797 bool is_metaspace_object = Metaspace::contains(klass) || |
797 bool is_metaspace_object = Metaspace::contains(klass) || |
798 (vo == VerifyOption_G1UsePrevMarking && |
798 (vo == VerifyOption_G1UsePrevMarking && |
799 ClassLoaderDataGraph::unload_list_contains(klass)); |
799 ClassLoaderDataGraph::unload_list_contains(klass)); |
800 if (!is_metaspace_object) { |
800 if (!is_metaspace_object) { |
801 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " |
801 gclog_or_tty->print_cr("klass " PTR_FORMAT " of object " PTR_FORMAT " " |
802 "not metadata", p2i(klass), p2i(obj)); |
802 "not metadata", p2i(klass), p2i(obj)); |
803 *failures = true; |
803 *failures = true; |
804 return; |
804 return; |
805 } else if (!klass->is_klass()) { |
805 } else if (!klass->is_klass()) { |
806 gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " |
806 gclog_or_tty->print_cr("klass " PTR_FORMAT " of object " PTR_FORMAT " " |
807 "not a klass", p2i(klass), p2i(obj)); |
807 "not a klass", p2i(klass), p2i(obj)); |
808 *failures = true; |
808 *failures = true; |
809 return; |
809 return; |
810 } else { |
810 } else { |
811 vl_cl.set_containing_obj(obj); |
811 vl_cl.set_containing_obj(obj); |
847 if (p < the_end) { |
847 if (p < the_end) { |
848 // Look up top |
848 // Look up top |
849 HeapWord* addr_1 = p; |
849 HeapWord* addr_1 = p; |
850 HeapWord* b_start_1 = _offsets.block_start_const(addr_1); |
850 HeapWord* b_start_1 = _offsets.block_start_const(addr_1); |
851 if (b_start_1 != p) { |
851 if (b_start_1 != p) { |
852 gclog_or_tty->print_cr("BOT look up for top: "PTR_FORMAT" " |
852 gclog_or_tty->print_cr("BOT look up for top: " PTR_FORMAT " " |
853 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
853 " yielded " PTR_FORMAT ", expecting " PTR_FORMAT, |
854 p2i(addr_1), p2i(b_start_1), p2i(p)); |
854 p2i(addr_1), p2i(b_start_1), p2i(p)); |
855 *failures = true; |
855 *failures = true; |
856 return; |
856 return; |
857 } |
857 } |
858 |
858 |
859 // Look up top + 1 |
859 // Look up top + 1 |
860 HeapWord* addr_2 = p + 1; |
860 HeapWord* addr_2 = p + 1; |
861 if (addr_2 < the_end) { |
861 if (addr_2 < the_end) { |
862 HeapWord* b_start_2 = _offsets.block_start_const(addr_2); |
862 HeapWord* b_start_2 = _offsets.block_start_const(addr_2); |
863 if (b_start_2 != p) { |
863 if (b_start_2 != p) { |
864 gclog_or_tty->print_cr("BOT look up for top + 1: "PTR_FORMAT" " |
864 gclog_or_tty->print_cr("BOT look up for top + 1: " PTR_FORMAT " " |
865 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
865 " yielded " PTR_FORMAT ", expecting " PTR_FORMAT, |
866 p2i(addr_2), p2i(b_start_2), p2i(p)); |
866 p2i(addr_2), p2i(b_start_2), p2i(p)); |
867 *failures = true; |
867 *failures = true; |
868 return; |
868 return; |
869 } |
869 } |
870 } |
870 } |
873 size_t diff = pointer_delta(the_end, p) / 2; |
873 size_t diff = pointer_delta(the_end, p) / 2; |
874 HeapWord* addr_3 = p + diff; |
874 HeapWord* addr_3 = p + diff; |
875 if (addr_3 < the_end) { |
875 if (addr_3 < the_end) { |
876 HeapWord* b_start_3 = _offsets.block_start_const(addr_3); |
876 HeapWord* b_start_3 = _offsets.block_start_const(addr_3); |
877 if (b_start_3 != p) { |
877 if (b_start_3 != p) { |
878 gclog_or_tty->print_cr("BOT look up for top + diff: "PTR_FORMAT" " |
878 gclog_or_tty->print_cr("BOT look up for top + diff: " PTR_FORMAT " " |
879 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
879 " yielded " PTR_FORMAT ", expecting " PTR_FORMAT, |
880 p2i(addr_3), p2i(b_start_3), p2i(p)); |
880 p2i(addr_3), p2i(b_start_3), p2i(p)); |
881 *failures = true; |
881 *failures = true; |
882 return; |
882 return; |
883 } |
883 } |
884 } |
884 } |
885 |
885 |
886 // Look up end - 1 |
886 // Look up end - 1 |
887 HeapWord* addr_4 = the_end - 1; |
887 HeapWord* addr_4 = the_end - 1; |
888 HeapWord* b_start_4 = _offsets.block_start_const(addr_4); |
888 HeapWord* b_start_4 = _offsets.block_start_const(addr_4); |
889 if (b_start_4 != p) { |
889 if (b_start_4 != p) { |
890 gclog_or_tty->print_cr("BOT look up for end - 1: "PTR_FORMAT" " |
890 gclog_or_tty->print_cr("BOT look up for end - 1: " PTR_FORMAT " " |
891 " yielded "PTR_FORMAT", expecting "PTR_FORMAT, |
891 " yielded " PTR_FORMAT ", expecting " PTR_FORMAT, |
892 p2i(addr_4), p2i(b_start_4), p2i(p)); |
892 p2i(addr_4), p2i(b_start_4), p2i(p)); |
893 *failures = true; |
893 *failures = true; |
894 return; |
894 return; |
895 } |
895 } |
896 } |
896 } |
897 |
897 |
898 if (is_region_humongous && object_num > 1) { |
898 if (is_region_humongous && object_num > 1) { |
899 gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is humongous " |
899 gclog_or_tty->print_cr("region [" PTR_FORMAT "," PTR_FORMAT "] is humongous " |
900 "but has "SIZE_FORMAT", objects", |
900 "but has " SIZE_FORMAT ", objects", |
901 p2i(bottom()), p2i(end()), object_num); |
901 p2i(bottom()), p2i(end()), object_num); |
902 *failures = true; |
902 *failures = true; |
903 return; |
903 return; |
904 } |
904 } |
905 |
905 |