diff src/share/vm/opto/bytecodeInfo.cpp @ 3905:c26de9aef2ed

7071307: MethodHandle bimorphic inlining should consider the frequency Reviewed-by: twisti, roland, kvn, iveresov
author never
date Fri, 02 Sep 2011 20:58:21 -0700
parents a32de5085326
children f6f3bb0ee072
line wrap: on
line diff
--- a/src/share/vm/opto/bytecodeInfo.cpp	Fri Sep 02 04:28:59 2011 -0700
+++ b/src/share/vm/opto/bytecodeInfo.cpp	Fri Sep 02 20:58:21 2011 -0700
@@ -141,7 +141,21 @@
     assert(mha_profile, "must exist");
     CounterData* cd = mha_profile->as_CounterData();
     invoke_count = cd->count();
-    call_site_count = invoke_count;  // use the same value
+    if (invoke_count == 0) {
+      return "method handle not reached";
+    }
+
+    if (_caller_jvms != NULL && _caller_jvms->method() != NULL &&
+        _caller_jvms->method()->method_data() != NULL &&
+        !_caller_jvms->method()->method_data()->is_empty()) {
+      ciMethodData* mdo = _caller_jvms->method()->method_data();
+      ciProfileData* mha_profile = mdo->bci_to_data(_caller_jvms->bci());
+      assert(mha_profile, "must exist");
+      CounterData* cd = mha_profile->as_CounterData();
+      call_site_count = cd->count();
+    } else {
+      call_site_count = invoke_count;  // use the same value
+    }
   }
 
   assert(invoke_count != 0, "require invocation count greater than zero");