aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/class.c
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@redhat.com>2001-08-08 21:19:12 -0700
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>2001-08-08 21:19:12 -0700
commit4009bb7d50ece62b164d3717d218ed16b51bddf4 (patch)
tree1c89de048bc9427066e52a374b05b125c6ec6ba2 /gcc/java/class.c
parent6351543d13052c85f87b6e1e8af0273279a5c771 (diff)
downloadgcc-4009bb7d50ece62b164d3717d218ed16b51bddf4.zip
gcc-4009bb7d50ece62b164d3717d218ed16b51bddf4.tar.gz
gcc-4009bb7d50ece62b164d3717d218ed16b51bddf4.tar.bz2
check-init.c (flags.h): Include
2001-08-08 Alexandre Petit-Bianco <apbianco@redhat.com> * check-init.c (flags.h): Include (check_init): Don't report uninitialized static class initialization flags, don't free bit index when doing static class initialization optimization. (check_for_initialization): Return type changed to `unsigned int.' (attach_initialized_static_class): New function. * class.c (add_method_1): Create the initialized static class table if necessary. (finish_class): Always emit deferred inline methods. * decl.c (emit_init_test_initialization): Moved to expr.c (complete_start_java_method): Don't traverse DECL_FUNCTION_INIT_TEST_TABLE. (lang_mark_tree): Mark hash tables in function decls. * expr.c (emit_init_test_initialization): Moved from decl.c. (build_class_init): Create LAG_DECL_SPECIFIC for the static class initialization flag, set DECL_CONTEXT and LOCAL_CLASS_INITIALIZATION_FLAG. (java_lang_expand_expr): Emit initialization code for static class initialized flags when entering block, if necessary. * gcj.texi (-fno-optimize-static-class-initialization): Documented. * java-tree.h (flag_optimize_sci): New global variable declaration. (DECL_FUNCTION_INITIALIZED_CLASS_TABLE): New macro. (DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND): Likewise. (LOCAL_FINAL_P): Fixed typo in comment. (FINAL_VARIABLE_P): Likewise. (LOCAL_CLASS_INITIALIZATIO_FLAG): New macro. (LOCAL_CLASS_INITIALIZATIO_FLAG_P): Likewise. (struct lang_decl): New fields `ict', `smic' and `cif.' (check_for_initialization): New returned value for global. (attach_initialized_static_class): New global function. (STATIC_CLASS_INIT_OPT_P): New macro. * lang-options.h (-fno-optimize-static-class-initialization): New flag. * lang.c (java_decode_option): Handle `-fno-optimize-static-class-initialization' * parse.y (start_complete_expand_method): New function. (java_expand_method_bodies): Likewise. (attach_init_test_initialization_flags): Likewise. (adjust_init_test_initialization): Likewise. (emit_test_initialization): Likewise. (java_complete_expand_methods): Nullify abstract and native method bodies. (java_complete_expand_method): New locals `fbody', `block_body' and `exception_copy.' Reorganized: directly return on empty method bodies, call `start_complete_expand_method', remember definitely initialized static class in function, don't expand method bodies. (java_expand_classes): Call `java_expand_method_bodies' before `finish_class' when compiling to native. (resolve_expression_name): Use `orig' after building outer class field access. (patch_invoke): Remember static method invokations. (http://gcc.gnu.org/ml/gcc-patches/2001-08/msg00454.html) From-SVN: r44733
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r--gcc/java/class.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 8113340..7e153b5 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -673,6 +673,18 @@ add_method_1 (handle_class, access_flags, name, function_type)
init_test_hash_newfunc, java_hash_hash_tree_node,
java_hash_compare_tree_node);
+ /* Initialize the initialized (static) class table. */
+ if (access_flags & ACC_STATIC)
+ hash_table_init (&DECL_FUNCTION_INITIALIZED_CLASS_TABLE (fndecl),
+ init_test_hash_newfunc, java_hash_hash_tree_node,
+ java_hash_compare_tree_node);
+
+ /* Initialize the static method invocation compound table */
+ if (STATIC_CLASS_INIT_OPT_P ())
+ hash_table_init (&DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl),
+ init_test_hash_newfunc, java_hash_hash_tree_node,
+ java_hash_compare_tree_node);
+
TREE_CHAIN (fndecl) = TYPE_METHODS (handle_class);
TYPE_METHODS (handle_class) = fndecl;
@@ -1484,18 +1496,11 @@ finish_class ()
{
if (! TREE_ASM_WRITTEN (method) && DECL_SAVED_INSNS (method) != 0)
{
- /* It's a deferred inline method. Decide if we need to emit it. */
- if (flag_keep_inline_functions
- || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (method))
- || ! METHOD_PRIVATE (method)
- || saw_native_method)
- {
- output_inline_function (method);
- /* Scan the list again to see if there are any earlier
- methods to emit. */
- method = type_methods;
- continue;
- }
+ output_inline_function (method);
+ /* Scan the list again to see if there are any earlier
+ methods to emit. */
+ method = type_methods;
+ continue;
}
method = TREE_CHAIN (method);
}