Java name-mangling

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat Jun 10 00:36:00 GMT 2000


> I did a nm -u mangle.o, and the list was actually quite short, once
> you subtract out functions and variables not c++ specific.

I don't think that would work: cp/mangle.c looks at
DECL_LANG_SPECIFIC, and certainly finds something different from what
it expects inside jc1. Moving this strategy up to the source level
(i.e. also provide different versions of the macros) might work,
though.

> Java uses tables to allow constant-time interface calls, without
> adjusting the this pointer.  I've mentioned this here before, and
> also the possibility that C++ could possibly use the same algorithm
> for the special case of no-field abstract virtual bases.

g++ is moving in the opposite direction: There is a new standard ABI,
and it just doesn't use that strategy. It also has a special case for
"nearly empty bases" - but it is a different strategy, and
incompatible with the one you propose.

> The Java algorithm is slightly slower than the traditional C++
> implementation, but you don't need extra per-object vbase pointers
> or extra vtables, and you don't need to adjust the this pointer.

In the new ABI, you don't have vbase pointers; you still have to
adjust the this pointer, which is done in thunks (ideally a kind of
thunks that immediately precedes the function being called, i.e. it is
an alternate entry point).

Regards,
Martin


More information about the Gcc mailing list