Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/jniHandles.hpp @ 1536:892898e961c5
Merge
author | dcubed |
---|---|
date | Mon, 17 May 2010 07:11:27 -0700 |
parents | 354d3184f6b2 d3562366cbfd |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
1534:7ccc203eb6ff | 1536:892898e961c5 |
---|---|
1 /* | 1 /* |
2 * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1998-2010 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
61 // never reclaimed. The methods to which they refer, however, can be GC'ed away if the class | 61 // never reclaimed. The methods to which they refer, however, can be GC'ed away if the class |
62 // is unloaded or if the method is made obsolete or deleted -- in these cases, the jmethodID | 62 // is unloaded or if the method is made obsolete or deleted -- in these cases, the jmethodID |
63 // refers to NULL (as is the case for any weak reference). | 63 // refers to NULL (as is the case for any weak reference). |
64 static jmethodID make_jmethod_id(methodHandle mh); | 64 static jmethodID make_jmethod_id(methodHandle mh); |
65 static void destroy_jmethod_id(jmethodID mid); | 65 static void destroy_jmethod_id(jmethodID mid); |
66 // Use resolve_jmethod_id() in situations where the caller is expected | |
67 // to provide a valid jmethodID; the only sanity checks are in asserts; | |
68 // result guaranteed not to be NULL. | |
66 inline static methodOop resolve_jmethod_id(jmethodID mid); | 69 inline static methodOop resolve_jmethod_id(jmethodID mid); |
67 inline static methodOop checked_resolve_jmethod_id(jmethodID mid); // NULL on invalid jmethodID | 70 // Use checked_resolve_jmethod_id() in situations where the caller |
71 // should provide a valid jmethodID, but might not. NULL is returned | |
72 // when the jmethodID does not refer to a valid method. | |
73 inline static methodOop checked_resolve_jmethod_id(jmethodID mid); | |
68 static void change_method_associated_with_jmethod_id(jmethodID jmid, methodHandle mh); | 74 static void change_method_associated_with_jmethod_id(jmethodID jmid, methodHandle mh); |
69 | 75 |
70 // Sentinel marking deleted handles in block. Note that we cannot store NULL as | 76 // Sentinel marking deleted handles in block. Note that we cannot store NULL as |
71 // the sentinel, since clearing weak global JNI refs are done by storing NULL in | 77 // the sentinel, since clearing weak global JNI refs are done by storing NULL in |
72 // the handle. The handle may not be reused before destroy_weak_global is called. | 78 // the handle. The handle may not be reused before destroy_weak_global is called. |
198 inline methodOop JNIHandles::resolve_jmethod_id(jmethodID mid) { | 204 inline methodOop JNIHandles::resolve_jmethod_id(jmethodID mid) { |
199 return (methodOop) resolve_non_null((jobject)mid); | 205 return (methodOop) resolve_non_null((jobject)mid); |
200 }; | 206 }; |
201 | 207 |
202 inline methodOop JNIHandles::checked_resolve_jmethod_id(jmethodID mid) { | 208 inline methodOop JNIHandles::checked_resolve_jmethod_id(jmethodID mid) { |
203 if (mid == NULL) { | 209 oop o = resolve_external_guard((jobject) mid); |
204 return (methodOop) NULL; | 210 if (o == NULL || !o->is_method()) { |
205 } | |
206 | |
207 oop o = resolve_non_null((jobject) mid); | |
208 if (!o->is_method()) { | |
209 return (methodOop) NULL; | 211 return (methodOop) NULL; |
210 } | 212 } |
211 | 213 |
212 return (methodOop) o; | 214 return (methodOop) o; |
213 }; | 215 }; |