87 }
88
89 template <class T>
90 inline void G1CMOopClosure::do_oop_nv(T* p) {
91 _task->deal_with_reference(p);
92 }
93
94 template <class T>
95 inline void G1RootRegionScanClosure::do_oop_nv(T* p) {
96 T heap_oop = RawAccess<MO_VOLATILE>::oop_load(p);
97 if (CompressedOops::is_null(heap_oop)) {
98 return;
99 }
100 oop obj = CompressedOops::decode_not_null(heap_oop);
101 _cm->mark_in_next_bitmap(_worker_id, obj);
102 }
103
104 template <class T>
105 inline static void check_obj_during_refinement(T* p, oop const obj) {
106 #ifdef ASSERT
107 G1CollectedHeap* g1 = G1CollectedHeap::heap();
108 // can't do because of races
109 // assert(oopDesc::is_oop_or_null(obj), "expected an oop");
110 assert(check_obj_alignment(obj), "not oop aligned");
111 assert(g1->is_in_reserved(obj), "must be in heap");
112
113 HeapRegion* from = g1->heap_region_containing(p);
114
115 assert(from != NULL, "from region must be non-NULL");
116 assert(from->is_in_reserved(p) ||
117 (from->is_humongous() &&
118 g1->heap_region_containing(p)->is_humongous() &&
119 from->humongous_start_region() == g1->heap_region_containing(p)->humongous_start_region()),
120 "p " PTR_FORMAT " is not in the same region %u or part of the correct humongous object starting at region %u.",
121 p2i(p), from->hrm_index(), from->humongous_start_region()->hrm_index());
122 #endif // ASSERT
123 }
124
125 template <class T>
126 inline void G1ConcurrentRefineOopClosure::do_oop_nv(T* p) {
127 T o = RawAccess<MO_VOLATILE>::oop_load(p);
128 if (CompressedOops::is_null(o)) {
129 return;
130 }
131 oop obj = CompressedOops::decode_not_null(o);
132
133 check_obj_during_refinement(p, obj);
134
135 if (HeapRegion::is_in_same_region(p, obj)) {
136 // Normally this closure should only be called with cross-region references.
137 // But since Java threads are manipulating the references concurrently and we
138 // reload the values things may have changed.
139 // Also this check lets slip through references from a humongous continues region
|
87 }
88
89 template <class T>
90 inline void G1CMOopClosure::do_oop_nv(T* p) {
91 _task->deal_with_reference(p);
92 }
93
94 template <class T>
95 inline void G1RootRegionScanClosure::do_oop_nv(T* p) {
96 T heap_oop = RawAccess<MO_VOLATILE>::oop_load(p);
97 if (CompressedOops::is_null(heap_oop)) {
98 return;
99 }
100 oop obj = CompressedOops::decode_not_null(heap_oop);
101 _cm->mark_in_next_bitmap(_worker_id, obj);
102 }
103
104 template <class T>
105 inline static void check_obj_during_refinement(T* p, oop const obj) {
106 #ifdef ASSERT
107 G1CollectedHeap* g1h = G1CollectedHeap::heap();
108 // can't do because of races
109 // assert(oopDesc::is_oop_or_null(obj), "expected an oop");
110 assert(check_obj_alignment(obj), "not oop aligned");
111 assert(g1h->is_in_reserved(obj), "must be in heap");
112
113 HeapRegion* from = g1h->heap_region_containing(p);
114
115 assert(from != NULL, "from region must be non-NULL");
116 assert(from->is_in_reserved(p) ||
117 (from->is_humongous() &&
118 g1h->heap_region_containing(p)->is_humongous() &&
119 from->humongous_start_region() == g1h->heap_region_containing(p)->humongous_start_region()),
120 "p " PTR_FORMAT " is not in the same region %u or part of the correct humongous object starting at region %u.",
121 p2i(p), from->hrm_index(), from->humongous_start_region()->hrm_index());
122 #endif // ASSERT
123 }
124
125 template <class T>
126 inline void G1ConcurrentRefineOopClosure::do_oop_nv(T* p) {
127 T o = RawAccess<MO_VOLATILE>::oop_load(p);
128 if (CompressedOops::is_null(o)) {
129 return;
130 }
131 oop obj = CompressedOops::decode_not_null(o);
132
133 check_obj_during_refinement(p, obj);
134
135 if (HeapRegion::is_in_same_region(p, obj)) {
136 // Normally this closure should only be called with cross-region references.
137 // But since Java threads are manipulating the references concurrently and we
138 // reload the values things may have changed.
139 // Also this check lets slip through references from a humongous continues region
|