aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/jcf-parse.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2001-01-21 13:24:30 -0800
committerPer Bothner <bothner@gcc.gnu.org>2001-01-21 13:24:30 -0800
commitb5c4fed92cb6d5fe30e6eac39d1299b2cf998c9d (patch)
treefb724a1bb57c4396ebb107ef33d32b2bef5e0b7a /gcc/java/jcf-parse.c
parent3432b91b650d7b134217ee74392840f6a4d85c4b (diff)
downloadgcc-b5c4fed92cb6d5fe30e6eac39d1299b2cf998c9d.zip
gcc-b5c4fed92cb6d5fe30e6eac39d1299b2cf998c9d.tar.gz
gcc-b5c4fed92cb6d5fe30e6eac39d1299b2cf998c9d.tar.bz2
Minor optimization of static ggc roots.
* jcf-parse.c (parse_roots): New static field. (current_field, current_method, current_file_list): Replace by macros naming fields of parse_roots. (init_jcf_parse): Combine 3 ggc_add_tree_root calls to 1. * class.c (class_roots): New static field. (registered_class, fields_ident, info_ident, class_list): New macros naming fields of parse_roots. (build_static_field_ref): Don't register roots here. (layout_class): Static field list replaced by macro class_list. (init_class_processing): Call ggc_add_tree_root for 4 roots. Initialize fields_ident and info_ident here. From-SVN: r39174
Diffstat (limited to 'gcc/java/jcf-parse.c')
-rw-r--r--gcc/java/jcf-parse.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index b1214d4..61c3c15 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -70,14 +70,16 @@ extern struct obstack permanent_obstack;
before static field references. */
extern int always_initialize_class_p;
+static tree parse_roots[3] = { NULL_TREE, NULL_TREE, NULL_TREE };
+
/* The FIELD_DECL for the current field. */
-static tree current_field = NULL_TREE;
+#define current_field parse_roots[0]
/* The METHOD_DECL for the current method. */
-static tree current_method = NULL_TREE;
+#define current_method parse_roots[1]
/* A list of file names. */
-static tree current_file_list = NULL_TREE;
+#define current_file_list parse_roots[2]
/* The Java .class file that provides main_class; the main input file. */
static struct JCF main_jcf[1];
@@ -1119,9 +1121,7 @@ void
init_jcf_parse ()
{
/* Register roots with the garbage collector. */
- ggc_add_tree_root (&current_field, 1);
- ggc_add_tree_root (&current_method, 1);
- ggc_add_tree_root (&current_file_list, 1);
+ ggc_add_tree_root (parse_roots, sizeof (parse_roots) / sizeof(tree));
ggc_add_root (&current_jcf, 1, sizeof (JCF), ggc_mark_jcf);
}