From f15b9af9843e58e7c03df81098a8a15646f5058e Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 1 Oct 2000 19:19:30 +0000 Subject: [PATCH] c-decl.c (c_expand_body): Don't generate RTL if flag_syntax_only. * 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 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. From-SVN: r36687 --- gcc/ChangeLog | 15 ++++++++++ gcc/c-decl.c | 16 ++++------ gcc/c-lex.c | 29 ++++++++++++++++++- gcc/cp/ChangeLog | 5 ++++ gcc/cp/decl.c | 8 ----- gcc/cp/lex.c | 4 +-- gcc/except.c | 3 +- gcc/f/ChangeLog | 4 +++ gcc/f/com.c | 9 ------ gcc/ggc-callbacks.c | 10 +------ gcc/ggc-common.c | 6 ++++ gcc/ggc.h | 16 +++++++--- gcc/java/ChangeLog | 23 +++++++++++++++ gcc/java/Make-lang.in | 2 +- gcc/java/Makefile.in | 4 +-- gcc/java/class.c | 4 +-- gcc/java/decl.c | 66 ++++++++++++++++++++++++++++++++++++++++-- gcc/java/java-tree.h | 14 ++++----- gcc/java/jcf-parse.c | 2 +- gcc/java/lex.c | 9 +----- gcc/java/parse.y | 45 +++++++++++++++++++++++++++- gcc/java/typeck.c | 1 + libiberty/ChangeLog | 4 +++ libiberty/splay-tree.c | 4 +-- 24 files changed, 230 insertions(+), 73 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5b80c099903..93353aa38c3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2000-10-01 Mark Mitchell + + * 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 + 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. + Sat Sep 23 19:10:20 2000 Denis Chertykov * config/avr/avr.h (BRANCH_COST): Define as 0. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index a197601407a..940d4b18393 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6705,6 +6705,11 @@ c_expand_body (fndecl, nested_p) tree fndecl; int nested_p; { + /* There's no reason to do any of the work here if we're only doing + semantic analysis; this code just generates RTL. */ + if (flag_syntax_only) + return; + /* Squirrel away our current state. */ if (nested_p) push_function_context (); @@ -6982,17 +6987,6 @@ copy_lang_decl (decl) DECL_LANG_SPECIFIC (decl) = ld; } -/* Mark ARG for GC. */ - -void -lang_mark_false_label_stack (arg) - struct label_node *arg; -{ - /* C doesn't use false_label_stack. It better be NULL. */ - if (arg != NULL) - abort (); -} - /* Mark the language specific bits in T for GC. */ void diff --git a/gcc/c-lex.c b/gcc/c-lex.c index f6dee4d5867..693615361fc 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -149,6 +149,8 @@ static tree lex_string PARAMS ((const char *, unsigned int, int)); static tree lex_charconst PARAMS ((const char *, unsigned int, int)); static void update_header_times PARAMS ((const char *)); static int dump_one_header PARAMS ((splay_tree_node, void *)); +static int mark_splay_tree_node PARAMS ((splay_tree_node, void *)); +static void mark_splay_tree PARAMS ((void *)); #if !USE_CPPLIB static int skip_white_space PARAMS ((int)); @@ -176,7 +178,10 @@ init_c_lex (filename) file_info_tree = splay_tree_new ((splay_tree_compare_fn)strcmp, 0, (splay_tree_delete_value_fn)free); - toplevel = get_fileinfo (""); + /* Make sure to mark the filenames in the tree for GC. */ + ggc_add_root (&file_info_tree, 1, sizeof (file_info_tree), + mark_splay_tree); + toplevel = get_fileinfo (ggc_strdup ("")); if (flag_detailed_statistics) { header_time = 0; @@ -2540,3 +2545,25 @@ lex_charconst (str, len, wide) return value; } + +/* Mark for GC a node in a splay tree whose keys are strings. */ + +static int +mark_splay_tree_node (n, data) + splay_tree_node n; + void *data ATTRIBUTE_UNUSED; +{ + ggc_mark_string ((char *) n->key); + return 0; +} + +/* Mark for GC a splay tree whose keys are strings. */ + +static void +mark_splay_tree (p) + void *p; +{ + splay_tree st = *(splay_tree *) p; + + splay_tree_foreach (st, mark_splay_tree_node, NULL); +} diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ead72e2924b..2adea2e6094 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-10-01 Mark Mitchell + + * decl.c (lang_mark_false_label_stack): Remove. + * lex.c (cp_mang_lang_type): Use ggc_alloc_cleared. + 2000-09-30 Joseph S. Myers * gxxint.texi: Use @email for formatting email addresses. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e016e332104..d467f5a5f1b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -14646,14 +14646,6 @@ mark_cp_function_context (f) mark_lang_function ((struct cp_language_function *) f->language); } -void -lang_mark_false_label_stack (l) - struct label_node *l; -{ - /* C++ doesn't use false_label_stack. It better be NULL. */ - my_friendly_assert (l == NULL, 19990904); -} - void lang_mark_tree (t) tree t; diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 43d70941ec4..2b32d01f4b3 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -1616,8 +1616,8 @@ cp_make_lang_type (code) { struct lang_type *pi; - pi = (struct lang_type *) ggc_alloc (sizeof (struct lang_type)); - bzero ((char *) pi, (int) sizeof (struct lang_type)); + pi = ((struct lang_type *) + ggc_alloc_cleared (sizeof (struct lang_type))); TYPE_LANG_SPECIFIC (t) = pi; SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown); diff --git a/gcc/except.c b/gcc/except.c index fb697a845e7..efa61e5bbef 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -2607,7 +2607,8 @@ mark_eh_status (eh) mark_eh_queue (eh->x_ehqueue); ggc_mark_rtx (eh->x_catch_clauses); - lang_mark_false_label_stack (eh->x_false_label_stack); + if (lang_mark_false_label_stack) + (*lang_mark_false_label_stack) (eh->x_false_label_stack); mark_tree_label_node (eh->x_caught_return_label_stack); ggc_mark_tree (eh->x_protect_list); diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 4ca227248b8..3ec2c9e6655 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,7 @@ +Sun Oct 1 11:43:44 2000 Mark Mitchell + + * com.c (lang_mark_false_label_stack): Remove. + 2000-09-10 Zack Weinberg * com.c: Include defaults.h. diff --git a/gcc/f/com.c b/gcc/f/com.c index c3a50e92a20..9cc31e908b2 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -15824,15 +15824,6 @@ lang_mark_tree (t) ggc_mark (TYPE_LANG_SPECIFIC (t)); } -void -lang_mark_false_label_stack (l) - struct label_node *l; -{ - /* Fortran doesn't use false_label_stack. It better be NULL. */ - if (l != NULL) - abort(); -} - #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */ #if FFECOM_GCC_INCLUDE diff --git a/gcc/ggc-callbacks.c b/gcc/ggc-callbacks.c index c56e13ea307..b53af557978 100644 --- a/gcc/ggc-callbacks.c +++ b/gcc/ggc-callbacks.c @@ -1,5 +1,5 @@ /* Empty GC callbacks to be used by languages that don't support GC. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. This file is part of GNU CC. @@ -36,11 +36,3 @@ lang_mark_tree (t) abort (); } -void ATTRIBUTE_NORETURN -lang_mark_false_label_stack (l) - struct label_node *l ATTRIBUTE_UNUSED; -{ - /* If this function is called, we are doing GC. But, this file is - only included in compilers for languages that don't support GC. */ - abort (); -} diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 5f6f0c01fc5..2915b731f39 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -33,6 +33,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* Statistics about the allocation. */ static ggc_statistics *ggc_stats; +/* The FALSE_LABEL_STACK, declared in except.h, has language-dependent + semantics. If a front-end needs to mark the false label stack, it + should set this pointer to a non-NULL value. Otherwise, no marking + will be done. */ +void (*lang_mark_false_label_stack) PARAMS ((struct label_node *)); + /* Trees that have been marked, but whose children still need marking. */ varray_type ggc_pending_trees; diff --git a/gcc/ggc.h b/gcc/ggc.h index 8796fd1a830..1a5b4d886af 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -142,8 +142,15 @@ void *ggc_alloc_cleared PARAMS ((size_t)); #define ggc_alloc_tree(LENGTH) ((union tree_node *) ggc_alloc (LENGTH)) +/* Allocate a gc-able string. If CONTENTS is null, then the memory will + be uninitialized. If LENGTH is -1, then CONTENTS is assumed to be a + null-terminated string and the memory sized accordingly. Otherwise, + the memory is filled with LENGTH bytes from CONTENTS. */ char *ggc_alloc_string PARAMS ((const char *contents, int length)); +/* Make a copy of S, in GC-able memory. */ +#define ggc_strdup(S) ggc_alloc_string((S), -1) + /* Invoke the collector. This is really just a hint, but in the case of the simple collector, the only time it will happen. */ void ggc_collect PARAMS ((void)); @@ -161,10 +168,11 @@ int ggc_set_mark PARAMS ((const void *)); the lang_specific hooks in the tree. */ void lang_mark_tree PARAMS ((union tree_node *)); -/* The FALSE_LABEL_STACK, declared in except.h, has - language-dependent semantics. Each front-end should define this - function appropriately. */ -void lang_mark_false_label_stack PARAMS ((struct label_node *)); +/* The FALSE_LABEL_STACK, declared in except.h, has language-dependent + semantics. If a front-end needs to mark the false label stack, it + should set this pointer to a non-NULL value. Otherwise, no marking + will be done. */ +extern void (*lang_mark_false_label_stack) PARAMS ((struct label_node *)); /* Mark functions for various structs scattered about. */ diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 632707b28f1..4b6d3077ad8 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,26 @@ +2000-10-01 Mark Mitchell + + 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. + 2000-09-29 Alexandre Petit-Bianco * parse.y (maybe_yank_clinit): Also keep if its body diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in index 1a17a98a8f3..6036f60f9c5 100644 --- a/gcc/java/Make-lang.in +++ b/gcc/java/Make-lang.in @@ -139,7 +139,7 @@ JCF_DUMP_SOURCES = $(srcdir)/java/jcf-dump.c $(srcdir)/java/jcf-io.c \ jc1$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext): s-java -s-java: $(P) $(JAVA_SRCS) $(LIBDEPS) $(BACKEND) ggc-callbacks.o \ +s-java: $(P) $(JAVA_SRCS) $(LIBDEPS) $(BACKEND) \ $(GCJH_SOURCES) $(LIBDEPS) $(TREE_H) \ $(JV_SCAN_SOURCES) $(BACKEND) $(LIBDEPS) \ $(JCF_DUMP_SOURCES) diff --git a/gcc/java/Makefile.in b/gcc/java/Makefile.in index 794ec667d1c..7cec2851e37 100644 --- a/gcc/java/Makefile.in +++ b/gcc/java/Makefile.in @@ -181,7 +181,7 @@ JAVA_OBJS = parse.o class.o decl.o expr.o constants.o lang.o typeck.o \ JAVA_OBJS_LITE = parse-scan.o jv-scan.o # Language-independent object files. -BACKEND = ../toplev.o ../ggc-callbacks.o ../libbackend.a +BACKEND = ../toplev.o ../libbackend.a compiler: ../jc1$(exeext) ../jv-scan$(exeext) ../jc1$(exeext): $(P) $(JAVA_OBJS) $(BACKEND) $(LIBDEPS) @@ -317,7 +317,7 @@ mangle.o : mangle.c $(CONFIG_H) jcf.h $(JAVA_TREE_H) $(srcdir)/../system.h \ parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h \ $(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \ - $(srcdir)/../toplev.h $(srcdir)/../system.h + $(srcdir)/../toplev.h $(srcdir)/../system.h $(srcdir)/../ggc.h verify.o : verify.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h javaop.h java-opcodes.h \ java-except.h $(srcdir)/../toplev.h $(srcdir)/../system.h xref.o : xref.c xref.h $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../toplev.h \ diff --git a/gcc/java/class.c b/gcc/java/class.c index b69bfc1a933..f9300bc1be1 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -655,8 +655,7 @@ add_method_1 (handle_class, access_flags, name, function_type) DECL_CONTEXT (fndecl) = handle_class; DECL_LANG_SPECIFIC (fndecl) - = (struct lang_decl *) permalloc (sizeof (struct lang_decl)); - bzero ((PTR) DECL_LANG_SPECIFIC (fndecl), sizeof (struct lang_decl)); + = (struct lang_decl *) ggc_alloc_cleared (sizeof (struct lang_decl)); /* Initialize the static initializer test table. */ hash_table_init (&DECL_FUNCTION_INIT_TEST_TABLE (fndecl), @@ -2121,4 +2120,5 @@ init_class_processing () { registerClass_libfunc = gen_rtx (SYMBOL_REF, Pmode, "_Jv_RegisterClass"); ggc_add_tree_root (®istered_class, 1); + ggc_add_rtx_root (®isterClass_libfunc, 1); } 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); + } + } +} diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 0b75387d842..d22efecbc75 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -829,14 +829,12 @@ struct lang_decl_var #define TYPE_JCF(T) (TYPE_LANG_SPECIFIC(T)->jcf) #define TYPE_CPOOL(T) (TYPE_LANG_SPECIFIC(T)->cpool) #define TYPE_CPOOL_DATA_REF(T) (TYPE_LANG_SPECIFIC(T)->cpool_data_ref) -#define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \ - if (TYPE_LANG_SPECIFIC ((T)) == NULL) \ - { \ - TYPE_LANG_SPECIFIC ((T)) = \ - (struct lang_type *) xmalloc (sizeof (struct lang_type)); \ - \ - bzero ((char *) TYPE_LANG_SPECIFIC ((T)), \ - sizeof (struct lang_type)); \ +#define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \ + if (TYPE_LANG_SPECIFIC ((T)) == NULL) \ + { \ + TYPE_LANG_SPECIFIC ((T)) = \ + ((struct lang_type *) \ + ggc_alloc_cleared (sizeof (struct lang_type))); \ } #define TYPE_FINIT_STMT_LIST(T) (TYPE_LANG_SPECIFIC(T)->finit_stmt_list) diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 7abd1cbdcb2..ccfba7d7f86 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -568,7 +568,7 @@ jcf_parse_source () java_parser_context_save_global (); java_push_parser_context (); - input_filename = current_jcf->filename; + input_filename = ggc_strdup (current_jcf->filename); file = get_identifier (input_filename); current_class = NULL_TREE; current_function_decl = NULL_TREE; diff --git a/gcc/java/lex.c b/gcc/java/lex.c index 4179b1dbca5..5d106c416ec 100644 --- a/gcc/java/lex.c +++ b/gcc/java/lex.c @@ -1081,14 +1081,7 @@ java_lex (java_lval) if (!no_error || (c != '"')) java_lval->node = error_mark_node; /* Requires futher testing FIXME */ else - { - tree s = make_node (STRING_CST); - TREE_STRING_LENGTH (s) = strlen (string); - TREE_STRING_POINTER (s) = - obstack_alloc (expression_obstack, TREE_STRING_LENGTH (s)+1); - strcpy (TREE_STRING_POINTER (s), string); - java_lval->node = s; - } + java_lval->node = build_string (strlen (string), string); #endif return STRING_LIT_TK; } diff --git a/gcc/java/parse.y b/gcc/java/parse.y index e6aeb32217f..9ebeb44d1b4 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -323,6 +323,7 @@ static void add_inner_class_fields PARAMS ((tree, tree)); static tree build_dot_class_method PARAMS ((tree)); static tree build_dot_class_method_invocation PARAMS ((tree)); static void create_new_parser_context PARAMS ((int)); +static void mark_parser_ctxt PARAMS ((void *)); /* Number of error found so far. */ int java_error_count; @@ -332,7 +333,7 @@ int java_warning_count; int do_not_fold; /* Cyclic inheritance report, as it can be set by layout_class */ char *cyclic_inheritance_report; - + /* Tell when we're within an instance initializer */ static int in_instance_initializer; @@ -597,6 +598,12 @@ goal: ggc_add_tree_root (&package_list, 1); ggc_add_tree_root (¤t_this, 1); ggc_add_tree_root (¤tly_caught_type_list, 1); + ggc_add_root (&ctxp, 1, + sizeof (struct parser_ctxt *), + mark_parser_ctxt); + ggc_add_root (&ctxp_for_generation, 1, + sizeof (struct parser_ctxt *), + mark_parser_ctxt); } compilation_unit {} @@ -15215,3 +15222,39 @@ resolve_qualified_name (name, context) { } #endif + +/* Mark P, which is really a `struct parser_ctxt **' for GC. */ + +static void +mark_parser_ctxt (p) + void *p; +{ + struct parser_ctxt *pc = *((struct parser_ctxt **) p); + int i; + + if (!pc) + return; + +#ifndef JC1_LITE + for (i = 0; i < 11; ++i) + ggc_mark_tree (pc->modifier_ctx[i]); + ggc_mark_tree (pc->class_type); + ggc_mark_tree (pc->function_decl); + ggc_mark_tree (pc->package); + ggc_mark_tree (pc->incomplete_class); + ggc_mark_tree (pc->gclass_list); + ggc_mark_tree (pc->class_list); + ggc_mark_tree (pc->current_parsed_class); + ggc_mark_tree (pc->current_parsed_class_un); + ggc_mark_tree (pc->non_static_initialized); + ggc_mark_tree (pc->static_initialized); + ggc_mark_tree (pc->instance_initializers); + ggc_mark_tree (pc->import_list); + ggc_mark_tree (pc->import_demand_list); + ggc_mark_tree (pc->current_loop); + ggc_mark_tree (pc->current_labeled_block); +#endif /* JC1_LITE */ + + if (pc->next) + mark_parser_ctxt (&pc->next); +} diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index cb0305d1af4..08ab30fa568 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -33,6 +33,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "jcf.h" #include "convert.h" #include "toplev.h" +#include "ggc.h" static tree convert_ieee_real_to_integer PARAMS ((tree, tree)); static tree parse_signature_type PARAMS ((const unsigned char **, diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 853b2425bf5..c689e240542 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2000-10-01 Mark Mitchell + + * splay-tree.c (splay_tree_insert): Fix formatting. + 2000-09-16 Mark Mitchell * splay-tree.c (splay_tree_predecessor): Fix typo in comment. diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c index eb888148c80..52b57c088a7 100644 --- a/libiberty/splay-tree.c +++ b/libiberty/splay-tree.c @@ -305,8 +305,8 @@ splay_tree_insert (sp, key, value) node->right->left = 0; } - sp->root = node; - } + sp->root = node; + } return sp->root; }