179 virtual void do_oop(narrowOop* p) {
180 ShouldNotReachHere();
181 }
182 };
183
184 void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
185 ShenandoahNMethod* data = gc_data(nm);
186 assert(data != NULL, "Sanity");
187 assert(data->lock()->owned_by_self(), "Must hold the lock");
188
189 ShenandoahHeap* const heap = ShenandoahHeap::heap();
190 if (heap->is_concurrent_mark_in_progress()) {
191 if (heap->has_forwarded_objects()) {
192 ShenandoahKeepNMethodMetadataAliveClosure<true> cl;
193 data->oops_do(&cl);
194 } else {
195 ShenandoahKeepNMethodMetadataAliveClosure<false> cl;
196 data->oops_do(&cl);
197 }
198 } else if (heap->is_concurrent_weak_root_in_progress()) {
199 ShenandoahEvacOOMScope evac_scope;
200 heal_nmethod_metadata(data);
201 } else {
202 // There is possibility that GC is cancelled when it arrives final mark.
203 // In this case, concurrent root phase is skipped and degenerated GC should be
204 // followed, where nmethods are disarmed.
205 assert(heap->cancelled_gc(), "What else?");
206 }
207 }
208
209 #ifdef ASSERT
210 void ShenandoahNMethod::assert_alive_and_correct() {
211 assert(_nm->is_alive(), "only alive nmethods here");
212 ShenandoahHeap* heap = ShenandoahHeap::heap();
213 for (int c = 0; c < _oops_count; c++) {
214 oop *loc = _oops[c];
215 assert(_nm->code_contains((address) loc) || _nm->oops_contains(loc), "nmethod should contain the oop*");
216 oop o = RawAccess<>::oop_load(loc);
217 shenandoah_assert_correct_except(loc, o, o == NULL || heap->is_full_gc_move_in_progress());
218 }
219
|
179 virtual void do_oop(narrowOop* p) {
180 ShouldNotReachHere();
181 }
182 };
183
184 void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
185 ShenandoahNMethod* data = gc_data(nm);
186 assert(data != NULL, "Sanity");
187 assert(data->lock()->owned_by_self(), "Must hold the lock");
188
189 ShenandoahHeap* const heap = ShenandoahHeap::heap();
190 if (heap->is_concurrent_mark_in_progress()) {
191 if (heap->has_forwarded_objects()) {
192 ShenandoahKeepNMethodMetadataAliveClosure<true> cl;
193 data->oops_do(&cl);
194 } else {
195 ShenandoahKeepNMethodMetadataAliveClosure<false> cl;
196 data->oops_do(&cl);
197 }
198 } else if (heap->is_concurrent_weak_root_in_progress()) {
199 ShenandoahEvacOOMScope evac_scope(heap);
200 heal_nmethod_metadata(data);
201 } else {
202 // There is possibility that GC is cancelled when it arrives final mark.
203 // In this case, concurrent root phase is skipped and degenerated GC should be
204 // followed, where nmethods are disarmed.
205 assert(heap->cancelled_gc(), "What else?");
206 }
207 }
208
209 #ifdef ASSERT
210 void ShenandoahNMethod::assert_alive_and_correct() {
211 assert(_nm->is_alive(), "only alive nmethods here");
212 ShenandoahHeap* heap = ShenandoahHeap::heap();
213 for (int c = 0; c < _oops_count; c++) {
214 oop *loc = _oops[c];
215 assert(_nm->code_contains((address) loc) || _nm->oops_contains(loc), "nmethod should contain the oop*");
216 oop o = RawAccess<>::oop_load(loc);
217 shenandoah_assert_correct_except(loc, o, o == NULL || heap->is_full_gc_move_in_progress());
218 }
219
|