[Bug java/15525] New: suggestion to enable cast elimination
tromey at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed May 19 13:01:00 GMT 2004
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
More information about the Gcc-bugs
mailing list