__base_class_type_info offset_flags
Mark Mitchell
mark at codesourcery.com
Tue Dec 3 23:35:41 UTC 2002
For the most part, the ABI specification doesn't offer particular
guidance for 32-bit platforms. However, 2.9.5 (RTTI Layout) has this
note about the offset_flags field of __base_class_type_info:
The upper 56 bits of __offset_flags are a signed offset. For a
non-virtual base, this is the offset in the object of the base
subobject. For a virtual base, this is the offset in the virtual table
of the virtual base offset for the virtual base referenced (negative).
The low-order byte of __offset_flags contains flags, as given by the
masks from the enumeration __offset_flags_masks:
o 0x1: Base class is virtual
o 0x2: Base class is public
Note:
In an ABI for a machine with 32-bit addresses, the offset becomes a
32-bit field, and the flags are in the low-order byte of a second
32-bit field.
I think we should remove the note.
First, G++ does not honor the note; it just uses "long" on all
platforms. That's a particular hard thing to change going forward;
the runtime support routines would have to somehow detect which
version of the type_info structures they were dealing with. So, I
don't fancy trying to make this change in GCC.
Second, what's the point? If you just deleted the note, you'd be
limited to objects whose sizes are representable in 24-bits on a
32-bit machine. Well, more properly, if you made bigger objects,
you'd not be able to dynamic_cast between subobjects.
Any objections to simply removing the note and treating 32-bit
machines just like other machines, using a single "long" for
"__offset_flags"?
--
Mark Mitchell mark at codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the cxx-abi-dev
mailing list