src/share/vm/runtime/jniHandles.hpp

changeset 1890
d3562366cbfd
parent 1352
1760a1cbed36
child 1891
892898e961c5
     1.1 --- a/src/share/vm/runtime/jniHandles.hpp	Tue Aug 11 11:57:51 2009 -0600
     1.2 +++ b/src/share/vm/runtime/jniHandles.hpp	Mon May 17 06:35:51 2010 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * Copyright 1998-2010 Sun Microsystems, Inc.  All Rights Reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -63,8 +63,14 @@
    1.11    // refers to NULL (as is the case for any weak reference).
    1.12    static jmethodID make_jmethod_id(methodHandle mh);
    1.13    static void destroy_jmethod_id(jmethodID mid);
    1.14 +  // Use resolve_jmethod_id() in situations where the caller is expected
    1.15 +  // to provide a valid jmethodID; the only sanity checks are in asserts;
    1.16 +  // result guaranteed not to be NULL.
    1.17    inline static methodOop resolve_jmethod_id(jmethodID mid);
    1.18 -  inline static methodOop checked_resolve_jmethod_id(jmethodID mid); // NULL on invalid jmethodID
    1.19 +  // Use checked_resolve_jmethod_id() in situations where the caller
    1.20 +  // should provide a valid jmethodID, but might not. NULL is returned
    1.21 +  // when the jmethodID does not refer to a valid method.
    1.22 +  inline static methodOop checked_resolve_jmethod_id(jmethodID mid);
    1.23    static void change_method_associated_with_jmethod_id(jmethodID jmid, methodHandle mh);
    1.24  
    1.25    // Sentinel marking deleted handles in block. Note that we cannot store NULL as
    1.26 @@ -196,12 +202,8 @@
    1.27  };
    1.28  
    1.29  inline methodOop JNIHandles::checked_resolve_jmethod_id(jmethodID mid) {
    1.30 -  if (mid == NULL) {
    1.31 -    return (methodOop) NULL;
    1.32 -  }
    1.33 -
    1.34 -  oop o = resolve_non_null((jobject) mid);
    1.35 -  if (!o->is_method()) {
    1.36 +  oop o = resolve_external_guard((jobject) mid);
    1.37 +  if (o == NULL || !o->is_method()) {
    1.38      return (methodOop) NULL;
    1.39    }
    1.40  

mercurial