incomplete rtti
Nathan Sidwell
nathan at codesourcery.com
Tue Apr 4 13:33:54 UTC 2000
Jim Dehnert wrote:
> [stuff]
Ah, got it, thanks for taking the time to go through this with me.
> conflict-free. Such things are always accessed via pointers with the
> incomplete-target flag set, which is the signal to do comparisons using
> the mangled names in the ultimate target RTTI instead of comparing
> addresses.
After linking and loading, only one type_info structure is accessible
via the external name defined by this ABI for any particular complete
type symbol.
That sentance _must_ be changed. In the language of the standard an 'A *' is
a complete type, regardless of A. That sentance, and its effect on the equality
operator was causing all my confusion. The subsequent paragraph on type_info::before
is also incorrect. I suggest the following wording for those paragraphs,
For any particular complete type symbol, which is not a direct or indirect pointer
to an incomplete type, only one std::type_info structure is accessible via the external
name defined by this ABI, after linking and loading. Therefore, the equality and
inequality operators can be implemented as address comparisons when operating on
those type_info objects: two type_info structures describe the same type if and
only if they are the same structure (at the same address). In the case of pointer
types, directly or indirectly pointing to incomplete class types, a more complex
comparison is required, described below with the RTTI layout of pointer types.
In a flat address space (such as that of the IA-64 architecture), the before()
member is also easily written in terms of an address comparison, when neither
type_info object is a direct or indirect pointer to an incomplete class type.
The only additional piece of information that is required is the NTBS that
encodes the name. The type_info structure itself can hold a pointer into a
read-only segment that contains the text bytes.
In addition, the __pointer_type_info docs need amending -- it's not at all clear
that the abi::__pointer_type_info themselves must be local static. I suggest
When the abi::__pointer_type_info is for a direct or indirect pointer to an incomplete
class type, the incomplete target type flag is set. In addition, it is prevented
from resolving to the equivalent abi::__pointer_type_info which directly or indirectly
points to the complete class type, possibly by making it a local static object.
If the target type is the incomplete class type itself, a dummy class RTTI is
generated for the incomplete type that also is prevented from resolving to the
final complete class RTTI (because the latter need not exist).
The paragraph descriping pointer equality seems to describe a rather long winded
algorithm -- and it's incomplete as it doesn't say the cv quals must be compared.
Why not just compare the NTBS's of the pointer types themselves? I suggest
When abi::__pointer_type_info objects are compared for equality, if either has the
incomplete flag set the NTBS of the std::type_info bases must be compared. When
neither incomplete flag is set, the addresses of the abi::__pointer_type_info objects
can be compared as with the other types. The implementation of before() behaves
similarly.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan at codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan at acm.org
More information about the cxx-abi-dev
mailing list