public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/15525] New: suggestion to enable cast elimination
@ 2004-05-18 20:42 tromey at gcc dot gnu dot org
  2004-05-18 21:08 ` [Bug java/15525] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: tromey at gcc dot gnu dot org @ 2004-05-18 20:42 UTC (permalink / raw)
  To: java-prs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <bug-15525-8172@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2015-10-20 15:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-18 20:42 [Bug java/15525] New: suggestion to enable cast elimination tromey at gcc dot gnu dot org
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
     [not found] <bug-15525-8172@http.gcc.gnu.org/bugzilla/>
2015-10-20 15:07 ` aph at gcc dot gnu.org

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).