This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: volatile qualifier hurts single-threaded optimized case


Benjamin Kosnik wrote:

 static inline _Atomic_word
 __attribute__ ((__unused__))
-  __exchange_and_add_dispatch(volatile _Atomic_word* __mem, int __val)
+  __exchange_and_add_dispatch(_Atomic_word* __mem, int __val)




Agreed, but doing this means that in the improvements to rope that Richard (and Hans) also want we have to call __exchange_and_add and __atomic_add directly, because in that case the involved memory locations are volatile and have to remain like that per Hans desiderata, I gather.

I find this somewhat confusing, but am going to go ahead with this, as
I have other fixes in the pipeline for this file.


Agreed, agreed. I was just pointing out, for completeness, that we had a very long discussion thread, Hans also participating: in that thread Richard proposed to change rope to use the atomic functions and prepared a patch. Hans was very happy with that patch besides the delicate point that, because of races in some cases (i.e., accesses to the atomic memory *not* using the primitives for performance reasons) the involved memory had to remain volatile for now, to be more safe. Then, the dispatchers could not be used...

Paolo.


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