summaryrefslogtreecommitdiffstats
path: root/gcc/java/decl.c
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-19 16:04:10 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-19 16:04:10 +0000
commit483c9a9d5781a1999bb66b43ebe3b0a814da797d (patch)
tree0416c1ff3b56daf1ff3a14bd481b259133e60841 /gcc/java/decl.c
parent7b842db5ca374847b457598cad403e7bb840f55e (diff)
downloadppe42-gcc-483c9a9d5781a1999bb66b43ebe3b0a814da797d.tar.gz
ppe42-gcc-483c9a9d5781a1999bb66b43ebe3b0a814da797d.zip
* java-tree.h: Added init state enum.
* decl.c (emit_init_test_initialization): Initialize class initialization check variable by looking at class' state. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34022 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/decl.c')
-rw-r--r--gcc/java/decl.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index a79bb911252..c5008a0adda 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -1681,17 +1681,29 @@ build_result_decl (fndecl)
/* 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 ATTRIBUTE_UNUSED;
{
struct init_test_hash_entry *ite = (struct init_test_hash_entry *) entry;
+ tree klass = build_class_ref ((tree) entry->key);
expand_decl (ite->init_test_decl);
- expand_expr_stmt (build (MODIFY_EXPR, boolean_type_node,
- ite->init_test_decl, boolean_false_node));
+ /* We initialize the class init check variable by looking at the
+ `state' field of the class to see if it is already initialized.
+ This makes things a bit faster if the class is already
+ initialized, which should be the common case. */
+ expand_expr_stmt
+ (build (MODIFY_EXPR, boolean_type_node,
+ ite->init_test_decl,
+ build (GE_EXPR, boolean_type_node,
+ build (COMPONENT_REF, byte_type_node,
+ build1 (INDIRECT_REF, class_type_node, klass),
+ lookup_field (&class_type_node,
+ get_identifier ("state"))),
+ build_int_2 (JV_STATE_DONE, 0))));
return true;
}
OpenPOWER on IntegriCloud