r177753 - [ms-cxxabi] Implement member data pointers for non-dynamic classes

John McCall rjmccall at apple.com
Fri Mar 29 10:05:42 PDT 2013


On Mar 29, 2013, at 9:20 AM, Reid Kleckner <rnk at google.com> wrote:

> On Fri, Mar 22, 2013 at 1:46 PM, John McCall <rjmccall at apple.com> wrote:
> 
> On Mar 22, 2013, at 12:02 PM, Reid Kleckner <reid at kleckner.net> wrote:
> 
> > Author: rnk
> > Date: Fri Mar 22 14:02:54 2013
> > New Revision: 177753
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=177753&view=rev
> > Log:
> > [ms-cxxabi] Implement member data pointers for non-dynamic classes
> >
> > Summary:
> > For non-dynamic classes (no virtual bases), member data pointers are
> > simple offsets from the base of the record.  Dynamic classes use an
> > aggregate for member data pointers and are therefore currently
> > unsupported.
> >
> > Unlike Itanium, the ms ABI uses 0 to represent null for polymorphic
> > classes.  Non-polymorphic classes use -1 like Itanium, since 0 is a
> > valid field offset.
> 
> Oh, you should also implement isZeroInitializable.
> 
> I looked into this, and MSVC seems to zero-initialize most things regardless of the null representation.
> 
> For example:
> struct POD { int a; };
> int POD::*pod_memptr;  // should be -1, but goes into .bss and becomes 0
> int POD::*null_memptr = 0;  // gets -1 and goes into .data as expected
> 
> But we probably don't have to be bug-for-bug compatible here.  IMO the right thing is to use -1 and .data for this case.

Nice find.  I agree that we should not be bug-for-bug compatible here. :)

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130329/49336c6b/attachment.html>


More information about the cfe-commits mailing list