summaryrefslogtreecommitdiff
path: root/gcc/java/lang.c
diff options
context:
space:
mode:
authorjsturm <jsturm@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-03 13:44:43 +0000
committerjsturm <jsturm@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-03 13:44:43 +0000
commit9d5ed6b320ec9ecf17c09f3fece86feeaa59ffaa (patch)
tree67c1212abb34f567ee45068cdd132021ed676e26 /gcc/java/lang.c
parent15425f9168ca854aa0710f6bf96927dbe85db7f2 (diff)
downloadgcc-9d5ed6b320ec9ecf17c09f3fece86feeaa59ffaa.tar.gz
* decl.c (java_expand_body): New function.
* expr.c (build_class_init): Set DECL_IGNORED_P. * java-tree.h (start_complete_expand_method, java_expand_body): Declare. * jcf-parse.c (cgraph.h): Include. (java_parse_file): Handle flag_unit_at_a_time. * lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING, LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Define. (java_estimate_num_insns): Use walk_tree_without_duplicates. (java_start_inlining): New function. * parse.h (java_finish_classes): Declare. * parse.y: Include cgraph.h. (block): Don't special-case empty block production. (craft_constructor): Set DECL_INLINE. (source_end_java_method): Handle flag_unit_at_a_time. Replace inline code with call to java_expand_body. (start_complete_expand_method): Remove static modifier. (java_expand_method_bodies): Patch function tree for class initialization and/or synchronization as needed. Don't begin RTL expansion yet. (java_expand_classes): Check flag_unit_at_a_time before calling finish_class. (java_finish_classes): New function. (java_complete_lhs): Ensure COMPOUND_EXPR has non-NULL type. (patch_assignment): Set DECL_CONTEXT on temporary variable. (emit_test_initialization): Set DECL_IGNORED_P. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71024 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/lang.c')
-rw-r--r--gcc/java/lang.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 6bddf38335d..5ade4c0844c 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -67,6 +67,7 @@ static bool java_dump_tree (void *, tree);
static void dump_compound_expr (dump_info_p, tree);
static bool java_decl_ok_for_sibcall (tree);
static int java_estimate_num_insns (tree);
+static int java_start_inlining (tree);
#ifndef TARGET_OBJECT_SUFFIX
# define TARGET_OBJECT_SUFFIX ".o"
@@ -253,12 +254,18 @@ struct language_function GTY(())
#undef LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS
#define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS java_estimate_num_insns
+#undef LANG_HOOKS_TREE_INLINING_START_INLINING
+#define LANG_HOOKS_TREE_INLINING_START_INLINING java_start_inlining
+
#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN java_dump_tree
#undef LANG_HOOKS_DECL_OK_FOR_SIBCALL
#define LANG_HOOKS_DECL_OK_FOR_SIBCALL java_decl_ok_for_sibcall
+#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
+#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION java_expand_body
+
/* Each front end provides its own. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
@@ -1178,8 +1185,21 @@ static int
java_estimate_num_insns (tree decl)
{
int num = 0;
- walk_tree (&DECL_SAVED_TREE (decl), java_estimate_num_insns_1, &num, NULL);
+ walk_tree_without_duplicates (&DECL_SAVED_TREE (decl),
+ java_estimate_num_insns_1, &num);
return num;
}
+/* Start inlining fn. Called by the tree inliner via
+ lang_hooks.tree_inlining.cannot_inline_tree_fn. */
+
+static int
+java_start_inlining (tree fn)
+{
+ /* A java function's body doesn't have a BLOCK structure suitable
+ for debug output until it is expanded. Prevent inlining functions
+ that are not yet expanded. */
+ return TREE_ASM_WRITTEN (fn) ? 1 : 0;
+}
+
#include "gt-java-lang.h"