aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/decl.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-10-01 19:19:30 +0000
committerMark Mitchell <mark@codesourcery.com>2000-10-01 19:19:30 +0000
commitfe64220eb7f86afdb56fc7425ef7dd7590091afb (patch)
tree0d6ccc526e9f4b851ecc829d656097c5b7e9c8f8 /gcc/java/decl.c
parent5455037c98cb90435501cc622844d7877c2e4392 (diff)
* c-decl.c (c_expand_body): Don't generate RTL if flag_syntax_only.
(lang_mark_false_label_stack): Remove. * c-lex.c (init_c_lex): Add file_info_tree as GC root. Allocate <top level> string in GC area. (mark_splay_tree_node): New function. (mark_splay_tree): Likewise. * except.c (mark_eh_status): Only call lang_mark_false_label_stack if it exists. * ggc-callbacks.c (lang_mark_false_label_stack): Remove. * ggc-common.c (lang_mark_false_label_stack): Change type. * ggc.h (ggc_alloc_string): Add comment. (ggc_strdup): New function. * decl.c (lang_mark_false_label_stack): Remove. * lex.c (cp_mang_lang_type): Use ggc_alloc_cleared. * com.c (lang_mark_false_label_stack): Remove. Convert to GC. * Make-lang.in (s-java): Don't depend on ggc-callbacks.o. * Makefile.in (BACKEND): Don't include ggc-callbacks.o. (typeck.o): Depend on ggc.h. * class.c (add_method_1): Use GC functions for allocation. (init_class_processing): Register roots. * decl.c (ggc_p): Set to 1. (pending_local_decls): Make it static. (push_jvm_slot): Use GC functions for allocation. (init_decl_processing): Register roots. (give_name_to_locals): Use GC functions for allocation. (lang_mark_tree): New function. * java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Use GC functions for allocation. * jcf-parse.c (jcf_parse_source): Use ggc_strdup. * lex.c (java_lex): Use build_string, rather than replicating it inline. * parse.y (goal): Add more roots. (mark_parser_ctxt): New function. * typeck.c: Include ggc.h. * splay-tree.c (splay_tree_insert): Fix formatting. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@36687 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/decl.c')
-rw-r--r--gcc/java/decl.c66
1 files changed, 63 insertions, 3 deletions
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index e1c630db4f5..da44ca6ac81 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -55,6 +55,10 @@ static tree create_primitive_vtable PARAMS ((const char *));
before static field references. */
extern int always_initialize_class_p;
+/* Use garbage collection. */
+
+int ggc_p = 1;
+
/* The DECL_MAP is a mapping from (index, type) to a decl node.
If index < max_locals, it is the index of a local variable.
if index >= max_locals, then index-max_locals is a stack slot.
@@ -68,7 +72,7 @@ tree decl_map;
/* A list of local variables VAR_DECLs for this method that we have seen
debug information, but we have not reached their starting (byte) PC yet. */
-tree pending_local_decls = NULL_TREE;
+static tree pending_local_decls = NULL_TREE;
tree throw_node [2];
@@ -126,7 +130,7 @@ push_jvm_slot (index, decl)
if (DECL_LANG_SPECIFIC (decl) == NULL)
{
DECL_LANG_SPECIFIC (decl)
- = (struct lang_decl *) permalloc (sizeof (struct lang_decl_var));
+ = (struct lang_decl *) ggc_alloc (sizeof (struct lang_decl_var));
DECL_LOCAL_START_PC (decl) = 0;
DECL_LOCAL_END_PC (decl) = DECL_CODE_LENGTH (current_function_decl);
DECL_LOCAL_SLOT_NUMBER (decl) = index;
@@ -851,6 +855,8 @@ init_decl_processing ()
sizeof (throw_node) / sizeof (tree));
ggc_add_tree_root (predef_filenames,
sizeof (predef_filenames) / sizeof (tree));
+ ggc_add_tree_root (&decl_map, 1);
+ ggc_add_tree_root (&pending_local_decls, 1);
}
@@ -1548,7 +1554,7 @@ give_name_to_locals (jcf)
end_pc = DECL_CODE_LENGTH (current_function_decl);
}
DECL_LANG_SPECIFIC (decl)
- = (struct lang_decl *) permalloc (sizeof (struct lang_decl_var));
+ = (struct lang_decl *) ggc_alloc (sizeof (struct lang_decl_var));
DECL_LOCAL_SLOT_NUMBER (decl) = slot;
DECL_LOCAL_START_PC (decl) = start_pc;
#if 0
@@ -1818,3 +1824,57 @@ end_java_method ()
permanent_allocation (1);
asynchronous_exceptions = flag_asynchronous_exceptions;
}
+
+/* Mark language-specific parts of T for garbage-collection. */
+
+void
+lang_mark_tree (t)
+ tree t;
+{
+ if (TREE_CODE (t) == IDENTIFIER_NODE)
+ {
+ struct lang_identifier *li = (struct lang_identifier *) t;
+ ggc_mark_tree (li->global_value);
+ ggc_mark_tree (li->local_value);
+ ggc_mark_tree (li->utf8_ref);
+ }
+ else if (TREE_CODE (t) == VAR_DECL
+ || TREE_CODE (t) == PARM_DECL)
+ {
+ struct lang_decl_var *ldv =
+ ((struct lang_decl_var *) DECL_LANG_SPECIFIC (t));
+ if (ldv)
+ {
+ ggc_mark (ldv);
+ ggc_mark_tree (ldv->slot_chain);
+ }
+ }
+ else if (TREE_CODE (t) == FUNCTION_DECL)
+ {
+ struct lang_decl *ld = DECL_LANG_SPECIFIC (t);
+
+ if (ld)
+ {
+ ggc_mark (ld);
+ ggc_mark_tree (ld->throws_list);
+ ggc_mark_tree (ld->function_decl_body);
+ ggc_mark_tree (ld->called_constructor);
+ ggc_mark_tree (ld->inner_access);
+ }
+ }
+ else if (TYPE_P (t))
+ {
+ struct lang_type *lt = TYPE_LANG_SPECIFIC (t);
+
+ if (lt)
+ {
+ ggc_mark (lt);
+ ggc_mark_tree (lt->signature);
+ ggc_mark_tree (lt->cpool_data_ref);
+ ggc_mark_tree (lt->finit_stmt_list);
+ ggc_mark_tree (lt->clinit_stmt_list);
+ ggc_mark_tree (lt->ii_block);
+ ggc_mark_tree (lt->dot_class);
+ }
+ }
+}