changeset 1455:d3562366cbfd

6949515: 3/3 VM crash when calling GetMethodDeclaringClass Summary: Use resolve_external_guard() instead of resolve_non_null(). Reviewed-by: thurka, kamg, acorn
author dcubed
date Mon, 17 May 2010 06:35:51 -0700
parents 1760a1cbed36
children 892898e961c5
files src/share/vm/runtime/jniHandles.hpp
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/jniHandles.hpp	Tue Aug 11 11:57:51 2009 -0600
+++ b/src/share/vm/runtime/jniHandles.hpp	Mon May 17 06:35:51 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,8 +63,14 @@
   // refers to NULL (as is the case for any weak reference).
   static jmethodID make_jmethod_id(methodHandle mh);
   static void destroy_jmethod_id(jmethodID mid);
+  // Use resolve_jmethod_id() in situations where the caller is expected
+  // to provide a valid jmethodID; the only sanity checks are in asserts;
+  // result guaranteed not to be NULL.
   inline static methodOop resolve_jmethod_id(jmethodID mid);
-  inline static methodOop checked_resolve_jmethod_id(jmethodID mid); // NULL on invalid jmethodID
+  // Use checked_resolve_jmethod_id() in situations where the caller
+  // should provide a valid jmethodID, but might not. NULL is returned
+  // when the jmethodID does not refer to a valid method.
+  inline static methodOop checked_resolve_jmethod_id(jmethodID mid);
   static void change_method_associated_with_jmethod_id(jmethodID jmid, methodHandle mh);
 
   // Sentinel marking deleted handles in block. Note that we cannot store NULL as
@@ -196,12 +202,8 @@
 };
 
 inline methodOop JNIHandles::checked_resolve_jmethod_id(jmethodID mid) {
-  if (mid == NULL) {
-    return (methodOop) NULL;
-  }
-
-  oop o = resolve_non_null((jobject) mid);
-  if (!o->is_method()) {
+  oop o = resolve_external_guard((jobject) mid);
+  if (o == NULL || !o->is_method()) {
     return (methodOop) NULL;
   }