This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Bug 9861 and Java 5 Generics
- From: Terry Laurenzo <tlaurenzo at gmail dot com>
- To: java at gcc dot gnu dot org
- Date: Wed, 17 Aug 2005 11:28:12 -0600
- Subject: Bug 9861 and Java 5 Generics
- References: <5652dcd50508170930187057cd@mail.gmail.com>
- Reply-to: tj at laurenzo dot org
Hi all,
I have spent the last few days working on a solution to this bug
which is keeping us from using classes created by a generics compiler
with GCJ. As noted in the comments, the fix does require an ABI
change because return types must be included in mangled Java names.
This is likely to cause a number of problems, not the least of which
is breaking binary compatibility (such as it is). Even so, some of us
need this support in a bad way and would probably be willing to use a
hacked up version of GCJ that is not wholly compatible with its
siblings in order to get it.
I wanted to ping this off of the list for feedback and/or
suggestions. To my knowledge, no one has produced a patch that
purports to fix this problem yet. I have outlined my work on my web
log: http://tjlaurenzo.blogspot.com/2005/08/adventures-with-java-5-and-gcj.html
In brief, here is what I did:
- Modified gcc/cp/mangle.c to emit the method return type if the
function declaration is part of a Java type.
- Modified gcc/java/mangle.c to emit the method return type for
non-constructors
- Modified gcc/java/builtins.c to comply with the modified
mangling technique
The patch on my weblog has these changes plus a couple others which
were needed to make the May 15th source drop compile for mingw.
This has been my first time working on the gcc source code, so don't
shoot me if I commited a mortal sin or messed up on the coding
conventions. If there is to be an official patch, I'll fix that stuff
before the time comes.
From my naive experience at this level with GCC, I anticipate a few
possible problem spots with this change:
- As mentioned before, binary compatibility suffers
- GDB may have issues and diagnostic messages that demangle the
name are incorrect. This may not be a problem as long as you're aware
of it, because the return type is mangled just prior to the first
argument. As a result, demangled names show the return type as the
first argument.
- Shared libraries get bigger (I don't have any numbers on that yet)
So, does anyone have any thoughts?
TJ Laurenzo