src/hotspot/share/oops/instanceKlass.cpp
changeset 54623 1126f0607c70
parent 54437 2ae93028bef3
child 54736 1dc9bf9d016b
equal deleted inserted replaced
54622:a8dcacf95bff 54623:1126f0607c70
  2185 
  2185 
  2186 void InstanceKlass::clean_method_data() {
  2186 void InstanceKlass::clean_method_data() {
  2187   for (int m = 0; m < methods()->length(); m++) {
  2187   for (int m = 0; m < methods()->length(); m++) {
  2188     MethodData* mdo = methods()->at(m)->method_data();
  2188     MethodData* mdo = methods()->at(m)->method_data();
  2189     if (mdo != NULL) {
  2189     if (mdo != NULL) {
  2190       MutexLockerEx ml(SafepointSynchronize::is_at_safepoint() ? NULL : mdo->extra_data_lock());
  2190       MutexLocker ml(SafepointSynchronize::is_at_safepoint() ? NULL : mdo->extra_data_lock());
  2191       mdo->clean_method_data(/*always_clean*/false);
  2191       mdo->clean_method_data(/*always_clean*/false);
  2192     }
  2192     }
  2193   }
  2193   }
  2194 }
  2194 }
  2195 
  2195 
  2966 // On-stack replacement stuff
  2966 // On-stack replacement stuff
  2967 void InstanceKlass::add_osr_nmethod(nmethod* n) {
  2967 void InstanceKlass::add_osr_nmethod(nmethod* n) {
  2968   // only one compilation can be active
  2968   // only one compilation can be active
  2969   {
  2969   {
  2970     // This is a short non-blocking critical region, so the no safepoint check is ok.
  2970     // This is a short non-blocking critical region, so the no safepoint check is ok.
  2971     MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  2971     MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  2972     assert(n->is_osr_method(), "wrong kind of nmethod");
  2972     assert(n->is_osr_method(), "wrong kind of nmethod");
  2973     n->set_osr_link(osr_nmethods_head());
  2973     n->set_osr_link(osr_nmethods_head());
  2974     set_osr_nmethods_head(n);
  2974     set_osr_nmethods_head(n);
  2975     // Raise the highest osr level if necessary
  2975     // Raise the highest osr level if necessary
  2976     if (TieredCompilation) {
  2976     if (TieredCompilation) {
  2991 }
  2991 }
  2992 
  2992 
  2993 // Remove osr nmethod from the list. Return true if found and removed.
  2993 // Remove osr nmethod from the list. Return true if found and removed.
  2994 bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
  2994 bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
  2995   // This is a short non-blocking critical region, so the no safepoint check is ok.
  2995   // This is a short non-blocking critical region, so the no safepoint check is ok.
  2996   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  2996   MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  2997   assert(n->is_osr_method(), "wrong kind of nmethod");
  2997   assert(n->is_osr_method(), "wrong kind of nmethod");
  2998   nmethod* last = NULL;
  2998   nmethod* last = NULL;
  2999   nmethod* cur  = osr_nmethods_head();
  2999   nmethod* cur  = osr_nmethods_head();
  3000   int max_level = CompLevel_none;  // Find the max comp level excluding n
  3000   int max_level = CompLevel_none;  // Find the max comp level excluding n
  3001   Method* m = n->method();
  3001   Method* m = n->method();
  3035   return found;
  3035   return found;
  3036 }
  3036 }
  3037 
  3037 
  3038 int InstanceKlass::mark_osr_nmethods(const Method* m) {
  3038 int InstanceKlass::mark_osr_nmethods(const Method* m) {
  3039   // This is a short non-blocking critical region, so the no safepoint check is ok.
  3039   // This is a short non-blocking critical region, so the no safepoint check is ok.
  3040   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  3040   MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  3041   nmethod* osr = osr_nmethods_head();
  3041   nmethod* osr = osr_nmethods_head();
  3042   int found = 0;
  3042   int found = 0;
  3043   while (osr != NULL) {
  3043   while (osr != NULL) {
  3044     assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
  3044     assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
  3045     if (osr->method() == m) {
  3045     if (osr->method() == m) {
  3051   return found;
  3051   return found;
  3052 }
  3052 }
  3053 
  3053 
  3054 nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_level, bool match_level) const {
  3054 nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_level, bool match_level) const {
  3055   // This is a short non-blocking critical region, so the no safepoint check is ok.
  3055   // This is a short non-blocking critical region, so the no safepoint check is ok.
  3056   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  3056   MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  3057   nmethod* osr = osr_nmethods_head();
  3057   nmethod* osr = osr_nmethods_head();
  3058   nmethod* best = NULL;
  3058   nmethod* best = NULL;
  3059   while (osr != NULL) {
  3059   while (osr != NULL) {
  3060     assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
  3060     assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
  3061     // There can be a time when a c1 osr method exists but we are waiting
  3061     // There can be a time when a c1 osr method exists but we are waiting