From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29859 invoked by alias); 18 May 2004 20:42:31 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 29786 invoked by uid 48); 18 May 2004 20:42:30 -0000 Date: Tue, 18 May 2004 20:42:00 -0000 From: "tromey at gcc dot gnu dot org" To: java-prs@gcc.gnu.org Message-ID: <20040518204228.15525.tromey@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/15525] New: suggestion to enable cast elimination X-Bugzilla-Reason: CC X-SW-Source: 2004-q2/txt/msg00112.txt.bz2 List-Id: 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