hotspot/src/share/vm/code/nmethod.cpp
changeset 4564 55dfb20908d0
parent 4479 5686407cde7a
child 4567 7fc02fbe5c7a
--- a/hotspot/src/share/vm/code/nmethod.cpp	Mon Jan 04 07:04:46 2010 -0800
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Mon Jan 04 18:38:08 2010 +0100
@@ -1763,6 +1763,14 @@
          "must end with a sentinel");
 #endif //ASSERT
 
+  // Search for MethodHandle invokes and tag the nmethod.
+  for (int i = 0; i < count; i++) {
+    if (pcs[i].is_method_handle_invoke()) {
+      set_has_method_handle_invokes(true);
+      break;
+    }
+  }
+
   int size = count * sizeof(PcDesc);
   assert(scopes_pcs_size() >= size, "oob");
   memcpy(scopes_pcs_begin(), pcs, size);
@@ -2030,6 +2038,18 @@
 
 
 // -----------------------------------------------------------------------------
+// MethodHandle
+
+bool nmethod::is_method_handle_return(address return_pc) {
+  if (!has_method_handle_invokes())  return false;
+  PcDesc* pd = pc_desc_at(return_pc);
+  if (pd == NULL)
+    return false;
+  return pd->is_method_handle_invoke();
+}
+
+
+// -----------------------------------------------------------------------------
 // Verification
 
 class VerifyOopsClosure: public OopClosure {