Enable class initialization optimization for .class compiling
Andrew Pinski
pinskia@physics.uc.edu
Tue Nov 9 17:49:00 GMT 2004
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++)
System.out.println(n);
}
}
Moving the initialization for java.lang.System out side of
the loop.
Thanks,
Andrew Pinski
ChangeLog:
* 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
optimization.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fixPR18305.diff.txt
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20041109/6d2f5fa5/attachment.txt>
More information about the Java-patches
mailing list