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 RFC] PATCH to memory asm ops in atomicity.h


On Wed, 17 Dec 2003 04:05:51 -0800, Richard Henderson <rth@redhat.com> wrote:

> On Tue, Dec 16, 2003 at 09:00:01PM -0500, Jason Merrill wrote:
>> They're used for atomic access to a particular memory location.  Why isn't
>> it enough to specify that location directly?
>
> If that is *all* they are used for, then fine.  But if an
> atomic increment is used to implement a mutex, then it is
> not fine.

They aren't; code that needs a mutex uses the gthread API.  These functions
are used for reference counting.  Actually, a mutex is used to implement
atomic add on targets that don't have suitable primitives.

>> Note also that the asms are marked volatile, which should prevent
>> scheduling across them.
>
> That only applies to scheduling.  Not to cse or load-store motion or
> any other optimization that shouldn't cross a thread synchronization
> point.

Good to know, thanks.

Jason


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