< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp

Print this page

138       oops.push(addr);
139     }
140   }
141 }
142 
143 ShenandoahNMethod* ShenandoahNMethod::for_nmethod(nmethod* nm) {
144   ResourceMark rm;
145   bool non_immediate_oops = false;
146   GrowableArray<oop*> oops;
147 
148   detect_reloc_oops(nm, oops, non_immediate_oops);
149   return new ShenandoahNMethod(nm, oops, non_immediate_oops);
150 }
151 
152 void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
153   ShenandoahNMethod* data = gc_data(nm);
154   assert(data != NULL, "Sanity");
155   assert(data->lock()->owned_by_self(), "Must hold the lock");
156 
157   ShenandoahHeap* const heap = ShenandoahHeap::heap();
158   if (heap->is_concurrent_mark_in_progress()) {
159     ShenandoahKeepAliveClosure cl;
160     data->oops_do(&cl);
161   } else if (heap->is_concurrent_weak_root_in_progress() ||
162              heap->is_concurrent_strong_root_in_progress()) {
163     ShenandoahEvacOOMScope evac_scope;
164     heal_nmethod_metadata(data);



165   } else {
166     // There is possibility that GC is cancelled when it arrives final mark.
167     // In this case, concurrent root phase is skipped and degenerated GC should be
168     // followed, where nmethods are disarmed.
169     assert(heap->cancelled_gc(), "What else?");
170   }
171 }
172 
173 #ifdef ASSERT
174 void ShenandoahNMethod::assert_correct() {
175   ShenandoahHeap* heap = ShenandoahHeap::heap();
176   for (int c = 0; c < _oops_count; c++) {
177     oop *loc = _oops[c];
178     assert(_nm->code_contains((address) loc) || _nm->oops_contains(loc), "nmethod should contain the oop*");
179     oop o = RawAccess<>::oop_load(loc);
180     shenandoah_assert_correct_except(loc, o, o == NULL || heap->is_full_gc_move_in_progress());
181   }
182 
183   oop* const begin = _nm->oops_begin();
184   oop* const end = _nm->oops_end();

138       oops.push(addr);
139     }
140   }
141 }
142 
143 ShenandoahNMethod* ShenandoahNMethod::for_nmethod(nmethod* nm) {
144   ResourceMark rm;
145   bool non_immediate_oops = false;
146   GrowableArray<oop*> oops;
147 
148   detect_reloc_oops(nm, oops, non_immediate_oops);
149   return new ShenandoahNMethod(nm, oops, non_immediate_oops);
150 }
151 
152 void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
153   ShenandoahNMethod* data = gc_data(nm);
154   assert(data != NULL, "Sanity");
155   assert(data->lock()->owned_by_self(), "Must hold the lock");
156 
157   ShenandoahHeap* const heap = ShenandoahHeap::heap();
158   if (heap->is_concurrent_weak_root_in_progress() ||
159       heap->is_concurrent_strong_root_in_progress()) {



160     ShenandoahEvacOOMScope evac_scope;
161     heal_nmethod_metadata(data);
162   } else if (heap->is_concurrent_mark_in_progress()) {
163     ShenandoahKeepAliveClosure cl;
164     data->oops_do(&cl);
165   } else {
166     // There is possibility that GC is cancelled when it arrives final mark.
167     // In this case, concurrent root phase is skipped and degenerated GC should be
168     // followed, where nmethods are disarmed.
169     assert(heap->cancelled_gc(), "What else?");
170   }
171 }
172 
173 #ifdef ASSERT
174 void ShenandoahNMethod::assert_correct() {
175   ShenandoahHeap* heap = ShenandoahHeap::heap();
176   for (int c = 0; c < _oops_count; c++) {
177     oop *loc = _oops[c];
178     assert(_nm->code_contains((address) loc) || _nm->oops_contains(loc), "nmethod should contain the oop*");
179     oop o = RawAccess<>::oop_load(loc);
180     shenandoah_assert_correct_except(loc, o, o == NULL || heap->is_full_gc_move_in_progress());
181   }
182 
183   oop* const begin = _nm->oops_begin();
184   oop* const end = _nm->oops_end();
< prev index next >