This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/12911] New: Class initialization optimization pessimization


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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]