40 oop obj = RawAccess<OOP_NOT_NULL>::oop_load(p); 41 // weak references are sometimes scanned twice; must check 42 // that to-space doesn't already contain this object 43 if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) { 44 // we need to ensure that it is copied (see comment in 45 // ParScanClosure::do_oop_work). 46 Klass* objK = obj->klass(); 47 markOop m = obj->mark_raw(); 48 oop new_obj; 49 if (m->is_marked()) { // Contains forwarding pointer. 50 new_obj = ParNewGeneration::real_forwardee(obj); 51 } else { 52 size_t obj_sz = obj->size_given_klass(objK); 53 new_obj = ((ParNewGeneration*)_g)->copy_to_survivor_space(_par_scan_state, 54 obj, obj_sz, m); 55 } 56 RawAccess<OOP_NOT_NULL>::oop_store(p, new_obj); 57 } 58 } 59 60 inline void ParScanWeakRefClosure::do_oop_nv(oop* p) { ParScanWeakRefClosure::do_oop_work(p); } 61 inline void ParScanWeakRefClosure::do_oop_nv(narrowOop* p) { ParScanWeakRefClosure::do_oop_work(p); } 62 63 template <class T> inline void ParScanClosure::par_do_barrier(T* p) { 64 assert(generation()->is_in_reserved(p), "expected ref in generation"); 65 oop obj = RawAccess<OOP_NOT_NULL>::oop_load(p); 66 // If p points to a younger generation, mark the card. 67 if ((HeapWord*)obj < gen_boundary()) { 68 rs()->write_ref_field_gc_par(p, obj); 69 } 70 } 71 72 template <class T> 73 inline void ParScanClosure::do_oop_work(T* p, 74 bool gc_barrier, 75 bool root_scan) { 76 assert((!CMSHeap::heap()->is_in_reserved(p) || 77 generation()->is_in_reserved(p)) 78 && (CMSHeap::heap()->is_young_gen(generation()) || gc_barrier), 79 "The gen must be right, and we must be doing the barrier " 80 "in older generations."); 81 T heap_oop = RawAccess<>::oop_load(p); 120 size_t obj_sz = obj->size_given_klass(objK); 121 new_obj = _g->copy_to_survivor_space(_par_scan_state, obj, obj_sz, m); 122 RawAccess<OOP_NOT_NULL>::oop_store(p, new_obj); 123 if (root_scan) { 124 // This may have pushed an object. If we have a root 125 // category with a lot of roots, can't let the queue get too 126 // full: 127 (void)_par_scan_state->trim_queues(10 * ParallelGCThreads); 128 } 129 } 130 if (is_scanning_a_cld()) { 131 do_cld_barrier(); 132 } else if (gc_barrier) { 133 // Now call parent closure 134 par_do_barrier(p); 135 } 136 } 137 } 138 } 139 140 inline void ParScanWithBarrierClosure::do_oop_nv(oop* p) { ParScanClosure::do_oop_work(p, true, false); } 141 inline void ParScanWithBarrierClosure::do_oop_nv(narrowOop* p) { ParScanClosure::do_oop_work(p, true, false); } 142 143 inline void ParScanWithoutBarrierClosure::do_oop_nv(oop* p) { ParScanClosure::do_oop_work(p, false, false); } 144 inline void ParScanWithoutBarrierClosure::do_oop_nv(narrowOop* p) { ParScanClosure::do_oop_work(p, false, false); } 145 146 #endif // SHARE_VM_GC_CMS_PAROOPCLOSURES_INLINE_HPP | 40 oop obj = RawAccess<OOP_NOT_NULL>::oop_load(p); 41 // weak references are sometimes scanned twice; must check 42 // that to-space doesn't already contain this object 43 if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) { 44 // we need to ensure that it is copied (see comment in 45 // ParScanClosure::do_oop_work). 46 Klass* objK = obj->klass(); 47 markOop m = obj->mark_raw(); 48 oop new_obj; 49 if (m->is_marked()) { // Contains forwarding pointer. 50 new_obj = ParNewGeneration::real_forwardee(obj); 51 } else { 52 size_t obj_sz = obj->size_given_klass(objK); 53 new_obj = ((ParNewGeneration*)_g)->copy_to_survivor_space(_par_scan_state, 54 obj, obj_sz, m); 55 } 56 RawAccess<OOP_NOT_NULL>::oop_store(p, new_obj); 57 } 58 } 59 60 inline void ParScanWeakRefClosure::do_oop(oop* p) { ParScanWeakRefClosure::do_oop_work(p); } 61 inline void ParScanWeakRefClosure::do_oop(narrowOop* p) { ParScanWeakRefClosure::do_oop_work(p); } 62 63 template <class T> inline void ParScanClosure::par_do_barrier(T* p) { 64 assert(generation()->is_in_reserved(p), "expected ref in generation"); 65 oop obj = RawAccess<OOP_NOT_NULL>::oop_load(p); 66 // If p points to a younger generation, mark the card. 67 if ((HeapWord*)obj < gen_boundary()) { 68 rs()->write_ref_field_gc_par(p, obj); 69 } 70 } 71 72 template <class T> 73 inline void ParScanClosure::do_oop_work(T* p, 74 bool gc_barrier, 75 bool root_scan) { 76 assert((!CMSHeap::heap()->is_in_reserved(p) || 77 generation()->is_in_reserved(p)) 78 && (CMSHeap::heap()->is_young_gen(generation()) || gc_barrier), 79 "The gen must be right, and we must be doing the barrier " 80 "in older generations."); 81 T heap_oop = RawAccess<>::oop_load(p); 120 size_t obj_sz = obj->size_given_klass(objK); 121 new_obj = _g->copy_to_survivor_space(_par_scan_state, obj, obj_sz, m); 122 RawAccess<OOP_NOT_NULL>::oop_store(p, new_obj); 123 if (root_scan) { 124 // This may have pushed an object. If we have a root 125 // category with a lot of roots, can't let the queue get too 126 // full: 127 (void)_par_scan_state->trim_queues(10 * ParallelGCThreads); 128 } 129 } 130 if (is_scanning_a_cld()) { 131 do_cld_barrier(); 132 } else if (gc_barrier) { 133 // Now call parent closure 134 par_do_barrier(p); 135 } 136 } 137 } 138 } 139 140 inline void ParScanWithBarrierClosure::do_oop(oop* p) { ParScanClosure::do_oop_work(p, true, false); } 141 inline void ParScanWithBarrierClosure::do_oop(narrowOop* p) { ParScanClosure::do_oop_work(p, true, false); } 142 143 inline void ParScanWithoutBarrierClosure::do_oop(oop* p) { ParScanClosure::do_oop_work(p, false, false); } 144 inline void ParScanWithoutBarrierClosure::do_oop(narrowOop* p) { ParScanClosure::do_oop_work(p, false, false); } 145 146 #endif // SHARE_VM_GC_CMS_PAROOPCLOSURES_INLINE_HPP |