--- old/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp 2014-01-27 11:18:27.368019780 +0100 +++ new/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp 2014-01-27 11:18:27.268019784 +0100 @@ -2064,11 +2064,11 @@ } } - template <class T> void deal_with_reference(T* ref_to_scan) { + void deal_with_reference(oop* ref_to_scan) { if (has_partial_array_mask(ref_to_scan)) { _partial_scan_cl->do_oop_nv(ref_to_scan); } else { - // Note: we can use "raw" versions of "region_containing" because + // We can use "raw" versions of "region_containing" because // "obj_to_scan" is definitely in the heap, and is not in a // humongous region. HeapRegion* r = _g1h->heap_region_containing_raw(ref_to_scan); @@ -2077,9 +2077,22 @@ } } + void deal_with_reference(narrowOop* ref_to_scan) { + // Compared to deal_with_reference(oop*) above we can skip the + // has_partial_array_mask() check. We never generate partial array masks + // with narrowOop*. + // We can use "raw" versions of "region_containing" because + // "obj_to_scan" is definitely in the heap, and is not in a + // humongous region. + HeapRegion* r = _g1h->heap_region_containing_raw(ref_to_scan); + _evac_cl->set_region(r); + _evac_cl->do_oop_nv(ref_to_scan); + } + void deal_with_reference(StarTask ref) { assert(verify_task(ref), "sanity"); if (ref.is_narrow()) { + assert(!has_partial_array_mask((narrowOop*)ref), "Partial array references are never passed as narrow oop references."); deal_with_reference((narrowOop*)ref); } else { deal_with_reference((oop*)ref);