src/hotspot/share/code/nmethod.cpp
changeset 48007 ab3959df2115
parent 47794 e84aa2c71241
child 48167 f04a848c6f00
equal deleted inserted replaced
48006:e79838cf4613 48007:ab3959df2115
   384   return NULL;
   384   return NULL;
   385 }
   385 }
   386 
   386 
   387 // Fill in default values for various flag fields
   387 // Fill in default values for various flag fields
   388 void nmethod::init_defaults() {
   388 void nmethod::init_defaults() {
   389   _state                      = in_use;
   389   _state                      = not_installed;
   390   _has_flushed_dependencies   = 0;
   390   _has_flushed_dependencies   = 0;
   391   _lock_count                 = 0;
   391   _lock_count                 = 0;
   392   _stack_traversal_mark       = 0;
   392   _stack_traversal_mark       = 0;
   393   _unload_reported            = false; // jvmti state
   393   _unload_reported            = false; // jvmti state
   394   _is_far_code                = false; // nmethods are located in CodeCache
   394   _is_far_code                = false; // nmethods are located in CodeCache
   443 
   443 
   444   if (nm != NULL) {
   444   if (nm != NULL) {
   445     nm->log_new_nmethod();
   445     nm->log_new_nmethod();
   446   }
   446   }
   447 
   447 
       
   448   nm->make_in_use();
   448   return nm;
   449   return nm;
   449 }
   450 }
   450 
   451 
   451 nmethod* nmethod::new_nmethod(const methodHandle& method,
   452 nmethod* nmethod::new_nmethod(const methodHandle& method,
   452   int compile_id,
   453   int compile_id,
  1127 }
  1128 }
  1128 
  1129 
  1129 /**
  1130 /**
  1130  * Common functionality for both make_not_entrant and make_zombie
  1131  * Common functionality for both make_not_entrant and make_zombie
  1131  */
  1132  */
  1132 bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
  1133 bool nmethod::make_not_entrant_or_zombie(int state) {
  1133   assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
  1134   assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
  1134   assert(!is_zombie(), "should not already be a zombie");
  1135   assert(!is_zombie(), "should not already be a zombie");
  1135 
  1136 
  1136   if (_state == state) {
  1137   if (_state == state) {
  1137     // Avoid taking the lock if already in required state.
  1138     // Avoid taking the lock if already in required state.
  2095 }
  2096 }
  2096 
  2097 
  2097 
  2098 
  2098 void nmethod::verify_interrupt_point(address call_site) {
  2099 void nmethod::verify_interrupt_point(address call_site) {
  2099   // Verify IC only when nmethod installation is finished.
  2100   // Verify IC only when nmethod installation is finished.
  2100   bool is_installed = (method()->code() == this) // nmethod is in state 'in_use' and installed
  2101   if (!is_not_installed()) {
  2101                       || !this->is_in_use();     // nmethod is installed, but not in 'in_use' state
       
  2102   if (is_installed) {
       
  2103     Thread *cur = Thread::current();
  2102     Thread *cur = Thread::current();
  2104     if (CompiledIC_lock->owner() == cur ||
  2103     if (CompiledIC_lock->owner() == cur ||
  2105         ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) &&
  2104         ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) &&
  2106          SafepointSynchronize::is_at_safepoint())) {
  2105          SafepointSynchronize::is_at_safepoint())) {
  2107       CompiledIC_at(this, call_site);
  2106       CompiledIC_at(this, call_site);