src/hotspot/share/gc/z/zNMethod.cpp
changeset 53921 a590b6107ab3
parent 53894 bf1133e7dfba
child 54786 ebf733a324d4
equal deleted inserted replaced
53920:7a72441858bb 53921:a590b6107ab3
    80   }
    80   }
    81 
    81 
    82   // Attach GC data to nmethod
    82   // Attach GC data to nmethod
    83   ZNMethodData* data = gc_data(nm);
    83   ZNMethodData* data = gc_data(nm);
    84   if (data == NULL) {
    84   if (data == NULL) {
    85     data = ZNMethodData::create(nm);
    85     data = new ZNMethodData();
    86     set_gc_data(nm, data);
    86     set_gc_data(nm, data);
    87   }
    87   }
    88 
    88 
    89   // Attach oops in GC data
    89   // Attach oops in GC data
    90   ZNMethodDataOops* const new_oops = ZNMethodDataOops::create(immediate_oops, non_immediate_oops);
    90   ZNMethodDataOops* const new_oops = ZNMethodDataOops::create(immediate_oops, non_immediate_oops);
    91   ZNMethodDataOops* const old_oops = data->swap_oops(new_oops);
    91   ZNMethodDataOops* const old_oops = data->swap_oops(new_oops);
    92   ZNMethodDataOops::destroy(old_oops);
    92   ZNMethodDataOops::destroy(old_oops);
    93 }
    93 }
    94 
    94 
    95 void ZNMethod::detach_gc_data(nmethod* nm) {
       
    96   // Destroy GC data
       
    97   ZNMethodData::destroy(gc_data(nm));
       
    98   set_gc_data(nm, NULL);
       
    99 }
       
   100 
       
   101 ZReentrantLock* ZNMethod::lock_for_nmethod(nmethod* nm) {
    95 ZReentrantLock* ZNMethod::lock_for_nmethod(nmethod* nm) {
   102   ZNMethodData* const data = gc_data(nm);
    96   return gc_data(nm)->lock();
   103   if (data == NULL) {
       
   104     return NULL;
       
   105   }
       
   106   return data->lock();
       
   107 }
    97 }
   108 
    98 
   109 void ZNMethod::log_register(const nmethod* nm) {
    99 void ZNMethod::log_register(const nmethod* nm) {
   110   LogTarget(Trace, gc, nmethod) log;
   100   LogTarget(Trace, gc, nmethod) log;
   111   if (!log.is_enabled()) {
   101   if (!log.is_enabled()) {
   188   ResourceMark rm;
   178   ResourceMark rm;
   189 
   179 
   190   log_unregister(nm);
   180   log_unregister(nm);
   191 
   181 
   192   ZNMethodTable::unregister_nmethod(nm);
   182   ZNMethodTable::unregister_nmethod(nm);
   193 
   183 }
   194   // Destroy and detach gc data
   184 
   195   detach_gc_data(nm);
   185 void ZNMethod::flush_nmethod(nmethod* nm) {
       
   186   // Destroy GC data
       
   187   delete gc_data(nm);
   196 }
   188 }
   197 
   189 
   198 void ZNMethod::disarm_nmethod(nmethod* nm) {
   190 void ZNMethod::disarm_nmethod(nmethod* nm) {
   199   BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
   191   BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
   200   if (bs != NULL) {
   192   if (bs != NULL) {