public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Dan Nicolaescu <dann@godzilla.ICS.UCI.EDU>
Cc: java@gcc.gnu.org
Subject: Re: java aliasing rules
Date: Wed, 27 Mar 2002 13:53:00 -0000	[thread overview]
Message-ID: <87zo0tprx4.fsf@creche.redhat.com> (raw)
In-Reply-To: Dan Nicolaescu's message of "Wed, 27 Mar 2002 11:43:02 -0800"

>>>>> "Dan" == Dan Nicolaescu <dann@godzilla.ICS.UCI.EDU> writes:

Dan> Given this code:
Dan> class first  {  int i; char a;  char f1;  char f2; double d;};
Dan> class second {  char b;  char f2;  int f3;};

Dan> public class t
Dan> {
Dan>     public  void f (first  ps1, second ps2)
Dan>     {
Dan>         ps1.f1++;
Dan>         ps2.f2++;
Dan>         ps1.f1++;
Dan>         ps2.f2++;
Dan>     }
Dan> }

Dan> can it be assumed that given that "first" and "second" are
Dan> incompatible

Yes.

Dan> The more general question is if 2 COMPONENT_REFs that refer to
Dan> classes that are in conflicting alias sets (ie
Dan> alias_sets_conflict_p) alias in java. I have a hunch that this
Dan> might be true, but I don't know enough about java to be sure.  If
Dan> the above is not true, is there a restricted case when it is
Dan> true?

My understanding, and please if you don't mind clear things up if I'm
wrong, is that each front end is free to write its own aliasing
function.  And as far as I know gcj doesn't have one.  So I don't know
how conflicting alias sets for Java are currently computed, but I
imagine it is just very conservative and doesn't follow the language
rules.

Better aliasing support is definitely something we'd like.  It's on my
to-do list (and, I'd wager, Bryce's), but I haven't had time to look
at it.

Anyway, in Java, casts are *always* done according to the type system.
There is no way to circumvent it.  So in your above example, it is
never possible to turn a `first' into a `second' -- they are not
compatible.

Does this answer your questions?

Tom

  reply	other threads:[~2002-03-27 21:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-27 11:43 Dan Nicolaescu
2002-03-27 13:53 ` Tom Tromey [this message]
2002-03-27 16:03   ` Dan Nicolaescu
2002-03-27 16:47     ` Tom Tromey
2002-03-27 20:00       ` Dan Nicolaescu
2002-03-27 15:54 ` Bryce McKinlay
2002-03-27 16:45   ` Tom Tromey
2002-03-28 22:02     ` Bryce McKinlay
2002-03-28 22:13       ` Richard Henderson
2002-03-28 22:15       ` Tom Tromey
2002-03-29 15:22         ` Bryce McKinlay
2002-03-29 16:26           ` Richard Henderson
2002-03-30  6:37           ` Jeff Sturm
2002-03-30 13:55             ` Richard Henderson
2002-03-30 15:04             ` Bryce McKinlay
2002-04-04 10:57               ` Jeff Sturm
2002-04-04 12:57                 ` Andrew Haley
2002-04-04 14:20                   ` Jeff Sturm
2002-04-04 17:04                 ` Bryce McKinlay
2002-04-04 20:39                   ` Jeff Sturm
2002-04-05  1:07                     ` Bryce McKinlay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zo0tprx4.fsf@creche.redhat.com \
    --to=tromey@redhat.com \
    --cc=dann@godzilla.ICS.UCI.EDU \
    --cc=java@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).