--- a/hotspot/src/share/vm/ci/ciMethod.cpp Tue Jun 01 11:48:33 2010 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp Wed Jun 02 22:45:42 2010 -0700
@@ -690,20 +690,32 @@
// ------------------------------------------------------------------
// invokedynamic support
+
+// ------------------------------------------------------------------
+// ciMethod::is_method_handle_invoke
//
+// Return true if the method is a MethodHandle target.
bool ciMethod::is_method_handle_invoke() const {
- check_is_loaded();
- bool flag = ((flags().as_int() & JVM_MH_INVOKE_BITS) == JVM_MH_INVOKE_BITS);
+ bool flag = (holder()->name() == ciSymbol::java_dyn_MethodHandle() &&
+ methodOopDesc::is_method_handle_invoke_name(name()->sid()));
#ifdef ASSERT
- {
- VM_ENTRY_MARK;
- bool flag2 = get_methodOop()->is_method_handle_invoke();
- assert(flag == flag2, "consistent");
+ if (is_loaded()) {
+ bool flag2 = ((flags().as_int() & JVM_MH_INVOKE_BITS) == JVM_MH_INVOKE_BITS);
+ {
+ VM_ENTRY_MARK;
+ bool flag3 = get_methodOop()->is_method_handle_invoke();
+ assert(flag2 == flag3, "consistent");
+ assert(flag == flag3, "consistent");
+ }
}
#endif //ASSERT
return flag;
}
+// ------------------------------------------------------------------
+// ciMethod::is_method_handle_adapter
+//
+// Return true if the method is a generated MethodHandle adapter.
bool ciMethod::is_method_handle_adapter() const {
check_is_loaded();
VM_ENTRY_MARK;