RFC: Change C++ ABI so that interface dispatch does not depend on reflection.
David Daney
ddaney@avtrex.com
Tue Jan 31 19:36:00 GMT 2006
Tom Tromey wrote:
>>>>>>"David" == David Daney <ddaney@avtrex.com> writes:
>>> David> The first case is simple to handle. If a method is the <clinit>
> David> method just emit the reflection data.
>> Cute.
>> You could also just have a pointer to this function in the Class
> object. That way, for a reflection-less install, you could even
> remove the reflection-related fields from Class. This would require
> hacks to natClass.cc and probably other places, though.
>
Since the String table (for the <clinit> name) is shared the only real
overhead is a single entry in the method reflection table (12 bytes on a
32 bit architecture) If the class object had a pointer this would be 4
bytes. So that would be only 8 bytes of saving, but the class
initialization time would be faster as you would not have to do a lookup
in the method table.
> David> Build interface dispatch tables at compile/link time.
> David> Change runtime to use new tables instead of building its own at class
> David> init time.
>> Sounds reasonable to me. I don't think you even need to change the
> runtime very much... it looks to me like the runtime linker already
> skips this step if the 'idt' field is set.
>> Building the idt table at compile time, for the C++ ABI, seems like a
> general improvement. I don't think we need this to be conditional on
> -fno-reflection.
As I said in the original message: For an object like libgcj where
usually a majority of the classes would remain uninitialized, there is a
size penalty that *could* adversely effect cache performance.
I don't know if there is a win to reduce class initialization overhead
at the expense of a larger class data size.
David Daney
More information about the Java
mailing list