src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/code

src/share/vm/code/nmethod.cpp

Print this page




1129                          os::current_thread_id(),
1130                          (_state == zombie ? " zombie='1'" : ""));
1131       }
1132       log_identity(xtty);
1133       xtty->stamp();
1134       xtty->end_elem();
1135     }
1136   }
1137   if (PrintCompilation && _state != unloaded) {
1138     print_on(tty, _state == zombie ? "made zombie" : "made not entrant");
1139   }
1140 }
1141 
1142 /**
1143  * Common functionality for both make_not_entrant and make_zombie
1144  */
1145 bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
1146   assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
1147   assert(!is_zombie(), "should not already be a zombie");
1148 








1149   // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
1150   nmethodLocker nml(this);
1151   methodHandle the_method(method());
1152   NoSafepointVerifier nsv;
1153 
1154   // during patching, depending on the nmethod state we must notify the GC that
1155   // code has been unloaded, unregistering it. We cannot do this right while
1156   // holding the Patching_lock because we need to use the CodeCache_lock. This
1157   // would be prone to deadlocks.
1158   // This flag is used to remember whether we need to later lock and unregister.
1159   bool nmethod_needs_unregister = false;
1160 
1161   {
1162     // invalidate osr nmethod before acquiring the patching lock since
1163     // they both acquire leaf locks and we don't want a deadlock.
1164     // This logic is equivalent to the logic below for patching the
1165     // verified entry point of regular methods. We check that the
1166     // nmethod is in use to ensure that it is invalidated only once.
1167     if (is_osr_method() && is_in_use()) {
1168       // this effectively makes the osr nmethod not entrant




1129                          os::current_thread_id(),
1130                          (_state == zombie ? " zombie='1'" : ""));
1131       }
1132       log_identity(xtty);
1133       xtty->stamp();
1134       xtty->end_elem();
1135     }
1136   }
1137   if (PrintCompilation && _state != unloaded) {
1138     print_on(tty, _state == zombie ? "made zombie" : "made not entrant");
1139   }
1140 }
1141 
1142 /**
1143  * Common functionality for both make_not_entrant and make_zombie
1144  */
1145 bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
1146   assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
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   }
1156 
1157   // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
1158   nmethodLocker nml(this);
1159   methodHandle the_method(method());
1160   NoSafepointVerifier nsv;
1161 
1162   // during patching, depending on the nmethod state we must notify the GC that
1163   // code has been unloaded, unregistering it. We cannot do this right while
1164   // holding the Patching_lock because we need to use the CodeCache_lock. This
1165   // would be prone to deadlocks.
1166   // This flag is used to remember whether we need to later lock and unregister.
1167   bool nmethod_needs_unregister = false;
1168 
1169   {
1170     // invalidate osr nmethod before acquiring the patching lock since
1171     // they both acquire leaf locks and we don't want a deadlock.
1172     // This logic is equivalent to the logic below for patching the
1173     // verified entry point of regular methods. We check that the
1174     // nmethod is in use to ensure that it is invalidated only once.
1175     if (is_osr_method() && is_in_use()) {
1176       // this effectively makes the osr nmethod not entrant


src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File