void print_object(outputStream* out, oop obj) { #ifdef PRODUCT klassOop k = obj->klass(); const char* class_name = instanceKlass::cast(k)->external_name(); out->print_cr("class name %s", class_name); #else // PRODUCT obj->print_on(out); #endif // PRODUCT }
void do_object(oop obj) { if (!obj->is_shared() && !obj->is_forwarded()) { ++count; if (Verbose) { tty->print("Unreferenced object: "); obj->print_on(tty); } } }
template <class T> void do_oop_work(T* p) { assert(_containing_obj != NULL, "Precondition"); assert(!_g1h->is_obj_dead_cond(_containing_obj, _use_prev_marking), "Precondition"); T heap_oop = oopDesc::load_heap_oop(p); if (!oopDesc::is_null(heap_oop)) { oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); bool failed = false; if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _use_prev_marking)) { if (!_failures) { gclog_or_tty->print_cr(""); gclog_or_tty->print_cr("----------"); } if (!_g1h->is_in_closed_subset(obj)) { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); gclog_or_tty->print_cr("Field "PTR_FORMAT " of live obj "PTR_FORMAT" in region " "["PTR_FORMAT", "PTR_FORMAT")", p, (void*) _containing_obj, from->bottom(), from->end()); print_object(gclog_or_tty, _containing_obj); gclog_or_tty->print_cr("points to obj "PTR_FORMAT" not in the heap", (void*) obj); } else { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj); gclog_or_tty->print_cr("Field "PTR_FORMAT " of live obj "PTR_FORMAT" in region " "["PTR_FORMAT", "PTR_FORMAT")", p, (void*) _containing_obj, from->bottom(), from->end()); print_object(gclog_or_tty, _containing_obj); gclog_or_tty->print_cr("points to dead obj "PTR_FORMAT" in region " "["PTR_FORMAT", "PTR_FORMAT")", (void*) obj, to->bottom(), to->end()); print_object(gclog_or_tty, obj); } gclog_or_tty->print_cr("----------"); _failures = true; failed = true; _n_failures++; } if (!_g1h->full_collection()) { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); HeapRegion* to = _g1h->heap_region_containing(obj); if (from != NULL && to != NULL && from != to && !to->isHumongous()) { jbyte cv_obj = *_bs->byte_for_const(_containing_obj); jbyte cv_field = *_bs->byte_for_const(p); const jbyte dirty = CardTableModRefBS::dirty_card_val(); bool is_bad = !(from->is_young() || to->rem_set()->contains_reference(p) || !G1HRRSFlushLogBuffersOnVerify && // buffers were not flushed (_containing_obj->is_objArray() ? cv_field == dirty : cv_obj == dirty || cv_field == dirty)); if (is_bad) { if (!_failures) { gclog_or_tty->print_cr(""); gclog_or_tty->print_cr("----------"); } gclog_or_tty->print_cr("Missing rem set entry:"); gclog_or_tty->print_cr("Field "PTR_FORMAT " of obj "PTR_FORMAT ", in region %d ["PTR_FORMAT ", "PTR_FORMAT"),", p, (void*) _containing_obj, from->hrs_index(), from->bottom(), from->end()); _containing_obj->print_on(gclog_or_tty); gclog_or_tty->print_cr("points to obj "PTR_FORMAT " in region %d ["PTR_FORMAT ", "PTR_FORMAT").", (void*) obj, to->hrs_index(), to->bottom(), to->end()); obj->print_on(gclog_or_tty); gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field); gclog_or_tty->print_cr("----------"); _failures = true; if (!failed) _n_failures++; } } } } }