This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: patch to bring java vtables closer to g++ abi conformance
Bryce McKinlay wrote:
> For binary compatibility, A.depth isn't known at compile time, because
> inserting new superclasses is an allowable binary compatible change. So,
> the bounds check is required.
Well, we have not agreed on whether this model of binary compatibility
should be the default. Certainly for standard class it is reasonable
to assume a fixed hierachy, and I think we do want to at least provide
an option to resolve as much as possible at link or compile time.
> Also, If the ancestors were ordered this way, getClass() becomes
> expensive because B.class is _not_ at a fixed offset from the vtable
> pointer,
getClass is not as important as instanceof or casts. In any case, it
is just a matter of adding the depth, and the logic is simple enough
that it can be inlined. Or do as I suggested: get the C++ type_info,
and subtract a constant offset.
> type_info is for C++ type info, not the java class object, right?
It could be both.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/