< prev index next >

src/hotspot/share/gc/g1/heapRegion.inline.hpp

Print this page

        

*** 255,267 **** inline bool HeapRegion::in_collection_set() const { return G1CollectedHeap::heap()->is_in_cset(this); } template <class Closure, bool is_gc_active> ! HeapWord* HeapRegion::do_oops_on_memregion_in_humongous(MemRegion mr, ! Closure* cl, ! G1CollectedHeap* g1h) { assert(is_humongous(), "precondition"); HeapRegion* sr = humongous_start_region(); oop obj = oop(sr->bottom()); // If concurrent and klass_or_null is NULL, then space has been --- 255,267 ---- inline bool HeapRegion::in_collection_set() const { return G1CollectedHeap::heap()->is_in_cset(this); } template <class Closure, bool is_gc_active> ! bool HeapRegion::do_oops_on_card_in_humongous(MemRegion mr, ! Closure* cl, ! G1CollectedHeap* g1h) { assert(is_humongous(), "precondition"); HeapRegion* sr = humongous_start_region(); oop obj = oop(sr->bottom()); // If concurrent and klass_or_null is NULL, then space has been
*** 269,320 **** // the klass. That can only happen if the card is stale. However, // we've already set the card clean, so we must return failure, // since the allocating thread could have performed a write to the // card that might be missed otherwise. if (!is_gc_active && (obj->klass_or_null_acquire() == NULL)) { ! return NULL; } // We have a well-formed humongous object at the start of sr. // Only filler objects follow a humongous object in the containing // regions, and we can ignore those. So only process the one // humongous object. ! if (g1h->is_obj_dead(obj, sr)) { ! // The object is dead. There can be no other object in this region, so return ! // the end of that region. ! return end(); ! } ! if (obj->is_objArray() || (sr->bottom() < mr.start())) { ! // objArrays are always marked precisely, so limit processing ! // with mr. Non-objArrays might be precisely marked, and since ! // it's humongous it's worthwhile avoiding full processing. ! // However, the card could be stale and only cover filler ! // objects. That should be rare, so not worth checking for; ! // instead let it fall out from the bounded iteration. ! obj->oop_iterate(cl, mr); ! return mr.end(); ! } else { ! // If obj is not an objArray and mr contains the start of the ! // obj, then this could be an imprecise mark, and we need to ! // process the entire object. ! int size = obj->oop_iterate_size(cl); ! // We have scanned to the end of the object, but since there can be no objects ! // after this humongous object in the region, we can return the end of the ! // region if it is greater. ! return MAX2((HeapWord*)obj + size, mr.end()); } } template <bool is_gc_active, class Closure> ! HeapWord* HeapRegion::oops_on_memregion_seq_iterate_careful(MemRegion mr, ! Closure* cl) { assert(MemRegion(bottom(), end()).contains(mr), "Card region not in heap region"); G1CollectedHeap* g1h = G1CollectedHeap::heap(); // Special handling for humongous regions. if (is_humongous()) { ! return do_oops_on_memregion_in_humongous<Closure, is_gc_active>(mr, cl, g1h); } assert(is_old() || is_archive(), "Wrongly trying to iterate over region %u type %s", _hrm_index, get_type_str()); // Because mr has been trimmed to what's been allocated in this // region, the parts of the heap that are examined here are always --- 269,313 ---- // the klass. That can only happen if the card is stale. However, // we've already set the card clean, so we must return failure, // since the allocating thread could have performed a write to the // card that might be missed otherwise. if (!is_gc_active && (obj->klass_or_null_acquire() == NULL)) { ! return false; } // We have a well-formed humongous object at the start of sr. // Only filler objects follow a humongous object in the containing // regions, and we can ignore those. So only process the one // humongous object. ! if (!g1h->is_obj_dead(obj, sr)) { ! if (obj->is_objArray() || (sr->bottom() < mr.start())) { ! // objArrays are always marked precisely, so limit processing ! // with mr. Non-objArrays might be precisely marked, and since ! // it's humongous it's worthwhile avoiding full processing. ! // However, the card could be stale and only cover filler ! // objects. That should be rare, so not worth checking for; ! // instead let it fall out from the bounded iteration. ! obj->oop_iterate(cl, mr); ! } else { ! // If obj is not an objArray and mr contains the start of the ! // obj, then this could be an imprecise mark, and we need to ! // process the entire object. ! obj->oop_iterate(cl); ! } } + return true; } template <bool is_gc_active, class Closure> ! bool HeapRegion::oops_on_card_seq_iterate_careful(MemRegion mr, ! Closure* cl) { assert(MemRegion(bottom(), end()).contains(mr), "Card region not in heap region"); G1CollectedHeap* g1h = G1CollectedHeap::heap(); // Special handling for humongous regions. if (is_humongous()) { ! return do_oops_on_card_in_humongous<Closure, is_gc_active>(mr, cl, g1h); } assert(is_old() || is_archive(), "Wrongly trying to iterate over region %u type %s", _hrm_index, get_type_str()); // Because mr has been trimmed to what's been allocated in this // region, the parts of the heap that are examined here are always
*** 339,357 **** "start: " PTR_FORMAT ", next: " PTR_FORMAT, p2i(start), p2i(next)); } #endif const G1CMBitMap* const bitmap = g1h->concurrent_mark()->prev_mark_bitmap(); ! while (true) { oop obj = oop(cur); assert(oopDesc::is_oop(obj, true), "Not an oop at " PTR_FORMAT, p2i(cur)); assert(obj->klass_or_null() != NULL, "Unparsable heap at " PTR_FORMAT, p2i(cur)); size_t size; bool is_dead = is_obj_dead_with_size(obj, bitmap, &size); - bool is_precise = false; cur += size; if (!is_dead) { // Process live object's references. --- 332,349 ---- "start: " PTR_FORMAT ", next: " PTR_FORMAT, p2i(start), p2i(next)); } #endif const G1CMBitMap* const bitmap = g1h->concurrent_mark()->prev_mark_bitmap(); ! do { oop obj = oop(cur); assert(oopDesc::is_oop(obj, true), "Not an oop at " PTR_FORMAT, p2i(cur)); assert(obj->klass_or_null() != NULL, "Unparsable heap at " PTR_FORMAT, p2i(cur)); size_t size; bool is_dead = is_obj_dead_with_size(obj, bitmap, &size); cur += size; if (!is_dead) { // Process live object's references.
*** 361,375 **** // over in full if completely covered. if (!obj->is_objArray() || (((HeapWord*)obj) >= start && cur <= end)) { obj->oop_iterate(cl); } else { obj->oop_iterate(cl, mr); - is_precise = true; } } ! if (cur >= end) { ! return is_precise ? end : cur; ! } ! } } #endif // SHARE_GC_G1_HEAPREGION_INLINE_HPP --- 353,365 ---- // over in full if completely covered. if (!obj->is_objArray() || (((HeapWord*)obj) >= start && cur <= end)) { obj->oop_iterate(cl); } else { obj->oop_iterate(cl, mr); } } ! } while (cur < end); ! ! return true; } #endif // SHARE_GC_G1_HEAPREGION_INLINE_HPP
< prev index next >