This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR java/15001: Using JNI with interpreter and interface methods yields SIGSEGV


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,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]