patch to bring java vtables closer to g++ abi conformance

Boehm, Hans
Wed Jan 23 11:02:00 GMT 2002

This much seems fine.  But there is an issue if you do this for dynamically
allocated vtables, since the collector will need to be told to look for
interior pointers of the right kind.


> -----Original Message-----
> From: Per Bothner []
> Sent: Wednesday, January 23, 2002 9:56 AM
> To:
> Cc:
> Subject: patch to bring java vtables closer to g++ abi conformance
> The g++ v3 abi ( 
> specifies
> that each vtable contains an offset-to-top and a type_info pointer.
> These words are *before* the word pointed to by each object's vtable
> pointer.  Thus if we add the extra header words it does not actually
> break binary compatibility, unless you look at these new 
> fields - or the
> object's file symbols.   I.e the vtable pointer to class foo is now
> _ZTVN3fooE+8 (assuming a 32-bit target) instead of ZTVN3fooE.
> This patch does not actually implement the type_info pointer, 
> but leaves
> a slot for a pointer which we can fill in later.  If we do that then
> C++ code that uses rtti might actually work instead of 
> crashing.  If we
> do this, perhaps we can embed the type_info object *inside* a Class
> object, as if Class inherits from *both* Object and type_info.  But
> I left this for another day.
> So this change doesn't at this point have much effect, except 
> adding two
> words for each Java class.  However, it brings us closer to abi
> compliance, making it less likely to confuse various tools such as
> debuggers.  I looked at this issue in the context of gdb 
> crashing.  Now
> I'm not totally sure this patch is needed for gdb, since I also fixed
> some things in gdb itself.  In any case it seems like a good idea.
> Comments?  Anyone think I shouldn't check it in?
> -- 
> 	--Per Bothner

More information about the Java mailing list