This is the mail archive of the 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]

Enable class initialization optimization for .class compiling

While look into why the class initialization optimization
was disabled on the mainline, I found that it was disabled for
.class compiling always.  I figured that it would be nice to
enable it for .class compiling (even though it is not fully
doing the optimization like it was doing for gcj 3.4.0).
The reason why .class compiling disabled this optimization is
.class compiling used to be statement at a time instead of the
current for 4.0 (because of tree-ssa) function at a time so we
could not emit the "= false" part first as we did not know which
class would need to be initialized in the method.
This patch enables the class initialization optimization for
.class compiling.

OK? Bootstrapped and tested on powerpc-darwin with no regressions.

Also now we produce the same code from compiling from source or
from class files for:
public class t
  public static void main (String[] argv)
    int n = 0;
    for (int i = 0; i < 1000; i++)

Moving the initialization for java.lang.System out side of
the loop.

Andrew Pinski


	* decl.c (end_java_method): Call
	attach_init_test_initialization_flags on all the init_decls.
	* parse.y (attach_init_test_initialization_flags): Move to ...
	* expr.c (attach_init_test_initialization_flags): here and
	support BIND_EXPR also.
	* java-tree.h (attach_init_test_initialization_flags): Prototype.
	* jcf-parse.c (parse_class_file): Don't disable class init

Attachment: fixPR18305.diff.txt
Description: Text document

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