Java & aliasing question
Richard Henderson
rth@redhat.com
Mon Jan 28 11:02:00 GMT 2002
On Mon, Jan 28, 2002 at 12:55:31AM +1300, Bryce McKinlay wrote:
> If the Java front end implements lang_hooks.get_alias_set(), can gcc
> eliminate the redundant load?
Yes.
> Further, given something like:
>
> class A {}
> class B extends A {}
> class C extends A {}
>
> an "A" could alias either a "B" or a "C", but a "B" can't alias a "C"
> simply because they cannot possibly point to the same object. Is it
> possible for gcj to express this to the aliasing code?
Yes.
This is especially easy in Java because you don't have pointers,
and so cannot take the address of a.a. In C, an "int" must have
the same alias set everywhere; in java, I believe you can make
every unique field have its own alias set. The only stickler
would be whole object assignment, which I don't recall if you can
do. But if you can, that merely makes implementation fractionally
harder.
You should also consider marking the DECL_FIELD with DECL_NONADDRESSABLE_P.
> Even better, could it operate on the individual elements, so that
> only fields declared in A would be considered aliasing?
I'm pretty sure.
r~
More information about the Gcc
mailing list