diff options
author | Tom Tromey <tromey@redhat.com> | 2001-03-23 19:15:44 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-03-23 19:15:44 +0000 |
commit | 83c64db681317c28239f07c5a8e6bb201834f0ba (patch) | |
tree | 28774e5e29803dc3ce69073c0dcf0c60c43a6982 /libjava/jni.cc | |
parent | e9f4fa71431e33e47b1eab017ee03f937e27b058 (diff) | |
download | gcc-83c64db681317c28239f07c5a8e6bb201834f0ba.zip gcc-83c64db681317c28239f07c5a8e6bb201834f0ba.tar.gz gcc-83c64db681317c28239f07c5a8e6bb201834f0ba.tar.bz2 |
jni.cc (_Jv_JNI_GetAnyFieldID): Handle unresolved fields.
* jni.cc (_Jv_JNI_GetAnyFieldID): Handle unresolved fields.
* java/lang/reflect/natField.cc (getType): Use _Jv_ResolveField
unconditionally.
* include/jvm.h (_Jv_ResolveField): Declare.
* include/java-interp.h (_Jv_ResolveField): Don't declare.
* resolve.cc (_Jv_ResolveField): No longer conditional on
INTERPRETER.
From-SVN: r40785
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r-- | libjava/jni.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc index a4a12a8..7b682f1 100644 --- a/libjava/jni.cc +++ b/libjava/jni.cc @@ -1068,8 +1068,13 @@ _Jv_JNI_GetAnyFieldID (JNIEnv *env, jclass clazz, // FIXME: what if field_class == NULL? + java::lang::ClassLoader *loader = clazz->getClassLoader (); while (clazz != NULL) { + // We acquire the class lock so that fields aren't resolved + // while we are running. + JvSynchronize sync (clazz); + jint count = (is_static ? JvNumStaticFields (clazz) : JvNumInstanceFields (clazz)); @@ -1078,12 +1083,11 @@ _Jv_JNI_GetAnyFieldID (JNIEnv *env, jclass clazz, : JvGetFirstInstanceField (clazz)); for (jint i = 0; i < count; ++i) { - // The field is resolved as a side effect of class - // initialization. - JvAssert (field->isResolved ()); - _Jv_Utf8Const *f_name = field->getNameUtf8Const(clazz); + // The field might be resolved or it might not be. It + // is much simpler to always resolve it. + _Jv_ResolveField (field, loader); if (_Jv_equalUtf8Consts (f_name, a_name) && field->getClass() == field_class) return field; |