java-tree.h: Added init state enum.
* java-tree.h: Added init state enum. * decl.c (emit_init_test_initialization): Initialize class initialization check variable by looking at class' state. From-SVN: r34022
This commit is contained in:
parent
43490bec9d
commit
67db0ce748
4 changed files with 43 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
|||
2000-05-19 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* java-tree.h: Added init state enum.
|
||||
* decl.c (emit_init_test_initialization): Initialize class
|
||||
initialization check variable by looking at class' state.
|
||||
|
||||
2000-05-19 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* java-tree.h (build_instanceof): Declare.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1165,4 +1165,25 @@ extern int java_error_count; \
|
|||
return; \
|
||||
}
|
||||
|
||||
/* These are the possible values for the `state' field of the class
|
||||
structure. This must be kept in sync with libgcj. */
|
||||
enum
|
||||
{
|
||||
JV_STATE_NOTHING = 0, /* Set by compiler. */
|
||||
|
||||
JV_STATE_PRELOADING = 1, /* Can do _Jv_FindClass. */
|
||||
JV_STATE_LOADING = 3, /* Has super installed. */
|
||||
JV_STATE_LOADED = 5, /* Is complete. */
|
||||
|
||||
JV_STATE_COMPILED = 6, /* This was a compiled class. */
|
||||
|
||||
JV_STATE_PREPARED = 7, /* Layout & static init done. */
|
||||
JV_STATE_LINKED = 9, /* Strings interned. */
|
||||
|
||||
JV_STATE_IN_PROGRESS = 10, /* <Clinit> running. */
|
||||
JV_STATE_DONE = 12,
|
||||
|
||||
JV_STATE_ERROR = 14 /* must be last. */
|
||||
};
|
||||
|
||||
#undef DEBUG_JAVA_BINDING_LEVELS
|
||||
|
|
|
@ -12346,18 +12346,7 @@ patch_binop (node, wfl_op1, wfl_op2)
|
|||
}
|
||||
/* Otherwise we have to invoke instance of to figure it out */
|
||||
else
|
||||
{
|
||||
tree call =
|
||||
build (CALL_EXPR, boolean_type_node,
|
||||
build_address_of (soft_instanceof_node),
|
||||
tree_cons
|
||||
(NULL_TREE, op1,
|
||||
build_tree_list (NULL_TREE,
|
||||
build_class_ref (op2_type))),
|
||||
NULL_TREE);
|
||||
TREE_SIDE_EFFECTS (call) = TREE_SIDE_EFFECTS (op1);
|
||||
return call;
|
||||
}
|
||||
return build_instanceof (op1, op2_type);
|
||||
}
|
||||
/* There is no way the expression operand can be an instance of
|
||||
the type operand. This is a compile time error. */
|
||||
|
@ -14604,8 +14593,6 @@ fold_constant_for_init (node, context)
|
|||
|
||||
if (code == INTEGER_CST || code == REAL_CST)
|
||||
return convert (TREE_TYPE (context), node);
|
||||
if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
|
||||
return NULL_TREE;
|
||||
|
||||
switch (code)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue