This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/12911] New: Class initialization optimization pessimization
- From: "green at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Nov 2003 14:36:43 -0000
- Subject: [Bug java/12911] New: Class initialization optimization pessimization
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12911
Summary: Class initialization optimization pessimization
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: green at redhat dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-oc-linux-gnu
GCC host triplet: i686-oc-linux-gnu
GCC target triplet: i686-oc-linux-gnu
It would be nice to fix a class init optimization problem. The compiler
should recognize that calls to constructors and calls to static methods
always initialize the called class, so we can force our
class-init-tracking local flag to `true' whenever we do these.
public class A
{
// This method should never call _Jv_InitClass on B.
public int foo ()
{
B b = new B();
return B.bar;
}
// Neither should this.
public int foo2 ()
{
B.plus6(5);
return B.bar;
}
}
public class B
{
public static int plus6(int x) { return x + 6; }
public static int bar = 555;
}