This is the mail archive of the gcc-patches@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: [v3] atomics


David Miller wrote:
From: David Daney <ddaney@avtrex.com>
Date: Fri, 18 Apr 2008 10:51:33 -0700

At this point I don't really have an opinion as to how to fix the problem. One thought that comes to mind is to change the definition of atomic_flag so that the size of the atomic variable is appropriate for the target architecture (32 bits in the case of MIPS)

It's trivial to synthesize 1-byte and 2-byte atomics if you only have word sized ones.

You compute a shift and a mask based upon the offset of the byte
within the word, and then do your LL/SC sequence, shifting and masking
the byte you want to change in and out of the word.

Right, I had already thought that part out. However it is even more trivial to change the libstdc++ code so that it only uses 32 bit wide locations.


The real question is which is the 'right way' to fix the problem. My feeling is that adding 1 and 2 byte atomics is the right way to go, but I am open to other options as well.

David Daney


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