This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: locks on X86
- To: "Boehm, Hans" <hans_boehm at hp dot com>
- Subject: Re: locks on X86
- From: Jeff Sturm <jsturm at one-point dot com>
- Date: Mon, 12 Mar 2001 18:25:28 -0500 (EST)
- cc: java at gcc dot gnu dot org, "'drepper at redhat dot com'" <drepper at redhat dot com>
On Mon, 12 Mar 2001, Boehm, Hans wrote:
> - cmpxchg without a lock prefix is much faster (roughly 3x or close to 15
> cycles by my measurements) than either xchg (implied lock prefix) or lock;
> cmpxchg .
>
> - cmpxchg without the lock prefix is atomic on uniprocessors, i.e. it's not
> interruptable.
Interesting. Similarly, I once noticed that an Alpha LL/SC operation is
considerably faster without the explicit memory barrier. But as far as I
know, no code takes advantage of that, not even the Linux kernel. The
same goes for unlock on machines with a relaxed memory model.
I can't see how you could modify the code at runtime however... if the
lock routine is inlined, there could be many occurences of it, and you'd
have to arrange for it to be placed in a RW segment somehow.
Jeff