From 358ff2a2827efce7818d9e4c6a7c6f441ad53656 Mon Sep 17 00:00:00 2001 From: Alexandre Petit-Bianco Date: Thu, 9 Aug 2001 04:19:12 +0000 Subject: 2001-08-08 Alexandre Petit-Bianco * 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) git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@44733 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/java/lang.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gcc/java/lang.c') diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 91f89be08e6..b9cb0fea7b6 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -146,6 +146,10 @@ int flag_extraneous_semicolon; /* When non zero, always check for a non gcj generated classes archive. */ int flag_force_classes_archive_check; +/* When zero, don't optimize static class initialization. This flag shouldn't + be tested alone, use STATIC_CLASS_INITIALIZATION_OPTIMIZATION_P instead. */ +int flag_optimize_sci = 1; + /* Table of language-dependent -f options. STRING is the option name. VARIABLE is the address of the variable. ON_VALUE is the value to store in VARIABLE @@ -295,6 +299,15 @@ java_decode_option (argc, argv) } #undef ARG +#undef ARG +#define ARG "-fno-optimize-static-class-initialization" + if (strncmp (p, ARG, sizeof (ARG) - 1) == 0) + { + flag_optimize_sci = 0; + return 1; + } +#undef ARG + if (p[0] == '-' && p[1] == 'f') { /* Some kind of -f option. -- cgit v1.2.3