src/hotspot/share/code/compiledMethod.cpp
changeset 51591 9183040e34d8
parent 51333 f6641fcf7b7e
child 52384 d6dc479bcdd3
equal deleted inserted replaced
51590:3aaf039a3636 51591:9183040e34d8
   617     default:
   617     default:
   618       break;
   618       break;
   619     }
   619     }
   620   }
   620   }
   621 }
   621 }
       
   622 
       
   623 // Iterating over all nmethods, e.g. with the help of CodeCache::nmethods_do(fun) was found
       
   624 // to not be inherently safe. There is a chance that fields are seen which are not properly
       
   625 // initialized. This happens despite the fact that nmethods_do() asserts the CodeCache_lock
       
   626 // to be held.
       
   627 // To bundle knowledge about necessary checks in one place, this function was introduced.
       
   628 // It is not claimed that these checks are sufficient, but they were found to be necessary.
       
   629 bool CompiledMethod::nmethod_access_is_safe(nmethod* nm) {
       
   630   Method* method = (nm == NULL) ? NULL : nm->method();  // nm->method() may be uninitialized, i.e. != NULL, but invalid
       
   631   return (nm != NULL) && (method != NULL) && (method->signature() != NULL) &&
       
   632          !nm->is_zombie() && !nm->is_not_installed() &&
       
   633          os::is_readable_pointer(method) &&
       
   634          os::is_readable_pointer(method->constants()) &&
       
   635          os::is_readable_pointer(method->signature());
       
   636 }