diff src/share/vm/runtime/simpleThresholdPolicy.cpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 468850e35e48
children
line wrap: on
line diff
--- a/src/share/vm/runtime/simpleThresholdPolicy.cpp	Tue Apr 07 11:20:51 2015 +0200
+++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp	Tue Apr 07 14:58:49 2015 +0200
@@ -196,7 +196,6 @@
     // Don't trigger other compiles in testing mode
     return NULL;
   }
-  nmethod *osr_nm = NULL;
 
   handle_counter_overflow(method());
   if (method() != inlinee()) {
@@ -210,14 +209,16 @@
   if (bci == InvocationEntryBci) {
     method_invocation_event(method, inlinee, comp_level, nm, thread);
   } else {
+    // method == inlinee if the event originated in the main method
     method_back_branch_event(method, inlinee, bci, comp_level, nm, thread);
-    // method == inlinee if the event originated in the main method
-    int highest_level = inlinee->highest_osr_comp_level();
-    if (highest_level > comp_level) {
-      osr_nm = inlinee->lookup_osr_nmethod_for(bci, highest_level, false);
+    // Check if event led to a higher level OSR compilation
+    nmethod* osr_nm = inlinee->lookup_osr_nmethod_for(bci, comp_level, false);
+    if (osr_nm != NULL && osr_nm->comp_level() > comp_level) {
+      // Perform OSR with new nmethod
+      return osr_nm;
     }
   }
-  return osr_nm;
+  return NULL;
 }
 
 // Check if the method can be compiled, change level if necessary
@@ -239,7 +240,7 @@
   if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) {
     return;
   }
-  if (!CompileBroker::compilation_is_in_queue(mh, bci)) {
+  if (!CompileBroker::compilation_is_in_queue(mh)) {
     if (PrintTieredEvents) {
       print_event(COMPILE, mh, mh, bci, level);
     }
@@ -378,7 +379,7 @@
 // Handle the invocation event.
 void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh,
                                               CompLevel level, nmethod* nm, JavaThread* thread) {
-  if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) {
+  if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
     CompLevel next_level = call_event(mh(), level);
     if (next_level != level) {
       compile(mh, InvocationEntryBci, next_level, thread);
@@ -391,8 +392,8 @@
 void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh,
                                                      int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
   // If the method is already compiling, quickly bail out.
-  if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, bci)) {
-    // Use loop event as an opportinity to also check there's been
+  if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
+    // Use loop event as an opportunity to also check there's been
     // enough calls.
     CompLevel cur_level = comp_level(mh());
     CompLevel next_level = call_event(mh(), cur_level);