src/share/vm/oops/instanceKlass.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/oops

src/share/vm/oops/instanceKlass.cpp

Print this page




2828       // Remove first element
2829       set_osr_nmethods_head(next);
2830     } else {
2831       last->set_osr_link(next);
2832     }
2833   }
2834   n->set_osr_link(NULL);
2835   if (TieredCompilation) {
2836     cur = next;
2837     while (cur != NULL) {
2838       // Find max level after n
2839       if (m == cur->method()) {
2840         max_level = MAX2(max_level, cur->comp_level());
2841       }
2842       cur = cur->osr_link();
2843     }
2844     m->set_highest_osr_comp_level(max_level);
2845   }
2846 }
2847 
















2848 nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_level, bool match_level) const {
2849   // This is a short non-blocking critical region, so the no safepoint check is ok.
2850   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
2851   nmethod* osr = osr_nmethods_head();
2852   nmethod* best = NULL;
2853   while (osr != NULL) {
2854     assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
2855     // There can be a time when a c1 osr method exists but we are waiting
2856     // for a c2 version. When c2 completes its osr nmethod we will trash
2857     // the c1 version and only be able to find the c2 version. However
2858     // while we overflow in the c1 code at back branches we don't want to
2859     // try and switch to the same code as we are already running
2860 
2861     if (osr->method() == m &&
2862         (bci == InvocationEntryBci || osr->osr_entry_bci() == bci)) {
2863       if (match_level) {
2864         if (osr->comp_level() == comp_level) {
2865           // Found a match - return it.
2866           return osr;
2867         }




2828       // Remove first element
2829       set_osr_nmethods_head(next);
2830     } else {
2831       last->set_osr_link(next);
2832     }
2833   }
2834   n->set_osr_link(NULL);
2835   if (TieredCompilation) {
2836     cur = next;
2837     while (cur != NULL) {
2838       // Find max level after n
2839       if (m == cur->method()) {
2840         max_level = MAX2(max_level, cur->comp_level());
2841       }
2842       cur = cur->osr_link();
2843     }
2844     m->set_highest_osr_comp_level(max_level);
2845   }
2846 }
2847 
2848 int InstanceKlass::mark_osr_nmethods(const Method* m) {
2849   // This is a short non-blocking critical region, so the no safepoint check is ok.
2850   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
2851   nmethod* osr = osr_nmethods_head();
2852   int found = 0;
2853   while (osr != NULL) {
2854     assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
2855     if (osr->method() == m) {
2856       osr->mark_for_deoptimization();
2857       found++;
2858     }
2859     osr = osr->osr_link();
2860   }
2861   return found;
2862 }
2863 
2864 nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_level, bool match_level) const {
2865   // This is a short non-blocking critical region, so the no safepoint check is ok.
2866   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
2867   nmethod* osr = osr_nmethods_head();
2868   nmethod* best = NULL;
2869   while (osr != NULL) {
2870     assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
2871     // There can be a time when a c1 osr method exists but we are waiting
2872     // for a c2 version. When c2 completes its osr nmethod we will trash
2873     // the c1 version and only be able to find the c2 version. However
2874     // while we overflow in the c1 code at back branches we don't want to
2875     // try and switch to the same code as we are already running
2876 
2877     if (osr->method() == m &&
2878         (bci == InvocationEntryBci || osr->osr_entry_bci() == bci)) {
2879       if (match_level) {
2880         if (osr->comp_level() == comp_level) {
2881           // Found a match - return it.
2882           return osr;
2883         }


src/share/vm/oops/instanceKlass.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File