This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Call for compiler help/advice: atomic builtins for v3


Richard Henderson wrote:

>Actually, no, it's not possible.  At least in the context we're
>discussing here.  Consider:
>
>One part of the application (say, libstdc++) is compiled with only
>i386 support.  Here we wind up relying on a mutex to protect the
>memory update.  Another part of the application (say, the exe) is
>compiled with i686 support, and so chooses to use atomic operations.
>The application will now fail because not all updates to the memory
>location are protected by the mutex.
>  
>
Richard, sorry, I don't agree, on second thought. You are not
considering that the idea is using a "smart" libgcc, a la glibc, as per
Mark and Uli messages.

A "libstdc++ compiled with only i386 support" what is it? It is a
libstdc++ which at run time will call into libgcc, it has nothing
inline. Then libgcc will use the best the machine has available, that
is, certainly atomic operations, if the exe (compiled with -march=i686)
can possibly run.

In short, the keys are:
1- The "smart" libgcc, which always makes available the best the machine.
2- Mutexes cannot be inline, only atomic operations can.

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]