diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2004-11-26 18:04:45 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2004-11-26 10:04:45 -0800 |
commit | 532815a787849962ca2f2101aef12ec1d57b2cfd (patch) | |
tree | fd510bfba4be46b5f8449a5f32932ed69e327402 /gcc/java/expr.c | |
parent | e57df6fed97f4e7dd58dd00a1946c698b5a22d92 (diff) | |
download | gcc-532815a787849962ca2f2101aef12ec1d57b2cfd.zip gcc-532815a787849962ca2f2101aef12ec1d57b2cfd.tar.gz gcc-532815a787849962ca2f2101aef12ec1d57b2cfd.tar.bz2 |
re PR java/18305 (Class initialization optimization is not done when compiled from .class)
2004-11-26 Andrew Pinski <pinskia@physics.uc.edu>
PR java/18305
* 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.
From-SVN: r91343
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r-- | gcc/java/expr.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 305ab5b..0fef94d 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1935,6 +1935,39 @@ pop_arguments (tree arg_types) abort (); } +/* Attach to PTR (a block) the declaration found in ENTRY. */ + +int +attach_init_test_initialization_flags (void **entry, void *ptr) +{ + tree block = (tree)ptr; + struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry; + + if (block != error_mark_node) + { + if (TREE_CODE (block) == BIND_EXPR) + { + tree body = BIND_EXPR_BODY (block); + TREE_CHAIN (ite->value) = BIND_EXPR_VARS (block); + BIND_EXPR_VARS (block) = ite->value; + body = build2 (COMPOUND_EXPR, void_type_node, + build1 (DECL_EXPR, void_type_node, ite->value), body); + BIND_EXPR_BODY (block) = body; + } + else + { + tree body = BLOCK_SUBBLOCKS (block); + TREE_CHAIN (ite->value) = BLOCK_EXPR_DECLS (block); + BLOCK_EXPR_DECLS (block) = ite->value; + body = build2 (COMPOUND_EXPR, void_type_node, + build1 (DECL_EXPR, void_type_node, ite->value), body); + BLOCK_SUBBLOCKS (block) = body; + } + + } + return true; +} + /* Build an expression to initialize the class CLAS. if EXPR is non-NULL, returns an expression to first call the initializer (if it is needed) and then calls EXPR. */ |