This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: strip abstract methods in C++ ABI
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 24 Mar 2005 10:03:33 -0700
- Subject: [gcjx] Patch: FYI: strip abstract methods in C++ ABI
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
It turns out we need to strip abstract methods in the C++ ABI. The
reason for this is that the phony abstract method might wrap a final
method from Object, and we have a special case for those -- they use
direct dispatch, not virtual dispatch.
This happens in libjava, the case is calling getClass() via an
interface.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* abi.cc (build_method_call): Strip abstract methods.
Index: abi.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/abi.cc,v
retrieving revision 1.1.2.16
diff -u -r1.1.2.16 abi.cc
--- abi.cc 24 Mar 2005 02:17:38 -0000 1.1.2.16
+++ abi.cc 24 Mar 2005 17:04:33 -0000
@@ -44,6 +44,17 @@
assert (! meth->static_initializer_p ());
tree meth_tree = builtins->map_method (meth);
+ // An abstract method can itself be derived from an abstract method.
+ // We strip them all off to get the method as actually declared. We
+ // have to do this here because the abstract method might wrap a
+ // 'final' method from Object, and we use a different invocation
+ // mode for those.
+ while (dynamic_cast<model_abstract_method *> (meth))
+ {
+ model_abstract_method *mam = assert_cast<model_abstract_method *> (meth);
+ meth = mam->get_original ();
+ }
+
tree func;
if (meth->static_p ())
{