hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 36802 18b1db5a7e70
parent 36300 5b47f168b948
child 36812 4f96f15e4a46
equal deleted inserted replaced
36800:37014ee7264c 36802:18b1db5a7e70
  2521       }
  2521       }
  2522     }
  2522     }
  2523   }
  2523   }
  2524 }
  2524 }
  2525 
  2525 
  2526 
  2526 // Remove osr nmethod from the list. Return true if found and removed.
  2527 void InstanceKlass::remove_osr_nmethod(nmethod* n) {
  2527 bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
  2528   // This is a short non-blocking critical region, so the no safepoint check is ok.
  2528   // This is a short non-blocking critical region, so the no safepoint check is ok.
  2529   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  2529   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  2530   assert(n->is_osr_method(), "wrong kind of nmethod");
  2530   assert(n->is_osr_method(), "wrong kind of nmethod");
  2531   nmethod* last = NULL;
  2531   nmethod* last = NULL;
  2532   nmethod* cur  = osr_nmethods_head();
  2532   nmethod* cur  = osr_nmethods_head();
  2533   int max_level = CompLevel_none;  // Find the max comp level excluding n
  2533   int max_level = CompLevel_none;  // Find the max comp level excluding n
  2534   Method* m = n->method();
  2534   Method* m = n->method();
  2535   // Search for match
  2535   // Search for match
       
  2536   bool found = false;
  2536   while(cur != NULL && cur != n) {
  2537   while(cur != NULL && cur != n) {
  2537     if (TieredCompilation && m == cur->method()) {
  2538     if (TieredCompilation && m == cur->method()) {
  2538       // Find max level before n
  2539       // Find max level before n
  2539       max_level = MAX2(max_level, cur->comp_level());
  2540       max_level = MAX2(max_level, cur->comp_level());
  2540     }
  2541     }
  2541     last = cur;
  2542     last = cur;
  2542     cur = cur->osr_link();
  2543     cur = cur->osr_link();
  2543   }
  2544   }
  2544   nmethod* next = NULL;
  2545   nmethod* next = NULL;
  2545   if (cur == n) {
  2546   if (cur == n) {
       
  2547     found = true;
  2546     next = cur->osr_link();
  2548     next = cur->osr_link();
  2547     if (last == NULL) {
  2549     if (last == NULL) {
  2548       // Remove first element
  2550       // Remove first element
  2549       set_osr_nmethods_head(next);
  2551       set_osr_nmethods_head(next);
  2550     } else {
  2552     } else {
  2561       }
  2563       }
  2562       cur = cur->osr_link();
  2564       cur = cur->osr_link();
  2563     }
  2565     }
  2564     m->set_highest_osr_comp_level(max_level);
  2566     m->set_highest_osr_comp_level(max_level);
  2565   }
  2567   }
       
  2568   return found;
  2566 }
  2569 }
  2567 
  2570 
  2568 int InstanceKlass::mark_osr_nmethods(const Method* m) {
  2571 int InstanceKlass::mark_osr_nmethods(const Method* m) {
  2569   // This is a short non-blocking critical region, so the no safepoint check is ok.
  2572   // This is a short non-blocking critical region, so the no safepoint check is ok.
  2570   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
  2573   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);