diff options
author | Anthony Green <green@cygnus.com> | 2000-02-26 05:12:27 +0000 |
---|---|---|
committer | Anthony Green <green@cygnus.com> | 2000-02-26 05:12:27 +0000 |
commit | ffb2efa33f24a92b692751b7cf27b120d315187d (patch) | |
tree | cfe8d050a2c658d4be3700810c5e25cbdfe9806d /gcc/java/decl.c | |
parent | 35b0ec028da0049f507348145a509a93b3eb9e55 (diff) |
2000-02-25 Anthony Green <green@cygnus.com>
* expr.c (build_class_init): Mark the decl to be ignored by
check_init.
* java-tree.h (DECL_BIT_INDEX): Move definition from check-init.c
* check-init.c: Move DECL_BIT_INDEX to java-tree.h
* class.c (init_test_hash_newfunc): New function.
(decl_hash): New function.
(decl_compare): New function.
* decl.c (emit_init_test_initialization): New function.
(complete_start_java_method): Traverse the init test hashtable,
calling emit_init_test_initialization.
(always_initialize_class_p): Define.
* expr.c (build_class_init): Use initialization tests when
emitting class initialization code.
(always_initialize_class_p): Declare.
* jcf-parse.c (parse_class_file): Set always_initialize_class_p to
1.
* java-tree.h: Include hash.h.
(DECL_FUNCTION_INIT_TEST_TABLE): Define.
(struct lang_decl): Add init_test_table field.
(init_test_hash_entry): Define.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@32166 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/decl.c')
-rw-r--r-- | gcc/java/decl.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 711f9cb3776..46d322b6216 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -48,6 +48,10 @@ static tree lookup_name_current_level PARAMS ((tree)); static tree push_promoted_type PARAMS ((const char *, tree)); static struct binding_level *make_binding_level PARAMS ((void)); +/* Set to non-zero value in order to emit class initilization code + before static field references. */ +extern int always_initialize_class_p; + #ifndef INT_TYPE_SIZE #define INT_TYPE_SIZE BITS_PER_WORD #endif @@ -1623,6 +1627,24 @@ build_result_decl (fndecl) return (DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, restype)); } + +/* Called for every element in DECL_FUNCTION_INIT_TEST_TABLE in order + to emit initialization code for each test flag. */ + +static boolean +emit_init_test_initialization (entry, key) + struct hash_entry *entry; + hash_table_key key; +{ + struct init_test_hash_entry *ite = (struct init_test_hash_entry *) entry; + expand_decl (ite->init_test_decl); + + expand_expr_stmt (build (MODIFY_EXPR, boolean_type_node, + ite->init_test_decl, boolean_false_node)); + + return true; +} + void complete_start_java_method (fndecl) tree fndecl; @@ -1634,6 +1656,11 @@ complete_start_java_method (fndecl) /* Set up parameters and prepare for return, for the function. */ expand_function_start (fndecl, 0); + + /* Emit initialization code for test flags. */ + if (! always_initialize_class_p) + hash_traverse (&DECL_FUNCTION_INIT_TEST_TABLE (fndecl), + emit_init_test_initialization, 0); } /* Allocate further tree nodes temporarily during compilation |