public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* C++0x Memory model and gcc
@ 2010-05-06 15:43 Andrew MacLeod
  2010-05-06 15:51 ` Richard Guenther
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Andrew MacLeod @ 2010-05-06 15:43 UTC (permalink / raw)
  To: GCC

I've been working for a while on understanding how the new memory model 
and Atomics work, and what the impacts are on GCC.

It would be ideal to get as many of these changes into GCC 4.6 as 
possible. I've started work on some of the modifications and testing,  
and the overall impact on GCC shouldn't be *too* bad :-)

The plan is to localize the changes as much as possible, and any 
intrusive bits like optimization changes will be controlled by a flag 
enabling us to keep the current behaviour when we want it.

I've put together a document summarizing how the memory model works, and 
how I propose to make the changes. I've converted it to wiki pages.  
Maybe no one will laugh at my choice of document format this time :-)

The document is linked off the Atomics wiki page, or directly  here:  
http://gcc.gnu.org/wiki/Atomic/GCCMM

It consists mainly of describing the 2 primary aspects of the memory 
model which affects us
 - Optimization changes to avoid introducing new data races
 - Implementation of atomic variables and synchronization modes
as well as a new infrastructure to test these types of things.

I'm sure I've screwed something up while doing it, and I will proofread 
it later today again and tweak it further.

Please point out anything that isn't clear,  or is downright wrong. 
Especially in the testing methodology since its all new stuff.
Suggestions for improvements on any of the plan are welcome as well.

Andrew



^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: C++0x Memory model and gcc
@ 2010-05-08 14:38 Jean-Marc Bourguet
  2010-05-08 20:18 ` Albert Cohen
  0 siblings, 1 reply; 27+ messages in thread
From: Jean-Marc Bourguet @ 2010-05-08 14:38 UTC (permalink / raw)
  To: gcc

>     -fmemory-model=single
>         Assume single threaded execution, which also means no signal
>         handlers.
>     -fmemory-model=fast
>         The user is responsible for all synchronization.  Accessing
>         the same memory words from different threads may break
>         unpredictably.
>     -fmemory-model=safe
>         The compiler will do its best to protect you.

With that description, I'd think that "safe" lets the user code assumes
the sequential consistency model.  I'd use -fmemory-model=conformant or
something like that for the model where the compiler assumes that the user
code respect the constraint led out for it by the standard.  As which
constraints are put on user code depend on the languages -- Java has its
own memory model which AFAIK is more constraining than C++ and I think Ada
has its own but my Ada programming days are too far for me to comment on
it -- one may prefer some other name.

Yours,

-- 
Jean-Marc Bourguet

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2010-05-17 20:22 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-06 15:43 C++0x Memory model and gcc Andrew MacLeod
2010-05-06 15:51 ` Richard Guenther
2010-05-06 16:11   ` Richard Guenther
2010-05-06 16:23     ` Andrew MacLeod
2010-05-07  9:15       ` Richard Guenther
2010-05-07 13:27         ` Andrew MacLeod
2010-05-07 14:26           ` Ian Lance Taylor
2010-05-06 15:54 ` Joseph S. Myers
2010-05-06 16:12   ` Andrew MacLeod
2010-05-06 20:40 ` Ian Lance Taylor
2010-05-06 22:02   ` Andrew MacLeod
2010-05-07 13:55   ` Mark Mitchell
2010-05-08 14:38 Jean-Marc Bourguet
2010-05-08 20:18 ` Albert Cohen
2010-05-10  4:40   ` Ian Lance Taylor
2010-05-10 17:23     ` Andrew MacLeod
2010-05-11  6:20       ` Miles Bader
2010-05-11 12:49         ` Andrew MacLeod
2010-05-12  5:21           ` Miles Bader
2010-05-12 13:10             ` Andrew MacLeod
2010-05-17 13:12               ` Michael Matz
2010-05-17 14:05                 ` Ian Lance Taylor
2010-05-17 14:24                   ` Michael Matz
2010-05-17 20:22                     ` Ian Lance Taylor
2010-05-17 14:09                 ` Andrew MacLeod
2010-05-17 14:55                   ` Michael Matz
2010-05-17 16:36                     ` Andrew MacLeod

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).