summaryrefslogtreecommitdiffstats
path: root/gcc/java
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-26 18:04:45 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-26 18:04:45 +0000
commit549839e78ddb78fc6f722fd910bd8c5d0e5f326c (patch)
treefd510bfba4be46b5f8449a5f32932ed69e327402 /gcc/java
parentfc64a85ec52360dc6a70965820efc1ba38eb61b9 (diff)
downloadppe42-gcc-549839e78ddb78fc6f722fd910bd8c5d0e5f326c.tar.gz
ppe42-gcc-549839e78ddb78fc6f722fd910bd8c5d0e5f326c.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91343 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog12
-rw-r--r--gcc/java/decl.c11
-rw-r--r--gcc/java/expr.c33
-rw-r--r--gcc/java/java-tree.h1
-rw-r--r--gcc/java/jcf-parse.c4
-rw-r--r--gcc/java/parse.y21
6 files changed, 57 insertions, 25 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index ce06a29633e..74a18c994fe 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
2004-11-25 Joseph S. Myers <joseph@codesourcery.com>
* gjavah.c, jcf-dump.c, jv-scan.c, jvspec.c: Avoid ` as left quote
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 54f788e0d7d..103a11225e9 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -1931,6 +1931,17 @@ end_java_method (void)
poplevel (1, 0, 1);
BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
+
+ if (DECL_SAVED_TREE (fndecl))
+ {
+ tree fbody, block_body;
+ /* Before we check initialization, attached all class initialization
+ variable to the block_body */
+ fbody = DECL_SAVED_TREE (fndecl);
+ block_body = BIND_EXPR_BODY (fbody);
+ htab_traverse (DECL_FUNCTION_INIT_TEST_TABLE (fndecl),
+ attach_init_test_initialization_flags, block_body);
+ }
flag_unit_at_a_time = 0;
finish_method (fndecl);
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 305ab5bdfee..0fef94db9d4 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. */
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index e8144ee908c..54cf01bbc0c 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -1255,6 +1255,7 @@ extern void initialize_builtins (void);
extern tree lookup_name (tree);
extern tree build_known_method_ref (tree, tree, tree, tree, tree);
extern tree build_class_init (tree, tree);
+extern int attach_init_test_initialization_flags (void **, void *);
extern tree build_invokevirtual (tree, tree);
extern tree build_invokeinterface (tree, tree);
extern tree build_jni_stub (tree);
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index a7cd57a6d77..429e3db3a22 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -827,10 +827,6 @@ parse_class_file (void)
file_start_location = input_location;
(*debug_hooks->start_source_file) (input_line, input_filename);
- /* Currently we always have to emit calls to _Jv_InitClass when
- compiling from class files. */
- always_initialize_class_p = 1;
-
gen_indirect_dispatch_tables (current_class);
java_mark_class_local (current_class);
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 91776c6f7f5..2b3d3a4a795 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -347,7 +347,6 @@ static tree build_dot_class_method_invocation (tree, tree);
static void create_new_parser_context (int);
static tree maybe_build_class_init_for_field (tree, tree);
-static int attach_init_test_initialization_flags (void **, void *);
static int emit_test_initialization (void **, void *);
static char *string_convert_int_cst (tree);
@@ -16345,26 +16344,6 @@ init_src_parse (void)
/* This section deals with the functions that are called when tables
recording class initialization information are traversed. */
-/* Attach to PTR (a block) the declaration found in ENTRY. */
-
-static 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)
- {
- 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;
-}
-
/* This function is called for each class that is known definitely
initialized when a given static method was called. This function
augments a compound expression (INFO) storing all assignment to
OpenPOWER on IntegriCloud