OSDN Git Service

* c-decl.c (c_expand_body): Don't generate RTL if flag_syntax_only.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 1 Oct 2000 19:19:30 +0000 (19:19 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 1 Oct 2000 19:19:30 +0000 (19:19 +0000)
(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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36687 138bc75d-0d04-0410-961f-82ee72b054a4

24 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/c-lex.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/lex.c
gcc/except.c
gcc/f/ChangeLog
gcc/f/com.c
gcc/ggc-callbacks.c
gcc/ggc-common.c
gcc/ggc.h
gcc/java/ChangeLog
gcc/java/Make-lang.in
gcc/java/Makefile.in
gcc/java/class.c
gcc/java/decl.c
gcc/java/java-tree.h
gcc/java/jcf-parse.c
gcc/java/lex.c
gcc/java/parse.y
gcc/java/typeck.c
libiberty/ChangeLog
libiberty/splay-tree.c

index 5b80c09..93353aa 100644 (file)
@@ -1,3 +1,18 @@
+2000-10-01  Mark Mitchell  <mark@codesourcery.com>
+
+       * 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.
+       
 Sat Sep 23 19:10:20 2000  Denis Chertykov  <denisc@overta.ru>
 
        * config/avr/avr.h (BRANCH_COST): Define as 0.
index a197601..940d4b1 100644 (file)
@@ -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
index f6dee4d..6936153 100644 (file)
@@ -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 ("<top level>");
+  /* 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 ("<top level>"));
   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);
+}
index ead72e2..2adea2e 100644 (file)
@@ -1,3 +1,8 @@
+2000-10-01  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (lang_mark_false_label_stack): Remove.
+       * lex.c (cp_mang_lang_type): Use ggc_alloc_cleared.
+       
 2000-09-30  Joseph S. Myers  <jsm28@cam.ac.uk>
 
        * gxxint.texi: Use @email for formatting email addresses.
index e016e33..d467f5a 100644 (file)
@@ -14647,14 +14647,6 @@ mark_cp_function_context (f)
 }
 
 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;
 {
index 43d7094..2b32d01 100644 (file)
@@ -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);
index fb697a8..efa61e5 100644 (file)
@@ -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);
index 4ca2272..3ec2c9e 100644 (file)
@@ -1,3 +1,7 @@
+Sun Oct  1 11:43:44 2000  Mark Mitchell  <mark@codesourcery.com>
+
+       * com.c (lang_mark_false_label_stack): Remove.
+
 2000-09-10  Zack Weinberg  <zack@wolery.cumb.org>
 
        * com.c: Include defaults.h.
index c3a50e9..9cc31e9 100644 (file)
@@ -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 */
 \f
 #if FFECOM_GCC_INCLUDE
index c56e13e..b53af55 100644 (file)
@@ -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 ();
-}
index 5f6f0c0..2915b73 100644 (file)
@@ -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;
 
index 8796fd1..1a5b4d8 100644 (file)
--- 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.  */
 
index 632707b..4b6d307 100644 (file)
@@ -1,3 +1,26 @@
+2000-10-01  Mark Mitchell  <mark@codesourcery.com>
+
+       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  <apbianco@cygnus.com>
 
        * parse.y (maybe_yank_clinit): Also keep <clinit> if its body
index 1a17a98..6036f60 100644 (file)
@@ -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)
index 794ec66..7cec285 100644 (file)
@@ -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 \
index b69bfc1..f9300bc 100644 (file)
@@ -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 (&registered_class, 1);
+  ggc_add_rtx_root (&registerClass_libfunc, 1);
 }
index e1c630d..da44ca6 100644 (file)
@@ -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);
+       }
+    }
+}
index 0b75387..d22efec 100644 (file)
@@ -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)
index 7abd1cb..ccfba7d 100644 (file)
@@ -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;
index 4179b1d..5d106c4 100644 (file)
@@ -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;
     }
index e6aeb32..9ebeb44 100644 (file)
@@ -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 (&current_this, 1);
                  ggc_add_tree_root (&currently_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);
+}
index cb0305d..08ab30f 100644 (file)
@@ -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 **,
index 853b242..c689e24 100644 (file)
@@ -1,3 +1,7 @@
+2000-10-01  Mark Mitchell  <mark@codesourcery.com>
+
+       * splay-tree.c (splay_tree_insert): Fix formatting.
+
 2000-09-16  Mark Mitchell  <mark@codesourcery.com>
 
        * splay-tree.c (splay_tree_predecessor): Fix typo in comment.
index eb88814..52b57c0 100644 (file)
@@ -305,8 +305,8 @@ splay_tree_insert (sp, key, value)
          node->right->left = 0;
        }
 
-    sp->root = node;
-  }
+      sp->root = node;
+    }
 
   return sp->root;
 }