< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahNMethod.inline.hpp

Print this page
*** 68,11 ***
  void ShenandoahNMethod::heal_nmethod_metadata(ShenandoahNMethod* nmethod_data) {
    ShenandoahEvacuateUpdateMetadataClosure cl;
    nmethod_data->oops_do(&cl, true /*fix relocation*/);
  }
  
! void ShenandoahNMethod::disarm_nmethod(nmethod* nm) {
    BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
    if (bs->is_armed(nm)) {
      bs->disarm(nm);
    }
  }
--- 68,26 ---
  void ShenandoahNMethod::heal_nmethod_metadata(ShenandoahNMethod* nmethod_data) {
    ShenandoahEvacuateUpdateMetadataClosure cl;
    nmethod_data->oops_do(&cl, true /*fix relocation*/);
  }
  
! void ShenandoahNMethod::complete_and_disarm_nmethod(nmethod* nm) {
+   ShenandoahNMethod* data = gc_data(nm);
+   assert(data != nullptr, "Sanity");
+   ShenandoahNMethodLocker locker(data->lock());
+ 
+   complete_and_disarm_nmethod_unlocked(nm);
+ }
+ 
+ void ShenandoahNMethod::complete_and_disarm_nmethod_unlocked(nmethod* nm) {
+   ShenandoahNMethod* data = gc_data(nm);
+   assert(data != nullptr, "Sanity");
+   assert(data->lock()->owned_by_self(), "Must hold the lock");
+ 
+   // Update barriers right here, to avoid missing them
+   update_barriers(nm);
+ 
    BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
    if (bs->is_armed(nm)) {
      bs->disarm(nm);
    }
  }
< prev index next >