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]
Other format: [Raw text]

RE: `asm' in natObject.cc


Boehm, Hans writes:
 > I think the memory clobber is necessary, since it's used to acquire or
 > release a lock.  Thus gcc shouldn't move other memory operations across the
 > compare_and_swap, since that might move them out of the region in which the
 > lock is held.

Yes, I see.  The argument is that even though other memory references
aren't volatile they still must never be moved across the locking
code.  Clobbering all of memory acheives this.

 > To be honest, I'm not sure why the __volatile__ is needed, or whether it has
 > any real effect beyond the memory clobber.

It's probably unnecessary and does no harm.

Andrew.


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