Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jan 2005 22:53:22 -0500
From:      David Schultz <das@FreeBSD.ORG>
To:        "Dag-Erling =?us-ascii:iso-8859-1?Q?Sm=F8rgrav?=" <des@des.no>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: kernel vm question
Message-ID:  <20050131035322.GA8082@VARK.MIT.EDU>
In-Reply-To: <xzppszpzrbr.fsf@dwp.des.no>
References:  <41F90140.3020705@trispen.com> <20050127160914.GA72454@VARK.MIT.EDU> <xzpsm4l281b.fsf@dwp.des.no> <xzppszpzrbr.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 28, 2005, Dag-Erling Smrgrav wrote:
> des@des.no (Dag-Erling Smørgrav) writes:
> > David Schultz <das@FreeBSD.ORG> writes:
> > > When the line is there, the compiler is probably smart enough to
> > > realize that 'x=y; y=x' is (usually) a no-op, so it optimizes away
> > > both statements.
> > Wrong.  The compiler is free to optimize away the second statement
> > provided that neither x nor y is declared volatile, but it cannot
> > optimize away the first statement.
> 
> I should add: unless it can determine with absolute certainty that x
> is not referenced later.

Exactly.  Notice that this is indeed the case for Jaques' example.
I oversimplified a bit because, as I mentioned, this is a
digression from the main point about writing to the code segment.
There's no need to be curt.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050131035322.GA8082>