Print this page
rev 6867 : 8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method
Summary: Fixed Whitebox.deoptimizeMethod() to deoptimize all OSR versions of the method.
Reviewed-by: kvn, iignatyev

Split Split Close
Expand all
Collapse all
          --- old/src/share/vm/oops/instanceKlass.cpp
          +++ new/src/share/vm/oops/instanceKlass.cpp
↓ open down ↓ 2882 lines elided ↑ open up ↑
2883 2883          max_level = MAX2(max_level, cur->comp_level());
2884 2884        }
2885 2885        cur = cur->osr_link();
2886 2886      }
2887 2887      m->set_highest_osr_comp_level(max_level);
2888 2888    }
2889 2889    // Remember to unlock again
2890 2890    OsrList_lock->unlock();
2891 2891  }
2892 2892  
     2893 +int InstanceKlass::mark_osr_nmethods(const Method* m) {
     2894 +  // This is a short non-blocking critical region, so the no safepoint check is ok.
     2895 +  MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
     2896 +  nmethod* osr = osr_nmethods_head();
     2897 +  int found = 0;
     2898 +  while (osr != NULL) {
     2899 +    assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
     2900 +    if (osr->method() == m) {
     2901 +      osr->mark_for_deoptimization();
     2902 +      found++;
     2903 +    }
     2904 +    osr = osr->osr_link();
     2905 +  }
     2906 +  return found;
     2907 +}
     2908 +
2893 2909  nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_level, bool match_level) const {
2894 2910    // This is a short non-blocking critical region, so the no safepoint check is ok.
2895 2911    OsrList_lock->lock_without_safepoint_check();
2896 2912    nmethod* osr = osr_nmethods_head();
2897 2913    nmethod* best = NULL;
2898 2914    while (osr != NULL) {
2899 2915      assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
2900 2916      // There can be a time when a c1 osr method exists but we are waiting
2901 2917      // for a c2 version. When c2 completes its osr nmethod we will trash
2902 2918      // the c1 version and only be able to find the c2 version. However
↓ open down ↓ 902 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX