aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2004-11-09 14:33:32 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2004-11-09 06:33:32 -0800
commit6571838f58d19afb32c2b8e4b03d2855373dd0e5 (patch)
tree9fec2c29b67ab06ca92cbad5fd005cc167f78685 /gcc
parenta0eca485f44e435aeffd11c28a10ba6ddc97dc45 (diff)
downloadgcc-6571838f58d19afb32c2b8e4b03d2855373dd0e5.zip
gcc-6571838f58d19afb32c2b8e4b03d2855373dd0e5.tar.gz
gcc-6571838f58d19afb32c2b8e4b03d2855373dd0e5.tar.bz2
re PR java/15576 (Class initialization optimization is disabled)
2004-11-09 Andrew Pinski <pinskia@physics.uc.edu> PR java/15576 * check-init.c (check_init): Ignore DECL_EXPR. * expr.c (always_initialize_class_p): Reenable. (build_class_init): Use a variable to store the decl. Also use boolean_false_node instead of integer_zero_node. * parse.y (attach_init_test_initialization_flags): Add a decl_expr to the block. From-SVN: r90343
Diffstat (limited to 'gcc')
-rw-r--r--gcc/java/ChangeLog10
-rw-r--r--gcc/java/check-init.c1
-rw-r--r--gcc/java/expr.c23
-rw-r--r--gcc/java/parse.y4
4 files changed, 27 insertions, 11 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 7b4ba0d..7342e8c 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,13 @@
+2004-11-09 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR java/15576
+ * check-init.c (check_init): Ignore DECL_EXPR.
+ * expr.c (always_initialize_class_p): Reenable.
+ (build_class_init): Use a variable to store the decl. Also use
+ boolean_false_node instead of integer_zero_node.
+ * parse.y (attach_init_test_initialization_flags): Add a decl_expr
+ to the block.
+
2004-11-08 Tom Tromey <tromey@redhat.com>
PR java/16843:
diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c
index 1a86c80..dacc4b9 100644
--- a/gcc/java/check-init.c
+++ b/gcc/java/check-init.c
@@ -844,6 +844,7 @@ check_init (tree exp, words before)
case INTEGER_CST:
case REAL_CST:
case STRING_CST:
+ case DECL_EXPR:
case JAVA_EXC_OBJ_EXPR:
break;
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 70156cf..deb75a9 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -95,8 +95,7 @@ tree dtable_ident = NULL_TREE;
/* Set to nonzero value in order to emit class initialization code
before static field references. */
-/* FIXME: Make this work with gimplify. */
-int always_initialize_class_p = 1;
+int always_initialize_class_p = 0;
/* We store the stack state in two places:
Within a basic block, we use the quick_stack, which is a
@@ -1768,6 +1767,7 @@ build_class_init (tree clas, tree expr)
else
{
tree *init_test_decl;
+ tree decl;
init_test_decl = java_treetreehash_new
(DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl), clas);
@@ -1775,19 +1775,20 @@ build_class_init (tree clas, tree expr)
{
/* Build a declaration and mark it as a flag used to track
static class initializations. */
- *init_test_decl = build_decl (VAR_DECL, NULL_TREE,
- boolean_type_node);
- MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (*init_test_decl);
- LOCAL_CLASS_INITIALIZATION_FLAG (*init_test_decl) = 1;
- DECL_CONTEXT (*init_test_decl) = current_function_decl;
- DECL_FUNCTION_INIT_TEST_CLASS (*init_test_decl) = clas;
+ decl = build_decl (VAR_DECL, NULL_TREE,
+ boolean_type_node);
+ MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
+ LOCAL_CLASS_INITIALIZATION_FLAG (decl) = 1;
+ DECL_CONTEXT (decl) = current_function_decl;
+ DECL_FUNCTION_INIT_TEST_CLASS (decl) = clas;
/* Tell the check-init code to ignore this decl when not
optimizing class initialization. */
if (!STATIC_CLASS_INIT_OPT_P ())
- DECL_BIT_INDEX(*init_test_decl) = -1;
- DECL_INITIAL (*init_test_decl) = integer_zero_node;
+ DECL_BIT_INDEX (decl) = -1;
+ DECL_INITIAL (decl) = boolean_false_node;
/* Don't emit any symbolic debugging info for this decl. */
- DECL_IGNORED_P (*init_test_decl) = 1;
+ DECL_IGNORED_P (decl) = 1;
+ *init_test_decl = decl;
}
init = build3 (CALL_EXPR, void_type_node,
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index a2d09bb..d02a448 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -16350,8 +16350,12 @@ attach_init_test_initialization_flags (void **entry, void *ptr)
if (block != error_mark_node)
{
+ 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;
}