ABI change for ports with byte-aligned functions.
Mark Mitchell
mark@codesourcery.com
Fri May 11 07:54:00 GMT 2001
>>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:
Alexandre> So, may I revert Geoff's patch in mainline, and install
Alexandre> this one in mainline and branch? I hope it addresses
Alexandre> the issues you raised in the previous version of the
Alexandre> patch I posted a while ago. Tested on
Alexandre> i686-pc-linux-gnu-x-mn10300-elf.
Yes, this is OK, with a couple of minor changes:
+#ifndef TARGET_PTRMEMFUNC_VBIT_WHERE
How about TARGET_PTRMEMFUNC_VBIT_LOCATION instead? That's a better
phrase, I think. Also, there should be a comment above the macro; you
can crib from the .texi stuff you admirably added. And I would reword
that a tad. How about:
The C++ compiler represents a pointer-to-member-function with
a struct that looks like:
@example
struct {
union {
void (*fn)();
ptrdiff_t vtable_index;
};
ptrdiff_t delta;
};
@end example
@noindent
The C++ compiler must use one bit to indicate whether the
function that will be called through a pointer-to-member-function
is virtual. Normally, we assume that the low-order bit of a
function pointer must always be zero. Then, by ensuring that the
vtable_index is odd, we can distinguish which variant of the
union is in use. But, on some platforms
function pointers can be odd, and so this doesn't work. In that
case, we use the low-order bit of the @code{delta} field, and
shift the remainder of the @code{delta} field to the left.
GCC will automatically make the right selection about where to
store this bit using the @code{FUNCTION_BOUNDARY} setting
for your platform. You should not need to override this macro.
Do we actually need to allow people to override this? There's really
only one right answer, right? If you agree, then you should remove
the #ifndef around the macro; otherwise, leave it in.
The code changes are fine except that this:
+ ptrmemfunc_vbit_in_delta, in which case delta is shifted
+ left and added one). */
should read:
"in which case delta is shifted left, and then incremented."
There's no need to retest after making these changes, except that
doing `make info' would be good to make sure that I didn't screw up
the docs.
Thank you for attending to this!
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the Gcc-patches
mailing list