aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/class.c
diff options
context:
space:
mode:
authorAnthony Green <green@cygnus.com>2000-02-26 05:12:27 +0000
committerAnthony Green <green@gcc.gnu.org>2000-02-26 05:12:27 +0000
commit3ff9925ce0be6f6e72f8da4d8ec96aad25e593f2 (patch)
treecfe8d050a2c658d4be3700810c5e25cbdfe9806d /gcc/java/class.c
parent985dae7cdd18b543af8396c61c5332d685e47745 (diff)
downloadgcc-3ff9925ce0be6f6e72f8da4d8ec96aad25e593f2.zip
gcc-3ff9925ce0be6f6e72f8da4d8ec96aad25e593f2.tar.gz
gcc-3ff9925ce0be6f6e72f8da4d8ec96aad25e593f2.tar.bz2
expr.c (build_class_init): Mark the decl to be ignored by check_init.
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. From-SVN: r32166
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r--gcc/java/class.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c
index a62f890..af56f74 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -389,7 +389,7 @@ set_super_info (access_flags, this_class, super_class, interfaces_count)
CLASS_HAS_SUPER (this_class) = 1;
}
pop_obstacks ();
-
+
if (access_flags & ACC_PUBLIC) CLASS_PUBLIC (class_decl) = 1;
if (access_flags & ACC_FINAL) CLASS_FINAL (class_decl) = 1;
if (access_flags & ACC_SUPER) CLASS_SUPER (class_decl) = 1;
@@ -548,6 +548,40 @@ build_java_method_type (fntype, this_class, access_flags)
return build_method_type (CLASS_TO_HANDLE_TYPE (this_class), fntype);
}
+static struct hash_entry *
+init_test_hash_newfunc (entry, table, string)
+ struct hash_entry *entry;
+ struct hash_table *table;
+ hash_table_key string ATTRIBUTE_UNUSED;
+{
+ struct init_test_hash_entry *ret = (struct init_test_hash_entry *) entry;
+ if (ret == NULL)
+ {
+ ret = ((struct init_test_hash_entry *)
+ hash_allocate (table, sizeof (struct init_test_hash_entry)));
+ if (ret == NULL)
+ return NULL;
+ }
+ ret->init_test_decl = 0;
+ return (struct hash_entry *) ret;
+}
+
+static unsigned long
+decl_hash (k)
+ hash_table_key k;
+{
+ return (long) k;
+}
+
+static boolean
+decl_compare (k1, k2)
+ hash_table_key k1;
+ hash_table_key k2;
+{
+ return ((char*) k1 == (char*) k2);
+}
+
+
tree
add_method_1 (handle_class, access_flags, name, function_type)
tree handle_class;
@@ -568,6 +602,11 @@ add_method_1 (handle_class, access_flags, name, function_type)
= (struct lang_decl *) permalloc (sizeof (struct lang_decl));
bzero ((PTR) DECL_LANG_SPECIFIC (fndecl), sizeof (struct lang_decl));
+ /* Initialize the static initializer test table. */
+ hash_table_init (&DECL_FUNCTION_INIT_TEST_TABLE (fndecl),
+ init_test_hash_newfunc, decl_hash,
+ decl_compare);
+
TREE_CHAIN (fndecl) = TYPE_METHODS (handle_class);
TYPE_METHODS (handle_class) = fndecl;
pop_obstacks ();