This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: `asm' in natObject.cc
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- To: "Boehm, Hans" <hans_boehm at hp dot com>
- Cc: "'Bryce McKinlay '" <bryce at waitaki dot otago dot ac dot nz>,"'tromey at redhat dot com '" <tromey at redhat dot com>,"'Java Discuss List '" <java at gcc dot gnu dot org>
- Date: Mon, 3 Dec 2001 19:33:02 +0000 (GMT)
- Subject: RE: `asm' in natObject.cc
- References: <40700B4C02ABD5119F000090278766443BEDB9@hplex1.hpl.hp.com>
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.