This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: java aliasing rules
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>, tromey at redhat dot com,Dan Nicolaescu <dann at godzilla dot ics dot uci dot edu>, java at gcc dot gnu dot org,gcc at gcc dot gnu dot org
- Date: Thu, 4 Apr 2002 21:26:55 +0100 (BST)
- Subject: Re: java aliasing rules
- References: <3CA64458.7030105@waitaki.otago.ac.nz><Pine.LNX.4.10.10204041316390.14501-100000@mars.deadcafe.org>
Jeff Sturm writes:
> On Sun, 31 Mar 2002, Bryce McKinlay wrote:
> > >>lhz r9, [ps1.f1]
> > >>addi r9,r9,1
> > >>sth r9, [ps1.f1]
> > >>
> > >
> > >Wouldn't accessing r9 immediately after the load cause a pipeline stall?
> > >Assuming an in-order processor? That would be a significant performance
> > >hit.
> >
> > Right, its not optimal scheduling, but there's no way to avoid that and
> > still have the correct behaviour for NullPointers. And as you suggest, a
> > modern processor may be speculativly executing the following loads, so
> > it probibly doesn't matter too much.
If it doesn't annul such speculation on SEGV I don't think it's
correct Java semantics.
> Am I correct in thinking this is only an issue for -fnon-call-exceptions?
Yes.
> It might be useful to turn this "correctness" off with a compiler option,
> as we do with -fno-bounds-check. I habitually check for null in my code,
> and don't do anything useful with a NullPointerException besides aborting.
> I suspect that's true of a great deal of Java code.
I know what you mean, but turning this off is a pretty major departure
from the Java language spec.
Andrew.