160 GrowableArray<oop*> oops;
161
162 detect_reloc_oops(nm, oops, non_immediate_oops);
163
164 // No embedded oops
165 if(!ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() &&
166 oops.is_empty() && nm->oops_begin() >= nm->oops_end()) {
167 return NULL;
168 }
169
170 return new ShenandoahNMethod(nm, oops, non_immediate_oops);
171 }
172
173 void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
174 assert(ShenandoahHeap::heap()->is_concurrent_root_in_progress(), "Only this phase");
175 ShenandoahNMethod* data = gc_data(nm);
176 assert(data != NULL, "Sanity");
177 assert(data->lock()->owned_by_self(), "Must hold the lock");
178
179 ShenandoahEvacOOMScope evac_scope;
180 ShenandoahEvacuateUpdateRootsClosure cl;
181 data->oops_do(&cl, true /*fix relocation*/);
182 }
183
184 #ifdef ASSERT
185 void ShenandoahNMethod::assert_alive_and_correct() {
186 assert(_nm->is_alive(), "only alive nmethods here");
187 ShenandoahHeap* heap = ShenandoahHeap::heap();
188 for (int c = 0; c < _oops_count; c++) {
189 oop *loc = _oops[c];
190 assert(_nm->code_contains((address) loc) || _nm->oops_contains(loc), "nmethod should contain the oop*");
191 oop o = RawAccess<>::oop_load(loc);
192 shenandoah_assert_correct_except(loc, o, o == NULL || heap->is_full_gc_move_in_progress());
193 }
194
195 oop* const begin = _nm->oops_begin();
196 oop* const end = _nm->oops_end();
197 for (oop* p = begin; p < end; p++) {
198 if (*p != Universe::non_oop_word()) {
199 oop o = RawAccess<>::oop_load(p);
200 shenandoah_assert_correct_except(p, o, o == NULL || heap->is_full_gc_move_in_progress());
|
160 GrowableArray<oop*> oops;
161
162 detect_reloc_oops(nm, oops, non_immediate_oops);
163
164 // No embedded oops
165 if(!ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() &&
166 oops.is_empty() && nm->oops_begin() >= nm->oops_end()) {
167 return NULL;
168 }
169
170 return new ShenandoahNMethod(nm, oops, non_immediate_oops);
171 }
172
173 void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
174 assert(ShenandoahHeap::heap()->is_concurrent_root_in_progress(), "Only this phase");
175 ShenandoahNMethod* data = gc_data(nm);
176 assert(data != NULL, "Sanity");
177 assert(data->lock()->owned_by_self(), "Must hold the lock");
178
179 ShenandoahEvacOOMScope evac_scope;
180 ShenandoahEvacuateUpdateRootsClosure<> cl;
181 data->oops_do(&cl, true /*fix relocation*/);
182 }
183
184 #ifdef ASSERT
185 void ShenandoahNMethod::assert_alive_and_correct() {
186 assert(_nm->is_alive(), "only alive nmethods here");
187 ShenandoahHeap* heap = ShenandoahHeap::heap();
188 for (int c = 0; c < _oops_count; c++) {
189 oop *loc = _oops[c];
190 assert(_nm->code_contains((address) loc) || _nm->oops_contains(loc), "nmethod should contain the oop*");
191 oop o = RawAccess<>::oop_load(loc);
192 shenandoah_assert_correct_except(loc, o, o == NULL || heap->is_full_gc_move_in_progress());
193 }
194
195 oop* const begin = _nm->oops_begin();
196 oop* const end = _nm->oops_end();
197 for (oop* p = begin; p < end; p++) {
198 if (*p != Universe::non_oop_word()) {
199 oop o = RawAccess<>::oop_load(p);
200 shenandoah_assert_correct_except(p, o, o == NULL || heap->is_full_gc_move_in_progress());
|