public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/15525] New: suggestion to enable cast elimination
Date: Tue, 18 May 2004 20:42:00 -0000	[thread overview]
Message-ID: <20040518204228.15525.tromey@gcc.gnu.org> (raw)

Diego pointed out on irc today that we could eliminate some
casts by changing the java gimplifier a bit to allow CCP to
do the work for us.

Eg, consider this idiom:

    if (! (x instanceof foo))
      return false;
    foo self = (foo) x;

We could generate code like so:

    int tmp_1 = 0;
    if (! (_Jv_IsInstanceOf (x, &foo.class)) return 0;
    else tmp_1 = 1;

    foo self = tmp_1 ? (foo) x : _Jv_CheckCast (x, &foo.class);

We could do this when generating code for "instanceof" along these lines:
    _Jv_IsInstanceOf(...) ? ({ tmp_1 = 1; 1 }) : 0

With this approach, redundant calls to _Jv_CheckCast would be
automatically eliminated.  Perhaps then we could have an extra
pass to get rid of any remaining temporary variables that we introduced.

-- 
           Summary: suggestion to enable cast elimination
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tromey at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15525


             reply	other threads:[~2004-05-18 20:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-18 20:42 tromey at gcc dot gnu dot org [this message]
2004-05-18 21:08 ` [Bug java/15525] " pinskia at gcc dot gnu dot org
2004-05-20 19:40 ` dnovillo at gcc dot gnu dot org
2004-08-27 20:55 ` tromey at gcc dot gnu dot org
2004-09-02  1:39 ` tromey at gcc dot gnu dot org
2005-03-09  9:04 ` pinskia at gcc dot gnu dot org
2005-05-01  0:57 ` tromey at gcc dot gnu dot org

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=20040518204228.15525.tromey@gcc.gnu.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@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).