binary compatibility ABI (was: Re: [boehm-gc] Import 6.3 alpha 1)
Andrew Haley
aph@redhat.com
Thu Aug 14 16:27:00 GMT 2003
Jeff Sturm writes:
> On 2003年8月14日, Andrew Haley wrote:
> > Jeff Sturm writes:
> > >
> > > One of my sore points is the performance gap between static and
> > > position-independent code with the current gcj compiler. For example:
> > > reading a static field requires one memory load without -fPIC, but two
> > > loads with -fPIC (to obtain the memory address from the GOT offset).
> >
> > Short of overwriting the instruction that does the fetch, how would you
> > do that?
>
> That wasn't really such a good example.
>
> Consider:
>
> static int a, b;
> ...
> return a + b;
>
> Does this require 2, 3 or 4 memory loads?
>
> (I believe 2 is the answer for non-PIC, 4 for PIC. If we take advantage
> of the fact that static fields are at a fixed offset from the class
> record, it can be done in three, while preserving position independence.)
Unless a and b are in the exact same class as the 'return a + b'
statment, the positions of a and b relative to the class record may
change. I guess this isn't true if the whole application is compiled
and we give up on binary compatibility.
Andrew.
More information about the Java
mailing list