This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: libstdc++ and race detectors
- From: Kostya Serebryany <kcc at google dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: libstdc++ at gcc dot gnu dot org, Julian Seward <jseward at acm dot org>, Bart Van Assche <bvanassche at acm dot org>, "Frank, Matthew I" <matthew dot i dot frank at intel dot com>
- Date: Tue, 13 Jul 2010 16:04:11 +0400
- Subject: Re: libstdc++ and race detectors
- References: <AANLkTim68MweWz6dJkpl4t2Ub6EIlhpgPYas_Gc1WurR@mail.gmail.com> <AANLkTillxMgsSHjFGxFi9gqDhRvp7j0-jluKZLxfZfan@mail.gmail.com> <4C37149A.2050401@oracle.com>
Hi Paolo,
On Fri, Jul 9, 2010 at 4:22 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> On 07/09/2010 01:29 PM, Kostya Serebryany wrote:
>> Before we proceed with a bug report or a patch file, we'd like to know
>> your opinion on the problem.
>>
> I don't know if you are aware of that, but in the forthcoming, so-called
> C++0x, standard reference counting implementations of basic_string will
> be ruled out.
Good!
Will the library have any other code with atomic synchronization?
> Thus, the next implementation, of which you can see a
> preview in ext/vstring.h, will not use reference counting *at all*.
> Thus, given that, and also the delicate intertwining of basic_string
> with the rest of the library, which has serious implications for the
> ABI, I *seriously* doubt that any non-trivial change to the
> reference-counting mechanism can be accepted at this stage.
>
> Anyway, If you have a quick preliminary draft of the kind of change you
> are talking about - which in any case must definitely respect the ABI in
> full, in the wide sense we have been enforcing all these years, thus,
> objects built with old and new headers must be able to interoperate - I
> would be happy to have a look, but I'm not very optimistic, I'm sorry.
> ... in the meanwhile I actually had a look to the referenced web page.
>
> Apparently, this is a kind of change which we *can* do, because it
> entirely lives in an header, static inline, and I think should not cause
> problems for the ABI (in the wide-sense). Good news ;)
I prepared a draft of this change: http://codereview.appspot.com/1800042 .
Unfortunately, this change required to add __attribute__
((always_inline)) to _M_dispose and ~basic_string. I am not sure this
is acceptable.
Without __attribute__ ((always_inline)) the approach doesn't work
because ~basic_string does not get inlined and we call the version of
~basic_string from libstdc++.so, which does not have the annotations.
Any suggestion?
Thanks!
--kcc
>
> Thus I would suggest trying to come up with a full patch, touching
> atomicity.h essentially, and then adjusting consistently all the callers
> everywhere. Note: all the names must be uglified, thus __refcount,
> __res. Also, something like - note single underscore in front, no
> underscores at the end - _GLIBCXX_HAPPENS_AFTER, etc., maybe better
> adding something to the name mentioning atomicity & co.
>
> Paolo.
>