[gcjx] Patch: FYI: vtable layout fix

Tom Tromey tromey@redhat.com
Mon Jan 31 01:13:00 GMT 2005


I'm checking this in on the gcjx branch.

I forgot that constructors and private methods don't belong in the
vtable.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* aot/aotclass.cc (lay_out_vtable): Skip constructors and private
	methods.

Index: aot/aotclass.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcjx/aot/Attic/aotclass.cc,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 aotclass.cc
--- aot/aotclass.cc 31 Jan 2005 00:53:51 -0000 1.1.2.2
+++ aot/aotclass.cc 31 Jan 2005 01:09:22 -0000
@@ -47,7 +47,13 @@
        i != klass->end_all_methods ();
        ++i)
     {
-      if ((*i)->static_p ())
+      // Static methods, private methods, and constructors do not
+      // appear in the vtable.  Note that final methods must appear
+      // there, because they can be called using the vtable via
+      // reflection.
+      if ((*i)->static_p ()
+	  || (*i)->constructor_p ()
+	  || ((*i)->get_modifiers () & ACC_PRIVATE) != 0)
 	continue;
 
       model_class *declaring_class = (*i)->get_declaring_class ();



More information about the Java-patches mailing list