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         }
2868       } else {
2869         if (best == NULL || (osr->comp_level() > best->comp_level())) {
2870           if (osr->comp_level() == CompLevel_highest_tier) {
2871             // Found the best possible - return it.
2872             return osr;
2873           }
2874           best = osr;
2875         }
2876       }
2877     }
2878     osr = osr->osr_link();
2879   }
2880   if (best != NULL && best->comp_level() >= comp_level && match_level == false) {
2881     return best;




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,
2849                                            bool match_level, bool skip_marked) const {
2850   // This is a short non-blocking critical region, so the no safepoint check is ok.
2851   MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
2852   nmethod* osr = osr_nmethods_head();
2853   nmethod* best = NULL;
2854   while (osr != NULL) {
2855     assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
2856     // There can be a time when a c1 osr method exists but we are waiting
2857     // for a c2 version. When c2 completes its osr nmethod we will trash
2858     // the c1 version and only be able to find the c2 version. However
2859     // while we overflow in the c1 code at back branches we don't want to
2860     // try and switch to the same code as we are already running
2861 
2862     if (osr->method() == m && !(skip_marked && osr->is_marked_for_deoptimization()) &&
2863         (bci == InvocationEntryBci || osr->osr_entry_bci() == bci)) {
2864       if (match_level) {
2865         if (osr->comp_level() == comp_level) {
2866           // Found a match - return it.
2867           return osr;
2868         }
2869       } else {
2870         if (best == NULL || (osr->comp_level() > best->comp_level())) {
2871           if (osr->comp_level() == CompLevel_highest_tier) {
2872             // Found the best possible - return it.
2873             return osr;
2874           }
2875           best = osr;
2876         }
2877       }
2878     }
2879     osr = osr->osr_link();
2880   }
2881   if (best != NULL && best->comp_level() >= comp_level && match_level == false) {
2882     return best;


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