This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PR java/15001: Using JNI with interpreter and interface methods yields SIGSEGV
- From: Andrew Haley <aph at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Fri, 17 Dec 2004 15:13:28 +0000
- Subject: PR java/15001: Using JNI with interpreter and interface methods yields SIGSEGV
- References: <1102435824.8012.23.camel@sheol.homelinux.org><m3eki2cbii.fsf@localhost.localdomain><1102586332.8525.18.camel@sheol.homelinux.org><16824.32178.77006.920753@cuddles.cambridge.redhat.com><41B93BFB.40903@redhat.com><16825.42507.193107.497339@cuddles.cambridge.redhat.com>
Committed. See discussion in PR.
Andrew.
2004-12-10 Andrew Haley <aph@redhat.com>
PR java/15001
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Look up
abstract methods by name.
Index: java/lang/reflect/natMethod.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/reflect/natMethod.cc,v
retrieving revision 1.42
diff -p -2 -c -r1.42 natMethod.cc
*** java/lang/reflect/natMethod.cc 25 Nov 2004 03:47:05 -0000 1.42
--- java/lang/reflect/natMethod.cc 17 Dec 2004 15:10:32 -0000
*************** details. */
*** 31,34 ****
--- 31,35 ----
#include <java/lang/IllegalAccessException.h>
#include <java/lang/IllegalArgumentException.h>
+ #include <java/lang/IncompatibleClassChangeError.h>
#include <java/lang/NullPointerException.h>
#include <java/lang/ArrayIndexOutOfBoundsException.h>
*************** _Jv_CallAnyMethodA (jobject obj,
*** 481,485 ****
_Jv_VTable *vtable = *(_Jv_VTable **) obj;
if (iface == NULL)
! ncode = vtable->get_method (meth->index);
else
ncode = _Jv_LookupInterfaceMethodIdx (vtable->clas, iface,
--- 482,506 ----
_Jv_VTable *vtable = *(_Jv_VTable **) obj;
if (iface == NULL)
! {
! if (is_jni_call && Modifier::isAbstract (meth->accflags))
! {
! // With JNI we don't know if this is an interface call
! // or a call to an abstract method. Look up the method
! // by name, the slow way.
! _Jv_Method *concrete_meth
! = _Jv_LookupDeclaredMethod (vtable->clas,
! meth->name,
! meth->signature,
! NULL);
! if (concrete_meth == NULL
! || concrete_meth->ncode == NULL
! || Modifier::isAbstract(concrete_meth->accflags))
! throw new java::lang::IncompatibleClassChangeError
! (_Jv_GetMethodString (vtable->clas, meth->name));
! ncode = concrete_meth->ncode;
! }
! else
! ncode = vtable->get_method (meth->index);
! }
else
ncode = _Jv_LookupInterfaceMethodIdx (vtable->clas, iface,