diff options
author | Per Bothner <per@bothner.com> | 2001-12-06 15:12:55 -0800 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2001-12-06 15:12:55 -0800 |
commit | 5412ef6bba5b252ccb88f778025e6c21cc075883 (patch) | |
tree | 0329e48c15d6e4c56f175ddff6166ec1395400e4 /gcc/java/check-init.c | |
parent | c1bf99a2ab955f1b5945ceb0f62a4e1652fe0c02 (diff) | |
download | gcc-5412ef6bba5b252ccb88f778025e6c21cc075883.zip gcc-5412ef6bba5b252ccb88f778025e6c21cc075883.tar.gz gcc-5412ef6bba5b252ccb88f778025e6c21cc075883.tar.bz2 |
Restore support for static class initialization optimization.
From-SVN: r47735
Diffstat (limited to 'gcc/java/check-init.c')
-rw-r--r-- | gcc/java/check-init.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c index e8329c9..1db19b9 100644 --- a/gcc/java/check-init.c +++ b/gcc/java/check-init.c @@ -96,7 +96,7 @@ static tree wfl; #define INTERSECT(DST, SRC1, SRC2) \ INTERSECTN (DST, SRC1, SRC2, num_current_words) -#define WORD_SIZE ((unsigned int)(sizeof(word) * 8)) +#define WORD_SIZE ((unsigned int)(sizeof(word) * BITS_PER_UNIT)) static void check_bool_init PARAMS ((tree, words, words, words)); static void check_init PARAMS ((tree, words)); @@ -595,6 +595,24 @@ check_init (exp, before) SET_UNASSIGNED (tmp, i); } check_init (BLOCK_EXPR_BODY (exp), tmp); + + /* Re-set DECL_BIT_INDEX since it is also DECL_POINTER_ALIAS_SET. */ + for (decl = BLOCK_EXPR_DECLS (exp); + decl != NULL_TREE; decl = TREE_CHAIN (decl)) + { + if (LOCAL_CLASS_INITIALIZATION_FLAG_P (decl)) + { + int index = DECL_BIT_INDEX (decl); + tree fndecl = DECL_CONTEXT (decl); + if (fndecl && METHOD_STATIC (fndecl) + && (DECL_INITIAL (decl) == boolean_true_node + || (index >= 0 && ASSIGNED_P (tmp, index)))) + hash_lookup (&DECL_FUNCTION_INITIALIZED_CLASS_TABLE (fndecl), + DECL_FUNCTION_INIT_TEST_CLASS(decl), TRUE, NULL); + } + DECL_BIT_INDEX (decl) = -1; + } + num_current_locals = start_current_locals; start_current_locals = save_start_current_locals; if (tmp != before) @@ -603,13 +621,6 @@ check_init (exp, before) COPY (before, tmp); FREE_WORDS (tmp); } - - /* Re-set DECL_BIT_INDEX since it is also DECL_POINTER_ALIAS_SET. */ - for (decl = BLOCK_EXPR_DECLS (exp); - decl != NULL_TREE; decl = TREE_CHAIN (decl)) - { - DECL_BIT_INDEX (decl) = -1; - } } break; case LOOP_EXPR: |