Mercurial > hg > truffle
comparison src/share/vm/runtime/jniHandles.hpp @ 917:1760a1cbed36
6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
Summary: Refactor JNIHandles::checked_resolve_jmethod_id() into fast and paranoid parts.
Reviewed-by: never, alanb
author | dcubed |
---|---|
date | Tue, 11 Aug 2009 11:57:51 -0600 |
parents | a61af66fc99e |
children | 354d3184f6b2 d3562366cbfd |
comparison
equal
deleted
inserted
replaced
881:16c930df1e9b | 917:1760a1cbed36 |
---|---|
1 /* | 1 /* |
2 * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1998-2009 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. |
194 inline methodOop JNIHandles::resolve_jmethod_id(jmethodID mid) { | 194 inline methodOop JNIHandles::resolve_jmethod_id(jmethodID mid) { |
195 return (methodOop) resolve_non_null((jobject)mid); | 195 return (methodOop) resolve_non_null((jobject)mid); |
196 }; | 196 }; |
197 | 197 |
198 inline methodOop JNIHandles::checked_resolve_jmethod_id(jmethodID mid) { | 198 inline methodOop JNIHandles::checked_resolve_jmethod_id(jmethodID mid) { |
199 jobject handle = (jobject)mid; | 199 if (mid == NULL) { |
200 if (is_weak_global_handle(handle)) { | |
201 return (methodOop) resolve_non_null(handle); | |
202 } else { | |
203 return (methodOop) NULL; | 200 return (methodOop) NULL; |
204 } | 201 } |
202 | |
203 oop o = resolve_non_null((jobject) mid); | |
204 if (!o->is_method()) { | |
205 return (methodOop) NULL; | |
206 } | |
207 | |
208 return (methodOop) o; | |
205 }; | 209 }; |
206 | 210 |
207 | 211 |
208 inline void JNIHandles::destroy_local(jobject handle) { | 212 inline void JNIHandles::destroy_local(jobject handle) { |
209 if (handle != NULL) { | 213 if (handle != NULL) { |