This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Java name-mangling
Mark Mitchell <mark@codesourcery.com> writes:
> I think I misunderstood the interfaces point. I thought that Java
> (via CNI) actually wanted to be able to implement a Java class
> implementing an interface as a C++ class derived from a virtual base.
Well, ideally we would like to. What we *need* to is implement a Java
class implementing an interface as a C++ class singly derived
from a non-virtual base. It would be nice if C++ could know
about the implemented Java interfaces, and treat them as virtual
bases classes using a different ABI than the normal one. However,
at this point that seems to be more pain that it is worth.
> If that were so, then the Java front-end would have to expect the
> layout of the C++ object to match its own layout of the same class if
> it were written entire in Java.
Yes, but only single non-virtual inheritance is important.
What we should make sure is that the ABI Java uses for interfaces
does not *conflict* with the C++ ABI. I don't think is a problem.
> If, however, you're not going to actually implement Java classes
> implementing interfaces by coding them as C++ classes deriving from
> virtual bases, then this matters not at all.
No we're not. As I said, I don't think we can.
> As long as the only compatibility has to be with C++ classes using
> single non-virtual inheritance, there shouldn't be any unduly severe
> problems. Vptrs in the class are now located in a different place,
> and the contents of the vtable are slightly different: the RTTI and
> offset-to-top fields are at negative offsets from the point where the
> vptr points.
That doesn't sound difficult.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/