hotspot/src/share/vm/code/nmethod.cpp
changeset 43675 a2b322083029
parent 42650 1f304d0c888b
child 46289 1904e7ec236e
equal deleted inserted replaced
43674:5d984252fc26 43675:a2b322083029
  1143  * Common functionality for both make_not_entrant and make_zombie
  1143  * Common functionality for both make_not_entrant and make_zombie
  1144  */
  1144  */
  1145 bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
  1145 bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
  1146   assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
  1146   assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
  1147   assert(!is_zombie(), "should not already be a zombie");
  1147   assert(!is_zombie(), "should not already be a zombie");
       
  1148 
       
  1149   if (_state == state) {
       
  1150     // Avoid taking the lock if already in required state.
       
  1151     // This is safe from races because the state is an end-state,
       
  1152     // which the nmethod cannot back out of once entered.
       
  1153     // No need for fencing either.
       
  1154     return false;
       
  1155   }
  1148 
  1156 
  1149   // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
  1157   // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
  1150   nmethodLocker nml(this);
  1158   nmethodLocker nml(this);
  1151   methodHandle the_method(method());
  1159   methodHandle the_method(method());
  1152   NoSafepointVerifier nsv;
  1160   NoSafepointVerifier nsv;