Vtable index type

Mark Mitchell mark at codesourcery.com
Tue Feb 22 22:04:48 UTC 2000


>>>>> "Jason" == Jason Merrill <jason at cygnus.com> writes:

>>>>> Mark Mitchell <mark at codesourcery.com> writes:

    >> We should specify a type for vtable indices.  It seems to me
    >> that `ptrdiff_t' is the obvious candidate.

    >> This is important in that it limits the number of vtable
    >> entries we can use.  (For example, g++ has historically used
    >> `short' for a vtable index; that limited the size of vtables.)

    Jason> Where does a vtable index appear in the ABI?

Pointers-to-members.  Suppose we check the `ptr' field, and notice
it's odd.  Now, we have to divide by two and use the resulting thing
as a vtable index.  If, say, we only allowed n-bit indices, then we
could shift right one bit, and pull out just the low-order n-bits.  I
don't know *why* anyone would want to do that, but the ABI should say
whether or not its legal to do so.

--
Mark Mitchell                   mark at codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com




More information about the cxx-abi-dev mailing list