public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/51798] [4.7 regression] libstdc++ atomicity performance regression due to __sync_fetch_and_add
Date: Thu, 26 Jan 2012 22:08:00 -0000	[thread overview]
Message-ID: <bug-51798-4-fHw2XysUMn@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51798-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51798

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-26 20:39:40 UTC ---
Apologies for my phrasing.  What I meant is that it's not a matter of
consistency.

Localising all uses of __sync_bool_compare_and_swap by adding an unnecessary
additional layer of indirection in atomicity.h would not have been appropriate.
 GCC already abstracts the required CAS operation with
__sync_bool_compare_and_swap, so that is used directly when needed.  One of the
main reasons for the wrappers in atomicity.h is to fall back to non-atomic ops
in non-threaded code, rather than just to localize the use of intrinisics.
Having a fall back for non-threaded code isn't necessary for the places where
__sync_bool_compare_and_swap is used in shared_ptr and parallel mode. Our
shared_ptr has a partial specialization for the non-threaded case, which
doesn't use CAS, and using parallel mode in non-threaded code doesn't make
sense.  So __sync_bool_compare_and_swap is used directly. "It's own
atomicity.h" doesn't include a CAS operation, and I see no benefit to adding
CAS to that file.


  parent reply	other threads:[~2012-01-26 20:40 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 14:31 [Bug libstdc++/51798] New: " dje at gcc dot gnu.org
2012-01-09 14:36 ` [Bug libstdc++/51798] " dje at gcc dot gnu.org
2012-01-09 14:38 ` dje at gcc dot gnu.org
2012-01-09 15:43 ` rguenth at gcc dot gnu.org
2012-01-09 17:12 ` dje at gcc dot gnu.org
2012-01-24  7:45 ` amacleod at redhat dot com
2012-01-24 16:46 ` dje at gcc dot gnu.org
2012-01-24 16:51 ` amacleod at redhat dot com
2012-01-25 14:27 ` jakub at gcc dot gnu.org
2012-01-25 15:39 ` dje at gcc dot gnu.org
2012-01-25 16:09 ` amacleod at redhat dot com
2012-01-25 16:17 ` dje at gcc dot gnu.org
2012-01-26 13:52 ` jakub at gcc dot gnu.org
2012-01-26 14:38 ` amacleod at redhat dot com
2012-01-26 15:50 ` dje at gcc dot gnu.org
2012-01-26 15:53 ` redi at gcc dot gnu.org
2012-01-26 21:50 ` dje at gcc dot gnu.org
2012-01-26 22:08 ` redi at gcc dot gnu.org [this message]
2012-01-27 10:09 ` jakub at gcc dot gnu.org
2012-01-27 11:37 ` jakub at gcc dot gnu.org
2012-01-27 13:03 ` amacleod at redhat dot com
2012-01-27 14:55 ` dje at gcc dot gnu.org
2012-01-27 15:01 ` jakub at gcc dot gnu.org
2012-01-27 15:26 ` dje at gcc dot gnu.org
2012-01-27 20:15 ` bkoz at gcc dot gnu.org
2012-01-27 21:05 ` jakub at gcc dot gnu.org
2012-01-27 21:08 ` jakub at gcc dot gnu.org
2012-02-09  8:46 ` bkoz at gcc dot gnu.org
2012-02-09  9:16 ` redi at gcc dot gnu.org
2012-02-09 20:08 ` bkoz at gcc dot gnu.org
2012-02-09 23:22 ` bkoz at gcc dot gnu.org
2012-02-10 18:21 ` bkoz at gcc dot gnu.org
2012-02-13 21:31 ` rth at gcc dot gnu.org
2012-02-17 21:03 ` bkoz at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51798-4-fHw2XysUMn@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).