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]

[Bug java/14296] 3.4 regression: Method.Invoke


I tried a number of fixes for this, but many of them had problems.  

For 3.4, we need a minimally invasive patch.  This one fixes the
specific problem and doesn't break anything else: we'll do something
better in the future.

Andrew.


2004-02-25  Andrew Haley  <aph@redhat.com>

	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Make sure
	we have a valid method index.

Index: java/lang/reflect/natMethod.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/reflect/natMethod.cc,v
retrieving revision 1.36
diff -u -r1.36 natMethod.cc
--- java/lang/reflect/natMethod.cc	30 Oct 2003 21:09:45 -0000	1.36
+++ java/lang/reflect/natMethod.cc	25 Feb 2004 15:28:10 -0000
@@ -466,7 +466,16 @@
 
   void *ncode;
 
-  if (is_virtual_call && ! Modifier::isFinal (meth->accflags))
+  // FIXME: If a vtable index is -1 at this point it is invalid, so we
+  // have to use the ncode.  
+  //
+  // This can happen because methods in final classes don't have
+  // vtable entries, but _Jv_isVirtualMethod() doesn't know that.  We
+  // could solve this problem by allocating a vtable index for methods
+  // in final classes.
+  if (is_virtual_call 
+      && ! Modifier::isFinal (meth->accflags)
+      && (_Jv_ushort)-1 != meth->index)
     {
       _Jv_VTable *vtable = *(_Jv_VTable **) obj;
       ncode = vtable->get_method (meth->index);

Andrew.


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