< prev index next >

src/share/vm/code/nmethod.cpp

Print this page




1117   }
1118 }
1119 
1120 void nmethod::log_state_change() const {
1121   if (LogCompilation) {
1122     if (xtty != NULL) {
1123       ttyLocker ttyl;  // keep the following output all in one block
1124       if (_state == unloaded) {
1125         xtty->begin_elem("make_unloaded thread='" UINTX_FORMAT "'",
1126                          os::current_thread_id());
1127       } else {
1128         xtty->begin_elem("make_not_entrant thread='" UINTX_FORMAT "'%s",
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.




1117   }
1118 }
1119 
1120 void nmethod::log_state_change() const {
1121   if (LogCompilation) {
1122     if (xtty != NULL) {
1123       ttyLocker ttyl;  // keep the following output all in one block
1124       if (_state == unloaded) {
1125         xtty->begin_elem("make_unloaded thread='" UINTX_FORMAT "'",
1126                          os::current_thread_id());
1127       } else {
1128         xtty->begin_elem("make_not_entrant thread='" UINTX_FORMAT "'%s",
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 
1138   const char *state_msg = _state == zombie ? "made zombie" : "made not entrant";
1139   CompileTask::print_ul(this, state_msg);
1140   if (PrintCompilation && _state != unloaded) {
1141     print_on(tty, state_msg);
1142   }
1143 }
1144 
1145 /**
1146  * Common functionality for both make_not_entrant and make_zombie
1147  */
1148 bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
1149   assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
1150   assert(!is_zombie(), "should not already be a zombie");
1151 
1152   // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
1153   nmethodLocker nml(this);
1154   methodHandle the_method(method());
1155   NoSafepointVerifier nsv;
1156 
1157   // during patching, depending on the nmethod state we must notify the GC that
1158   // code has been unloaded, unregistering it. We cannot do this right while
1159   // holding the Patching_lock because we need to use the CodeCache_lock. This
1160   // would be prone to deadlocks.
1161   // This flag is used to remember whether we need to later lock and unregister.


< prev index next >