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


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

Re: locks on X86




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


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