[multiple changes]
2007-07-13 Andrew Haley <aph@redhat.com> * libgcj.ver: Add __gcj_personality_sj0. * testsuite/libjava.jvmti/jvmti-interp.exp: Likewise. * testsuite/libjava.jni/jni.exp: Use -fdollars-in-identifiers. * testsuite/libjava.jni/cni.exp: Use -fdollars-in-identifiers. * testsuite/libjava.jvmti/jvmti.exp (gcj_jvmti_compile_cxx_to_o): Likewise. * gnu/classpath/natVMStackWalker.cc (getCallingClassLoader): Check klass is non-null. * java/lang/reflect/natField.cc (getAddr): Call _Jv_StackTrace::GetCallingClass only if CALLER is non-null. * java/lang/reflect/natVMProxy.cc (run_proxy): Use _Jv_getFieldInternal to get field proxyClass.m. (_Jv_getFieldInternal): New function. 2007-07-11 Andrew Haley <aph@redhat.com> * configure.host (arm*-linux-gnu): New. * sysdep/arm/locks.h: New. From-SVN: r126622
This commit is contained in:
parent
2b2271f8f0
commit
976731ee6e
13 changed files with 139 additions and 17 deletions
|
@ -12,6 +12,7 @@
|
|||
|
||||
jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *);
|
||||
jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv*, jclass, jfieldID, jboolean);
|
||||
jobject _Jv_getFieldInternal (java::lang::reflect::Field *f, jclass c, jobject o);
|
||||
|
||||
class java::lang::reflect::Field : public ::java::lang::reflect::AccessibleObject
|
||||
{
|
||||
|
@ -91,6 +92,7 @@ public:
|
|||
friend jfieldID (::_Jv_FromReflectedField) (java::lang::reflect::Field *);
|
||||
friend jobject (::_Jv_JNI_ToReflectedField) (_Jv_JNIEnv*, jclass, jfieldID, jboolean);
|
||||
friend class java::lang::Class;
|
||||
friend jobject (::_Jv_getFieldInternal) (java::lang::reflect::Field *f, jclass c, jobject o);
|
||||
};
|
||||
|
||||
#endif // __java_lang_reflect_Field__
|
||||
|
|
|
@ -74,11 +74,6 @@ static void*
|
|||
getAddr (java::lang::reflect::Field* field, jclass caller, jobject obj,
|
||||
jboolean checkFinal)
|
||||
{
|
||||
// FIXME: we know CALLER is NULL here. At one point we planned to
|
||||
// have the compiler insert the caller as a hidden argument in some
|
||||
// calls. However, we never implemented that, so we have to find
|
||||
// the caller by hand instead.
|
||||
|
||||
using namespace java::lang::reflect;
|
||||
|
||||
jfieldID fld = _Jv_FromReflectedField (field);
|
||||
|
@ -97,7 +92,8 @@ getAddr (java::lang::reflect::Field* field, jclass caller, jobject obj,
|
|||
// Check accessibility, if required.
|
||||
if (! (Modifier::isPublic (flags) || field->isAccessible()))
|
||||
{
|
||||
caller = _Jv_StackTrace::GetCallingClass (&Field::class$);
|
||||
if (! caller)
|
||||
caller = _Jv_StackTrace::GetCallingClass (&Field::class$);
|
||||
if (! _Jv_CheckAccess (caller, field->getDeclaringClass(), flags))
|
||||
throw new java::lang::IllegalAccessException;
|
||||
}
|
||||
|
|
|
@ -299,6 +299,15 @@ unbox (jobject o, jclass klass, void *rvalue, FFI_TYPE type)
|
|||
JvFail ("Bad ffi type in proxy");
|
||||
}
|
||||
|
||||
// _Jv_getFieldInternal is declared as a friend of reflect.Field in
|
||||
// libjava/headers.txt. This gives us a way to call the private
|
||||
// method Field.get (Class caller, Object obj).
|
||||
extern inline jobject
|
||||
_Jv_getFieldInternal (java::lang::reflect::Field *f, jclass c, jobject o)
|
||||
{
|
||||
return f->get(c, o);
|
||||
}
|
||||
|
||||
// run_proxy is the entry point for all proxy methods. It boxes up
|
||||
// all the arguments and then invokes the invocation handler's invoke()
|
||||
// method. Exceptions are caught and propagated.
|
||||
|
@ -340,7 +349,8 @@ run_proxy (ffi_cif *cif,
|
|||
// difference. We'd still have to save the method array because
|
||||
// ncode structs are not scanned by the gc.
|
||||
Field *f = proxyClass->getDeclaredField (JvNewStringLatin1 ("m"));
|
||||
JArray<Method*> *methods = (JArray<Method*>*)f->get (NULL);
|
||||
JArray<Method*> *methods
|
||||
= (JArray<Method*>*)_Jv_getFieldInternal (f, proxyClass, NULL);
|
||||
Method *meth = elements(methods)[self->method_index];
|
||||
|
||||
JArray<jclass> *parameter_types = meth->internalGetParameterTypes ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue