Implementation Q
Tom Tromey
tromey@cygnus.com
Sat Apr 1 00:00:00 GMT 2000
>>>>> "Colin" == Colin McCormack <colin@field.medicine.adelaide.edu.au> writes:
Colin> What's the reason rtti has to be off in CNI?
The C++ compiler knows that the Java compiler is responsible for
generating the vtable for every "Java" object. The Java compiler
doesn't know how to generate rtti information. So, if you compile CNI
code with rtti enabled, you get link errors -- the g++-compiled .o
files refer to nonexisting rtti objects.
Colin> Is Java doing some mapping via the vtbl, and the extra vtbl
Colin> pointer for rtti messes this up?
Nope. We just leave the rtti slot empty. Actually, we have
experimental code to use the rtti slot to store some information for
the GC (this would let us speed up the marking process). However, we
could move that information to vtable[-1] if we had to.
Colin> If so, how hard would it be to trick up a version which used
Colin> rtti across the board?
Semi-hard. I think you either have to copy a big chunk of
gcc/cp/rtti.c into gcc/java, or you have to solve the g++/java
infrastructure problem (i.e., making it possible for them to share
code). The latter problem would be good to solve, and is probably
necessary to solve in the medium term (with the new ABI work). I
won't have time to look at it for quite a while (unless it suddenly
becomes critical somehow). I don't know if anybody else is planning
to address the problem.
Also, you have to be prepared to generate rtti information at runtime.
At runtime we construct array classes as well as interpreted classes.
Having the rtti information would let us clean up some hacks related
to exception handling.
Why do you want rtti in your CNI code?
Tom
More information about the Java
mailing list