[PATCH] Java: always use cgraph
Jeff Sturm
jsturm@one-point.com
Sun Sep 28 06:52:00 GMT 2003
Jan Hubicka mentioned that it is no longer necessary to avoid
cgraph_finalize_function when not compiling in unit-at-a-time mode.
Neither the C or C++ FEs do, and Jan indicated some code cleanup can take
place in the non-cgraph inlining heuristics if we remove this from
Java.
This doesn't affect flag_unit_at_a_time behavior for Java. Classes will
still be compiled individually at -O0 or -O1.
Tested on i686-pc-linux-gnu. OK for mainline?
Jeff
2003-09-28 Jeff Sturm <jsturm@one-point.com>
* decl.c (java_optimize_inline, dump_function): Remove.
* java-tree.h (java_optimize_inline): Remove declaration.
* jcf-parse.c (java_parse_file): Assume flag_unit_at_a_time is set.
* parse.y (source_end_java_method, java_expand_classes):
Likewise. Remove dead code.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.164
diff -u -p -r1.164 decl.c
--- decl.c 23 Sep 2003 03:05:30 -0000 1.164
+++ decl.c 28 Sep 2003 05:58:28 -0000
@@ -57,7 +57,6 @@ static struct binding_level *make_bindin
static tree create_primitive_vtable (const char *);
static tree check_local_named_variable (tree, tree, int, int *);
static tree check_local_unnamed_variable (tree, tree, tree);
-static void dump_function (enum tree_dump_index, tree);
/* Name of the Cloneable class. */
tree java_lang_cloneable_identifier_node;
@@ -1863,33 +1862,6 @@ java_expand_body (tree fndecl)
input_line = saved_lineno;
current_function_decl = NULL_TREE;
-}
-
-/* Dump FUNCTION_DECL FN as tree dump PHASE. */
-
-static void
-dump_function (enum tree_dump_index phase, tree fn)
-{
- FILE *stream;
- int flags;
-
- stream = dump_begin (phase, &flags);
- if (stream)
- {
- dump_node (fn, TDF_SLIM | flags, stream);
- dump_end (phase, stream);
- }
-}
-
-void java_optimize_inline (tree fndecl)
-{
- if (flag_inline_trees)
- {
- timevar_push (TV_INTEGRATION);
- optimize_inline_calls (fndecl);
- timevar_pop (TV_INTEGRATION);
- dump_function (TDI_inlined, fndecl);
- }
}
/* We pessimistically marked all methods and fields external until we
Index: java-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.h,v
retrieving revision 1.183
diff -u -p -r1.183 java-tree.h
--- java-tree.h 3 Sep 2003 13:44:43 -0000 1.183
+++ java-tree.h 28 Sep 2003 05:58:29 -0000
@@ -1281,7 +1281,6 @@ extern void append_gpp_mangled_name (con
extern void add_predefined_file (tree);
extern int predefined_filename_p (tree);
-extern void java_optimize_inline (tree);
extern tree decl_constant_value (tree);
extern void java_mark_class_local (tree);
Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.145
diff -u -p -r1.145 jcf-parse.c
--- jcf-parse.c 22 Sep 2003 05:09:31 -0000 1.145
+++ jcf-parse.c 28 Sep 2003 05:58:29 -0000
@@ -1120,13 +1120,12 @@ java_parse_file (int set_yydebug ATTRIBU
java_expand_classes ();
if (!java_report_errors () && !flag_syntax_only)
{
- if (flag_unit_at_a_time)
- {
- cgraph_finalize_compilation_unit ();
- cgraph_optimize ();
- java_finish_classes ();
- }
+ /* Optimize and expand all classes compiled from source. */
+ cgraph_finalize_compilation_unit ();
+ cgraph_optimize ();
+ java_finish_classes ();
+ /* Emit the .jcf section. */
emit_register_classes ();
if (flag_indirect_dispatch)
emit_offset_symbol_table ();
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.445
diff -u -p -r1.445 parse.y
--- parse.y 27 Sep 2003 20:17:21 -0000 1.445
+++ parse.y 28 Sep 2003 05:58:30 -0000
@@ -7484,20 +7484,11 @@ source_end_java_method (void)
patched. Dump it to a file if the user requested it. */
dump_java_tree (TDI_original, fndecl);
- /* In unit-at-a-time mode, don't expand the method yet. */
- if (DECL_SAVED_TREE (fndecl) && flag_unit_at_a_time)
- {
- cgraph_finalize_function (fndecl, false);
- current_function_decl = NULL_TREE;
- java_parser_context_restore_global ();
- return;
- }
-
- java_optimize_inline (fndecl);
-
- /* Expand the function's body. */
- java_expand_body (fndecl);
+ /* Defer expanding the method until cgraph analysis is complete. */
+ if (DECL_SAVED_TREE (fndecl))
+ cgraph_finalize_function (fndecl, false);
+ current_function_decl = NULL_TREE;
java_parser_context_restore_global ();
}
@@ -9157,11 +9148,7 @@ java_expand_classes (void)
if (flag_emit_xref)
expand_xref (current_class);
else if (! flag_syntax_only)
- {
- java_expand_method_bodies (current_class);
- if (!flag_unit_at_a_time)
- finish_class ();
- }
+ java_expand_method_bodies (current_class);
}
}
}
More information about the Gcc-patches
mailing list