< prev index next >

src/share/vm/code/nmethod.cpp

Print this page
rev 13523 : [mq]: 8186837


1203 
1204     if (is_in_use() && update_recompile_counts()) {
1205       // It's a true state change, so mark the method as decompiled.
1206       // Do it only for transition from alive.
1207       inc_decompile_count();
1208     }
1209 
1210     // If the state is becoming a zombie, signal to unregister the nmethod with
1211     // the heap.
1212     // This nmethod may have already been unloaded during a full GC.
1213     if ((state == zombie) && !is_unloaded()) {
1214       nmethod_needs_unregister = true;
1215     }
1216 
1217     // Must happen before state change. Otherwise we have a race condition in
1218     // nmethod::can_not_entrant_be_converted(). I.e., a method can immediately
1219     // transition its state from 'not_entrant' to 'zombie' without having to wait
1220     // for stack scanning.
1221     if (state == not_entrant) {
1222       mark_as_seen_on_stack();
1223       OrderAccess::storestore();
1224     }
1225 
1226     // Change state
1227     _state = state;
1228 
1229     // Log the transition once
1230     log_state_change();
1231 
1232     // Invalidate while holding the patching lock
1233     JVMCI_ONLY(maybe_invalidate_installed_code());
1234 
1235     // Remove nmethod from method.
1236     // We need to check if both the _code and _from_compiled_code_entry_point
1237     // refer to this nmethod because there is a race in setting these two fields
1238     // in Method* as seen in bugid 4947125.
1239     // If the vep() points to the zombie nmethod, the memory for the nmethod
1240     // could be flushed and the compiler and vtable stubs could still call
1241     // through it.
1242     if (method() != NULL && (method()->code() == this ||
1243                              method()->from_compiled_entry() == verified_entry_point())) {




1203 
1204     if (is_in_use() && update_recompile_counts()) {
1205       // It's a true state change, so mark the method as decompiled.
1206       // Do it only for transition from alive.
1207       inc_decompile_count();
1208     }
1209 
1210     // If the state is becoming a zombie, signal to unregister the nmethod with
1211     // the heap.
1212     // This nmethod may have already been unloaded during a full GC.
1213     if ((state == zombie) && !is_unloaded()) {
1214       nmethod_needs_unregister = true;
1215     }
1216 
1217     // Must happen before state change. Otherwise we have a race condition in
1218     // nmethod::can_not_entrant_be_converted(). I.e., a method can immediately
1219     // transition its state from 'not_entrant' to 'zombie' without having to wait
1220     // for stack scanning.
1221     if (state == not_entrant) {
1222       mark_as_seen_on_stack();
1223       OrderAccess::storestore(); // _stack_traversal_mark and _state
1224     }
1225 
1226     // Change state
1227     _state = state;
1228 
1229     // Log the transition once
1230     log_state_change();
1231 
1232     // Invalidate while holding the patching lock
1233     JVMCI_ONLY(maybe_invalidate_installed_code());
1234 
1235     // Remove nmethod from method.
1236     // We need to check if both the _code and _from_compiled_code_entry_point
1237     // refer to this nmethod because there is a race in setting these two fields
1238     // in Method* as seen in bugid 4947125.
1239     // If the vep() points to the zombie nmethod, the memory for the nmethod
1240     // could be flushed and the compiler and vtable stubs could still call
1241     // through it.
1242     if (method() != NULL && (method()->code() == this ||
1243                              method()->from_compiled_entry() == verified_entry_point())) {


< prev index next >