RTTI queries

Jim Dehnert dehnert at baalbek.engr.sgi.com
Wed Jan 19 06:42:00 UTC 2000


Hi, all,

I can't answer these questions with confidence, so I'd like to go over
them in the meeting Thursday (unless someone can reliably answer them
in email Wednesday).

Also, I observe in looking at this the "polymorphic" flag in
__class_type_info.  Do we mean the Standard definition of this,
or do we mean our ABI pseudo-polymorphic definition, i.e. "has a
vtable?"

Jim

> Date: Thu, 06 Jan 2000 11:20:09 +0000
> From: Nathan Sidwell <nathan at acm.org>
> 
> Hi,
> I'm in the process of implementing the runtime rtti code in g++ for
> CodeSourcery LLC. I have a number of queries and comments on the 
> C++ ABI for IA64: Data Layout document
> (http://reality.sgi.com/dehnert_engr/cxx/abi-layout.html)
> 
> 1) the declaration of __vmi_class_info uses a helper class of the
> following
>         struct __base_class_info {
>         type_info *type;
>         ptrdiff_t offset;
>         int vmi_flags;
>         }
> 1.1) I beleive `type' should be declared `__class_type_info const *type'
> (the description of __ptr_to_member_type_info has such a pointer and uses
> __class_type_info). The description of __si_class_type_info is vague on the
> base pointer's type, but that too should be `__class_type_info const *type'.
> 
> 1.2) From the description of __vmi_class_info it appears that the base
> class array uses the trailing array struct hack. This is ok, because
> it is always generated by the compiler. This is not documented.
> 
> 1.3) I cannot find a definition of what the `offset' member of
> __base_class_info is an offset for. For a virtual base it cannot be
> the offset from this base to the virtual base as that changes for different
> bases in a heirarchy. I presume it must be the offset in the vtable to the
> base offset. This is not documented.

This appears to be correct.

> 2) The ABI document specifies
> 
> void *__dynamic_cast (void *sub, __class_type_info *src,
>                 __class_type_info *dst, ptrdiff_t sr2dst_offset);
> 
> this is not const correct, I beleive it should be
> 
> void *__dynamic_cast (const void *sub, const __class_type_info *src,
>                 const __class_type_info *dst, ptrdiff_t sr2dst_offset);
> 
> 3) __class_type_info contains a set of details flags. Whilst these look
> useful, I'm not sure that they are. When porting g++'s current dynamic_cast
> machinery (which as the document points out is semantically the same), these
> flags showed little use.
> 
> 3.1) flag 0x8 says `has privately inherited base'. Does this really mean
> private or does it actually mean non-public? both catch matching and dynamic
> cast distinguish public and non-public, not private and non-private.
> 
> 3.2) More useful for dynamic cast, (and possibly catch matching) would be
> the following flags
> 	* Contains non-diamond shaped multiple base object
> 	* Is diamond shaped
> 	* has virtual base
> 	* has non-virtual base
> 	* has public base
> 	* has non-public base
> Note that the virtual/non-virtual and public/non-public are not mutually
> exclusive. Also note that I have not actually implemented anything with these
> flags, so I could be wrong.
> 
> 4) The name mangling scheme for type_info objects is not defined. Therefore
> I don't know how to name the type_info objects required in the runtime for
> the fundamental types (and their pointers). I see this is on today's agenda.

And we'll finally get to it two weeks later :-).

> nathan
> 
> -- 
> Dr Nathan Sidwell :: sidwell at codesourcery.com
> nathan at acm.org  http://www.cs.bris.ac.uk/~nathan/
> 
-		Jim Dehnert  x3-4272




More information about the cxx-abi-dev mailing list