Java PATCH: Beginnings of GC

Mark Mitchell mark@codesourcery.com
Sat Sep 23 10:12:00 GMT 2000


This patch begins the transition to GC in the Java front-end.  This
patch sets things up so that many trees are registered with the
collector.  The collector itself is not actually run at this point.

This work is part of the GCC 3.0 release criteria, and is also going
to make it easier to make other changes to the Java front-end required
for the release including mangling and object layout changes to make
the Java front-end match the C++ front-end.

The other major functionality we're missing at this point is building
libgcc.so.  I will get to this eventually -- but I'm leaving it for
last since there are more folks who know about the issues and could do
that work.  Hint, hint. :-)

Bootstrapped on i686-pc-linux-gnu and tested by building libgcj.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-09-23  Mark Mitchell  <mark@codesourcery.com>

	* Make-lang.in (JAVA_SRCS): Include java-tree.h.
	* Makefile.in (parse.o): Depend on ggc.h.
	(class.o): Likewise.
	(constants.o): Likewise.
	(decl.o): Likewise.
	(expr.o): Likewise.
	(jcf-parse.o): Likewise.
	(jcf-write.o): Likewise.
	(mangle.o): Likewise.
	* class.c: Include ggc.h.
	(build_static_field_ref): Register GC roots.
	(layout_class): Likewise.
	(init_class_processing): Likewise.
	* constants.c: Include ggc.h.
	(current_constant_pool_data_ref): Remove.
	(tag_nodes): Move it to ...
	(get_tag_node): ... here.  Register GC roots.
	* decl.c: Include ggc.h.  Remove many global tree definitions.
	(throw_node): Define.
	(java_global_trees): Likewise.
	(predef_filenames): Make the size a constant.
	(init_decl_processing): Adjust accordingly.
	(init_decl_processing): Call init_jcf_parse.  Register GC roots.
	* expr.c: Include ggc.h.
	(init_expr_processing): Register GC roots.
	(build_invokeinterface): Likewise.
	* java-tree.h: Replace extern tree declarations with macros.
	(java_global_trees): New variable.
	(java_tree_index): New enumeration.
	(init_jcf_parse): Declare.
	* jcf-parse.c: Include ggc.h.
	(current_class): Remove declaration.
	(main_class): Likewise.
	(all_class_list): Likewise.
	(predefined_filename_p): Adjust for constant size of
	predef_filenames.
	(init_jcf_parse): New function.
	* jcf-write.c: Include ggc.h.
	(generate_classfile): Register GC roots.
	(append_synthetic_attribute): Likewise.
	(append_innerclass_attribute_entry): Likewise.
	* lang.c: Include ggc.h.
	(lang_print_error): Register GC roots.
	* parse.h (struct parser_ctxt): Rename fields to avoid conflicts
	with macros.
	* parse.y: Include ggc.h.
	(wfl_operator): Remove.
	(goal): Register GC roots.
	(java_pop_parser_context): Adjust for new field names.
	(java_parser_context_save_global): Likewse.
	(java_parser_context_restore_global): Likewise.
	(java_parser_context_suspend): Likewise.
	(java_parser_context_resume): Likewise.
	(verify_constructor_circularity): Register GC roots.
	(lookup_cl): Likewise.
	(java_reorder_fields): Likewise.
	(build_current_this): Likewise.
	(class_in_current_package): Likewise.
	(argument_types_convertible): Likewise.
	(patch_cast): Rename wfl_op parameter to avoid macro conflicts.

Index: Make-lang.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/Make-lang.in,v
retrieving revision 1.34
diff -c -p -r1.34 Make-lang.in
*** Make-lang.in	2000/08/31 18:19:01	1.34
--- Make-lang.in	2000/09/23 16:35:50
*************** JAVA_SRCS = $(srcdir)/java/parse.y $(src
*** 75,81 ****
    $(srcdir)/java/jcf-parse.c $(srcdir)/java/mangle.c \
    $(srcdir)/java/jcf-write.c $(srcdir)/java/buffer.c \
    $(srcdir)/java/check-init.c $(srcdir)/java/lex.c $(srcdir)/java/boehm.c \
!   $(srcdir)/java/jcf-depend.c  $(srcdir)/java/jcf-path.c
  
  jvspec.o: $(srcdir)/java/jvspec.c system.h $(GCC_H)
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
--- 75,82 ----
    $(srcdir)/java/jcf-parse.c $(srcdir)/java/mangle.c \
    $(srcdir)/java/jcf-write.c $(srcdir)/java/buffer.c \
    $(srcdir)/java/check-init.c $(srcdir)/java/lex.c $(srcdir)/java/boehm.c \
!   $(srcdir)/java/jcf-depend.c  $(srcdir)/java/jcf-path.c \
!   $(srcdir)/java/java-tree.h
  
  jvspec.o: $(srcdir)/java/jvspec.c system.h $(GCC_H)
  	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/Makefile.in,v
retrieving revision 1.54
diff -c -p -r1.54 Makefile.in
*** Makefile.in	2000/09/03 21:09:10	1.54
--- Makefile.in	2000/09/23 16:35:51
*************** force:
*** 273,279 ****
  
  parse.o : $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h \
    $(srcdir)/../function.h $(JAVA_TREE_H) $(srcdir)/lex.c $(PARSE_H) \
!   $(srcdir)/lex.h
  jcf-dump.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) jcf-dump.c \
    jcf-reader.c jcf.h javaop.h javaop.def $(srcdir)/../version.h
  gjavah.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) gjavah.c \
--- 273,279 ----
  
  parse.o : $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h \
    $(srcdir)/../function.h $(JAVA_TREE_H) $(srcdir)/lex.c $(PARSE_H) \
!   $(srcdir)/lex.h $(srcdir)/../ggc.h
  jcf-dump.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) jcf-dump.c \
    jcf-reader.c jcf.h javaop.h javaop.def $(srcdir)/../version.h
  gjavah.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) gjavah.c \
*************** check-init.o : check-init.c $(CONFIG_H) 
*** 286,297 ****
    $(JAVA_TREE_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
  class.o : class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) jcf.h $(PARSE_H) \
    $(srcdir)/../gansidecl.h $(srcdir)/../toplev.h $(srcdir)/../system.h \
!   $(srcdir)/../output.h
  constants.o : constants.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
!   $(srcdir)/../toplev.h $(srcdir)/../system.h
  decl.o : decl.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
    $(srcdir)/../toplev.h $(srcdir)/../system.h $(srcdir)/../function.h \
!   $(srcdir)/../defaults.h
  except.o : except.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
    $(RTL_H) javaop.h java-opcodes.h $(srcdir)/../except.h java-except.h \
    $(srcdir)/../eh-common.h $(srcdir)/../toplev.h $(srcdir)/../system.h \
--- 286,297 ----
    $(JAVA_TREE_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
  class.o : class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) jcf.h $(PARSE_H) \
    $(srcdir)/../gansidecl.h $(srcdir)/../toplev.h $(srcdir)/../system.h \
!   $(srcdir)/../output.h $(srcdir)/../ggc.h
  constants.o : constants.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
!   $(srcdir)/../toplev.h $(srcdir)/../system.h $(srcdir)/../ggc.h
  decl.o : decl.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
    $(srcdir)/../toplev.h $(srcdir)/../system.h $(srcdir)/../function.h \
!   $(srcdir)/../defaults.h $(srcdir)/../gcc.h
  except.o : except.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
    $(RTL_H) javaop.h java-opcodes.h $(srcdir)/../except.h java-except.h \
    $(srcdir)/../eh-common.h $(srcdir)/../toplev.h $(srcdir)/../system.h \
*************** except.o : except.c $(CONFIG_H) $(JAVA_T
*** 299,318 ****
  expr.o : expr.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
    $(RTL_H) $(EXPR_H) javaop.h java-opcodes.h $(srcdir)/../except.h \
    java-except.h java-except.h parse.h $(srcdir)/../toplev.h \
!   $(srcdir)/../system.h
  jcf-depend.o : jcf-depend.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
  jcf-io.o : jcf-io.c $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H)
  jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \
    $(srcdir)/../input.h java-except.h $(srcdir)/../system.h \
!   $(srcdir)/../toplev.h $(PARSE_H)
  jcf-write.o : jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(RTL_H) \
!   java-opcodes.h parse.h buffer.h $(srcdir)/../system.h $(srcdir)/../toplev.h
  jv-scan.o : jv-scan.c $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../version.h
  jvgenmain.o : jvgenmain.c $(CONFIG_H) $(srcdir)/../system.h
  lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \
    $(srcdir)/../toplev.h $(srcdir)/../system.h $(RTL_H) $(EXPR_H)
  mangle.o : mangle.c $(CONFIG_H) jcf.h $(JAVA_TREE_H) $(srcdir)/../system.h \
!   $(srcdir)/../toplev.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 \
--- 299,319 ----
  expr.o : expr.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
    $(RTL_H) $(EXPR_H) javaop.h java-opcodes.h $(srcdir)/../except.h \
    java-except.h java-except.h parse.h $(srcdir)/../toplev.h \
!   $(srcdir)/../system.h $(srcdir)/../ggc.h
  jcf-depend.o : jcf-depend.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
  jcf-io.o : jcf-io.c $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H)
  jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \
    $(srcdir)/../input.h java-except.h $(srcdir)/../system.h \
!   $(srcdir)/../toplev.h $(PARSE_H) $(srcdir)/../ggc.h
  jcf-write.o : jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(RTL_H) \
!   java-opcodes.h parse.h buffer.h $(srcdir)/../system.h \
!   $(srcdir)/../toplev.h $(srcdir)/../ggc.h
  jv-scan.o : jv-scan.c $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../version.h
  jvgenmain.o : jvgenmain.c $(CONFIG_H) $(srcdir)/../system.h
  lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \
    $(srcdir)/../toplev.h $(srcdir)/../system.h $(RTL_H) $(EXPR_H)
  mangle.o : mangle.c $(CONFIG_H) jcf.h $(JAVA_TREE_H) $(srcdir)/../system.h \
!   $(srcdir)/../toplev.h $(srcdir)/../ggc.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 \
Index: class.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/class.c,v
retrieving revision 1.74
diff -c -p -r1.74 class.c
*** class.c	2000/08/11 22:01:37	1.74
--- class.c	2000/09/23 16:35:52
*************** The Free Software Foundation is independ
*** 35,40 ****
--- 35,41 ----
  #include "toplev.h"
  #include "output.h"
  #include "parse.h"
+ #include "ggc.h"
  
  static tree mangle_class_field PARAMS ((tree class));
  static tree make_method_value PARAMS ((tree));
*************** build_static_field_ref (fdecl)
*** 1011,1019 ****
        int field_index = 0;
        ref = build1 (INDIRECT_REF, class_type_node, ref);
        if (fields_ident == NULL_TREE)
! 	fields_ident = get_identifier ("fields");
        if (info_ident == NULL_TREE)
! 	info_ident = get_identifier ("info");
        ref = build (COMPONENT_REF, field_ptr_type_node, ref,
  		   lookup_field (&class_type_node, fields_ident));
  
--- 1012,1026 ----
        int field_index = 0;
        ref = build1 (INDIRECT_REF, class_type_node, ref);
        if (fields_ident == NULL_TREE)
! 	{
! 	  fields_ident = get_identifier ("fields");
! 	  ggc_add_tree_root (&fields_ident, 1);
! 	}
        if (info_ident == NULL_TREE)
! 	{
! 	  info_ident = get_identifier ("info");
! 	  ggc_add_tree_root (&info_ident, 1);
! 	}
        ref = build (COMPONENT_REF, field_ptr_type_node, ref,
  		   lookup_field (&class_type_node, fields_ident));
  
*************** layout_class (this_class)
*** 1779,1787 ****
--- 1786,1802 ----
       tree this_class;
  {
    static tree list = NULL_TREE;
+   static int initialized_p;
    tree super_class = CLASSTYPE_SUPER (this_class);
    tree field;
    
+   /* Register LIST with the garbage collector.  */
+   if (!initialized_p)
+     {
+       ggc_add_tree_root (&list, 1);
+       initialized_p = 1;
+     }
+ 
    list = tree_cons (this_class, NULL_TREE, list);
    if (CLASS_BEING_LAIDOUT (this_class))
      {
*************** static tree registered_class = NULL_TREE
*** 2044,2049 ****
--- 2059,2067 ----
  void
  register_class ()
  {
+   /* END does not need to be registered with the garbage collector
+      because it always points into the list given by REGISTERED_CLASS,
+      and that variable is registered with the collector.  */
    static tree end;
    tree node    = TREE_OPERAND (build_class_ref (current_class), 0);
    tree current = copy_node (node);
*************** void
*** 2102,2105 ****
--- 2120,2124 ----
  init_class_processing ()
  {
    registerClass_libfunc = gen_rtx (SYMBOL_REF, Pmode, "_Jv_RegisterClass");
+   ggc_add_tree_root (&registered_class, 1);
  }
Index: constants.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/constants.c,v
retrieving revision 1.12
diff -c -p -r1.12 constants.c
*** constants.c	2000/03/14 05:01:04	1.12
--- constants.c	2000/09/23 16:35:52
*************** The Free Software Foundation is independ
*** 27,32 ****
--- 27,33 ----
  #include "tree.h"
  #include "java-tree.h"
  #include "toplev.h"
+ #include "ggc.h"
  
  extern struct obstack permanent_obstack;
  
*************** write_constant_pool (cpool, buffer, leng
*** 318,334 ****
  
  CPool *outgoing_cpool;
  
- /* If non-NULL, an ADDR_EXPR referencing a VAR_DECL containing
-    the constant data array for the current class. */
- tree current_constant_pool_data_ref;
- 
- /* A Cache for build_int_2 (CONSTANT_XXX, 0). */
- static tree tag_nodes[13];
- 
  static tree
  get_tag_node (tag)
       int tag;
  {
    if (tag_nodes[tag] == NULL_TREE)
      {
        push_obstacks (&permanent_obstack, &permanent_obstack);
--- 319,339 ----
  
  CPool *outgoing_cpool;
  
  static tree
  get_tag_node (tag)
       int tag;
  {
+   /* A Cache for build_int_2 (CONSTANT_XXX, 0). */
+   static tree tag_nodes[13];
+   static int initialized_p;
+ 
+   /* Register the TAG_NODES with the garbage collector.  */
+   if (!initialized_p)
+     {
+       ggc_add_tree_root (tag_nodes, 13);
+       initialized_p = 1;
+     }
+ 
    if (tag_nodes[tag] == NULL_TREE)
      {
        push_obstacks (&permanent_obstack, &permanent_obstack);
Index: decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/decl.c,v
retrieving revision 1.71
diff -c -p -r1.71 decl.c
*** decl.c	2000/09/11 01:50:49	1.71
--- decl.c	2000/09/23 16:35:53
*************** The Free Software Foundation is independ
*** 37,42 ****
--- 37,43 ----
  #include "except.h"
  #include "defaults.h"
  #include "java-except.h"
+ #include "ggc.h"
  
  #if defined (DEBUG_JAVA_BINDING_LEVELS)
  extern void indent PROTO((void));
*************** tree decl_map;
*** 69,74 ****
--- 70,77 ----
  
  tree pending_local_decls = NULL_TREE;
  
+ tree throw_node [2];
+ 
  /* Push a local variable or stack slot into the decl_map,
     and assign it an rtl. */
  
*************** static int keep_next_level_flag;
*** 283,404 ****
     if it has subblocks.  */
  
  static int keep_next_if_subblocks;
    
! tree object_type_node;
! tree unqualified_object_id_node;
! tree object_ptr_type_node;
! tree string_type_node;
! tree string_ptr_type_node;
! tree throwable_type_node;
! tree runtime_exception_type_node;
! tree error_exception_type_node;
! tree rawdata_ptr_type_node;
! tree *predef_filenames;
! int  predef_filenames_size;
! 
! tree boolean_type_node;
! 
! tree return_address_type_node;
! 
! tree byte_type_node;
! tree short_type_node;
! tree int_type_node;
! tree long_type_node;
! 
! tree promoted_byte_type_node;
! tree promoted_short_type_node;
! tree promoted_char_type_node;
! tree promoted_boolean_type_node;
! 
! tree unsigned_byte_type_node;
! tree unsigned_short_type_node;
! tree unsigned_int_type_node;
! tree unsigned_long_type_node;
! 
! /* The type for struct methodtable. */
! tree methodtable_type;
! tree methodtable_ptr_type;
! 
! tree utf8const_type;
! tree utf8const_ptr_type;
! tree class_type_node;
! tree class_ptr_type;
! tree field_type_node;
! tree field_ptr_type_node;
! tree field_info_union_node;
! tree jexception_type;
! tree jexception_ptr_type;
! tree lineNumberEntry_type;
! tree lineNumbers_type;
! tree constants_type_node;
! tree dtable_type;
! tree dtable_ptr_type;
! tree method_type_node;
! tree method_ptr_type_node;
! tree nativecode_ptr_array_type_node;
! tree one_elt_array_domain_type;
! tree access_flags_type_node;
! tree class_dtable_decl;
! 
! /* Expressions that are constants with value zero, of types
!    `long', `float' and `double'.  */
! tree long_zero_node;
! tree float_zero_node;
! tree double_zero_node;
! 
! tree empty_stmt_node;
! 
! /* Nodes for boolean constants TRUE and FALSE. */
! tree boolean_true_node;
! tree boolean_false_node;
! 
! tree TYPE_identifier_node;
! tree init_identifier_node;
! tree clinit_identifier_node;
! tree finit_identifier_node;
! tree finit_leg_identifier_node;
! tree void_signature_node;
! tree length_identifier_node;
! tree this_identifier_node;
! tree super_identifier_node;
! tree continue_identifier_node;
! tree access0_identifier_node;	/* 1.1 */
! tree end_params_node;
! 
! /* References to internal libjava functions we use. */
! tree alloc_object_node;
! tree soft_instanceof_node;
! tree soft_checkcast_node;
! tree soft_initclass_node;
! tree soft_newarray_node;
! tree soft_anewarray_node;
! tree soft_multianewarray_node;
! tree soft_badarrayindex_node;
! tree soft_nullpointer_node;
! tree throw_node [2];
! tree soft_checkarraystore_node;
! tree soft_monitorenter_node;
! tree soft_monitorexit_node;
! tree soft_lookupinterfacemethod_node;
! tree soft_lookupjnimethod_node;
! tree soft_getjnienvnewframe_node;
! tree soft_jnipopsystemframe_node;
! tree soft_fmod_node;
! tree soft_exceptioninfo_call_node;
! tree soft_idiv_node;
! tree soft_irem_node;
! tree soft_ldiv_node;
! tree soft_lrem_node;
! 
! /* Declarations for vtables for primitive arrays.  */
! tree boolean_array_vtable;
! tree byte_array_vtable;
! tree char_array_vtable;
! tree short_array_vtable;
! tree int_array_vtable;
! tree long_array_vtable;
! tree float_array_vtable;
! tree double_array_vtable;
  
  /* Build (and pushdecl) a "promoted type" for all standard
     types shorter than int.  */
--- 286,295 ----
     if it has subblocks.  */
  
  static int keep_next_if_subblocks;
+ 
+ tree java_global_trees[JTI_MAX];
    
! tree predef_filenames[PREDEF_FILENAMES_SIZE];
  
  /* Build (and pushdecl) a "promoted type" for all standard
     types shorter than int.  */
*************** push_promoted_type (name, actual_type)
*** 426,436 ****
    return type;
  }
  
- /* Nodes for integer constants.  */
- tree integer_two_node;
- tree integer_four_node;
- tree integer_negative_one_node;
- 
  /* Return a definition for a builtin function named NAME and whose data type
     is TYPE.  TYPE should be a function type with argument types.
     FUNCTION_CODE tells later passes how to compile calls to this function.
--- 317,322 ----
*************** init_decl_processing ()
*** 623,632 ****
    rawdata_ptr_type_node
      = promote_type (lookup_class (get_identifier ("gnu.gcj.RawData")));
  
!   /* This section has to be updated as items are added to the previous
!      section. */
!   predef_filenames_size = 7;
!   predef_filenames = (tree *)xmalloc (predef_filenames_size * sizeof (tree));
    predef_filenames [0] = get_identifier ("java/lang/Class.java");
    predef_filenames [1] = get_identifier ("java/lang/Error.java");
    predef_filenames [2] = get_identifier ("java/lang/Object.java");
--- 509,516 ----
    rawdata_ptr_type_node
      = promote_type (lookup_class (get_identifier ("gnu.gcj.RawData")));
  
!   /* If you add to this section, don't forget to increase
!      PREDEF_FILENAMES_SIZE.  */
    predef_filenames [0] = get_identifier ("java/lang/Class.java");
    predef_filenames [1] = get_identifier ("java/lang/Error.java");
    predef_filenames [2] = get_identifier ("java/lang/Object.java");
*************** init_decl_processing ()
*** 958,963 ****
--- 842,856 ----
  			0, NOT_BUILT_IN, NULL_PTR);
  
    init_class_processing ();
+   init_jcf_parse ();
+ 
+   /* Register nodes with the garbage collector.  */
+   ggc_add_tree_root (java_global_trees, 
+ 		     sizeof (java_global_trees) / sizeof (tree));
+   ggc_add_tree_root (throw_node,
+ 		     sizeof (throw_node) / sizeof (tree));
+   ggc_add_tree_root (predef_filenames,
+ 		     sizeof (predef_filenames) / sizeof (tree));
  }
  
  
Index: expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/expr.c,v
retrieving revision 1.85
diff -c -p -r1.85 expr.c
*** expr.c	2000/09/12 22:31:00	1.85
--- expr.c	2000/09/23 16:35:55
*************** The Free Software Foundation is independ
*** 40,45 ****
--- 40,46 ----
  #include "toplev.h"
  #include "except.h"
  #include "defaults.h"
+ #include "ggc.h"
  
  static void flush_quick_stack PARAMS ((void));
  static void push_value PARAMS ((tree));
*************** static tree case_identity PARAMS ((tree,
*** 83,88 ****
--- 84,93 ----
  static tree operand_type[59];
  extern struct obstack permanent_obstack;
  
+ static tree methods_ident = NULL_TREE;
+ static tree ncode_ident = NULL_TREE;
+ tree dtable_ident = NULL_TREE;
+ 
  /* Set to non-zero value in order to emit class initilization code
     before static field references.  */
  int always_initialize_class_p;
*************** init_expr_processing()
*** 95,100 ****
--- 100,108 ----
    operand_type[23] = operand_type[56] = float_type_node;
    operand_type[24] = operand_type[57] = double_type_node;
    operand_type[25] = operand_type[58] = ptr_type_node;
+   ggc_add_tree_root (operand_type, 59);
+   ggc_add_tree_root (&methods_ident, 1);
+   ggc_add_tree_root (&ncode_ident, 1);
  }
  
  /* We store the stack state in two places:
*************** build_class_init (clas, expr)
*** 1652,1661 ****
    return init;
  }
  
- static tree methods_ident = NULL_TREE;
- static tree ncode_ident = NULL_TREE;
- tree dtable_ident = NULL_TREE;
- 
  tree
  build_known_method_ref (method, method_type, self_type, method_signature, arg_list)
       tree method, method_type ATTRIBUTE_UNUSED, self_type,
--- 1660,1665 ----
*************** build_invokeinterface (dtable, method)
*** 1771,1778 ****
       abstract nor static.  */
  	    
    if (class_ident == NULL_TREE)
!     class_ident = get_identifier ("class");
!   
    dtable = build1 (INDIRECT_REF, dtable_type, dtable);
    dtable = build (COMPONENT_REF, class_ptr_type, dtable,
  		  lookup_field (&dtable_type, class_ident));
--- 1775,1785 ----
       abstract nor static.  */
  	    
    if (class_ident == NULL_TREE)
!     {
!       class_ident = get_identifier ("class");
!       ggc_add_tree_root (&class_ident, 1);
!     }
! 
    dtable = build1 (INDIRECT_REF, dtable_type, dtable);
    dtable = build (COMPONENT_REF, class_ptr_type, dtable,
  		  lookup_field (&dtable_type, class_ident));
Index: java-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/java-tree.h,v
retrieving revision 1.81
diff -c -p -r1.81 java-tree.h
*** java-tree.h	2000/09/12 22:23:59	1.81
--- java-tree.h	2000/09/23 16:35:56
*************** struct JCF;
*** 121,133 ****
  extern int compiling_from_source;
  
  /* The class defined by the actual (main) file we are compiling. */
! extern tree main_class;
  
  /* The class we are currently processing. */
! extern tree current_class;
  
  /* List of all class DECLs seen so far.  */
! extern tree all_class_list;
  
  /* Nonzero if we should make is_compiled_class always return 1 for
     appropriate classes that we're referencing.  */
--- 121,136 ----
  extern int compiling_from_source;
  
  /* The class defined by the actual (main) file we are compiling. */
! #define main_class \
!   java_global_trees[JTI_MAIN_CLASS]
  
  /* The class we are currently processing. */
! #define current_class \
!   java_global_trees[JTI_CURRENT_CLASS]
  
  /* List of all class DECLs seen so far.  */
! #define all_class_list \
!   java_global_trees[JTI_ALL_CLASS_LIST]
  
  /* Nonzero if we should make is_compiled_class always return 1 for
     appropriate classes that we're referencing.  */
*************** typedef struct CPool constant_pool;
*** 205,343 ****
  #define COMPONENT_REF_SIGNATURE(CPOOL, IDX) \
    NAME_AND_TYPE_SIGNATURE (CPOOL, COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX))
  
  /* "Promoted types" that are used for primitive types smaller
     than int.  We could use int_type_node, but then we would lose
     type information (such as needed for debugging). */
! extern tree promoted_byte_type_node;
! extern tree promoted_short_type_node;
! extern tree promoted_char_type_node;
! extern tree promoted_boolean_type_node;
! 
! extern tree byte_type_node;
! extern tree short_type_node;
! extern tree int_type_node;
! extern tree long_type_node;
! 
! extern tree unsigned_byte_type_node;
! extern tree unsigned_short_type_node;
! extern tree unsigned_int_type_node;
! extern tree unsigned_long_type_node;
! 
! extern tree boolean_type_node;
! 
! extern tree object_type_node;
! extern tree unqualified_object_id_node;
! extern tree object_ptr_type_node;
! extern tree string_type_node;
! extern tree string_ptr_type_node;
! extern tree throwable_type_node;
! extern tree runtime_exception_type_node;
! extern tree error_exception_type_node;
! extern tree rawdata_ptr_type_node;
! 
! extern tree *predef_filenames;
! extern int predef_filenames_size;
! 
! extern tree byte_array_type_node;
! extern tree short_array_type_node;
! extern tree int_array_type_node;
! extern tree long_array_type_node;
! extern tree boolean_array_type_node;
! extern tree char_array_type_node;
! extern tree double_array_type_node;
! extern tree float_array_type_node;
! extern tree array_array_type_node;
! extern tree object_array_type_node;
! extern tree string_array_type_node;
! extern tree boolean_array_vtable;
! extern tree byte_array_vtable;
! extern tree char_array_vtable;
! extern tree short_array_vtable;
! extern tree int_array_vtable;
! extern tree long_array_vtable;
! extern tree float_array_vtable;
! extern tree double_array_vtable;
! extern tree TYPE_identifier_node;      /* "TYPE" */
! extern tree init_identifier_node;      /* "<init>" */
! extern tree clinit_identifier_node;      /* "<clinit>" */
! extern tree finit_identifier_node;      /* "finit$" */
! extern tree finit_leg_identifier_node;  /* "$finit$" */
! extern tree void_signature_node;       /* "()V" */
! extern tree length_identifier_node;  /* "length" */
! extern tree this_identifier_node;  /* "this" */
! extern tree super_identifier_node;  /* "super" */
! extern tree continue_identifier_node;  /* "continue" */
! extern tree access0_identifier_node; /* "access$0" */
! extern tree one_elt_array_domain_type;
  /* The type of the return address of a subroutine. */
! extern tree return_address_type_node;
  
  /* Nodes for boolean constants TRUE and FALSE. */
! extern tree boolean_true_node, boolean_false_node;
  
  /* Integer constants not declared in tree.h. */
! extern tree long_zero_node;
! extern tree float_zero_node;
! extern tree double_zero_node;
! extern tree integer_negative_one_node;
! extern tree integer_two_node;
! extern tree integer_four_node;
! extern tree empty_stmt_node;
  
  /* The type for struct methodtable. */
! extern tree methodtable_type;
! extern tree methodtable_ptr_type;
  
! extern tree utf8const_type;
! extern tree utf8const_ptr_type;
  
- extern tree class_type_node;
- extern tree class_ptr_type;
- extern tree field_type_node;
- extern tree constants_type_node;
- extern tree dtable_type, dtable_ptr_type;
- extern tree field_ptr_type_node;
- extern tree field_info_union_node;
- extern tree method_type_node;
- extern tree method_ptr_type_node;
- #define nativecode_ptr_type_node ptr_type_node
- 
- extern tree end_params_node;
- 
  /* References to internal libjava functions we use. */
! extern tree alloc_object_node;
! extern tree soft_instanceof_node;
! extern tree soft_checkcast_node;
! extern tree soft_initclass_node;
! extern tree soft_newarray_node;
! extern tree soft_anewarray_node;
! extern tree soft_multianewarray_node;
! extern tree soft_badarrayindex_node;
! extern tree soft_nullpointer_node;
  extern tree throw_node[];
! extern tree soft_checkarraystore_node;
! extern tree soft_monitorenter_node;
! extern tree soft_monitorexit_node;
! extern tree soft_lookupinterfacemethod_node;
! extern tree soft_lookupjnimethod_node;
! extern tree soft_getjnienvnewframe_node;
! extern tree soft_jnipopsystemframe_node;
! extern tree soft_fmod_node;
! extern tree soft_exceptioninfo_call_node;
! extern tree soft_idiv_node;
! extern tree soft_irem_node;
! extern tree soft_ldiv_node;
! extern tree soft_lrem_node;
  
! extern tree access_flags_type_node;
  
! extern tree class_dtable_decl;
  
  /* They need to be reset before processing each class */
  extern struct CPool *outgoing_cpool; 
! extern tree current_constant_pool_data_ref;
  
! extern tree wfl_operator;
  
  extern char *cyclic_inheritance_report;
  
--- 208,604 ----
  #define COMPONENT_REF_SIGNATURE(CPOOL, IDX) \
    NAME_AND_TYPE_SIGNATURE (CPOOL, COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX))
  
+ enum java_tree_index
+ {
+   JTI_PROMOTED_BYTE_TYPE_NODE,
+   JTI_PROMOTED_SHORT_TYPE_NODE,
+   JTI_PROMOTED_CHAR_TYPE_NODE,
+   JTI_PROMOTED_BOOLEAN_TYPE_NODE,
+ 
+   JTI_BYTE_TYPE_NODE,
+   JTI_SHORT_TYPE_NODE,
+   JTI_INT_TYPE_NODE,
+   JTI_LONG_TYPE_NODE,
+   
+   JTI_UNSIGNED_BYTE_TYPE_NODE,
+   JTI_UNSIGNED_SHORT_TYPE_NODE,
+   JTI_UNSIGNED_INT_TYPE_NODE,
+   JTI_UNSIGNED_LONG_TYPE_NODE,
+   
+   JTI_BOOLEAN_TYPE_NODE,
+ 
+   JTI_OBJECT_TYPE_NODE,
+   JTI_UNQUALIFIED_OBJECT_ID_NODE,
+   JTI_OBJECT_PTR_TYPE_NODE,
+   JTI_STRING_TYPE_NODE,
+   JTI_STRING_PTR_TYPE_NODE,
+   JTI_THROWABLE_TYPE_NODE,
+   JTI_RUNTIME_EXCEPTION_TYPE_NODE,
+   JTI_ERROR_EXCEPTION_TYPE_NODE,
+   JTI_RAWDATA_PTR_TYPE_NODE,
+ 
+   JTI_BYTE_ARRAY_TYPE_NODE,
+   JTI_SHORT_ARRAY_TYPE_NODE,
+   JTI_INT_ARRAY_TYPE_NODE,
+   JTI_LONG_ARRAY_TYPE_NODE,
+   JTI_BOOLEAN_ARRAY_TYPE_NODE,
+   JTI_CHAR_ARRAY_TYPE_NODE,
+   JTI_DOUBLE_ARRAY_TYPE_NODE,
+   JTI_FLOAT_ARRAY_TYPE_NODE,
+   JTI_ARRAY_ARRAY_TYPE_NODE,
+   JTI_OBJECT_ARRAY_TYPE_NODE,
+   JTI_STRING_ARRAY_TYPE_NODE,
+   JTI_BOOLEAN_ARRAY_VTABLE,
+   JTI_BYTE_ARRAY_VTABLE,
+   JTI_CHAR_ARRAY_VTABLE,
+   JTI_SHORT_ARRAY_VTABLE,
+   JTI_INT_ARRAY_VTABLE,
+   JTI_LONG_ARRAY_VTABLE,
+   JTI_FLOAT_ARRAY_VTABLE,
+   JTI_DOUBLE_ARRAY_VTABLE,
+   JTI_TYPE_IDENTIFIER_NODE,      
+   JTI_INIT_IDENTIFIER_NODE,      
+   JTI_CLINIT_IDENTIFIER_NODE,      
+   JTI_FINIT_IDENTIFIER_NODE,      
+   JTI_FINIT_LEG_IDENTIFIER_NODE,  
+   JTI_VOID_SIGNATURE_NODE,       
+   JTI_LENGTH_IDENTIFIER_NODE,  
+   JTI_THIS_IDENTIFIER_NODE,  
+   JTI_SUPER_IDENTIFIER_NODE,  
+   JTI_CONTINUE_IDENTIFIER_NODE,  
+   JTI_ACCESS0_IDENTIFIER_NODE, 
+   JTI_ONE_ELT_ARRAY_DOMAIN_TYPE,
+ 
+   JTI_RETURN_ADDRESS_TYPE_NODE,
+ 
+   JTI_BOOLEAN_TRUE_NODE, 
+   JTI_BOOLEAN_FALSE_NODE,
+ 
+   JTI_LONG_ZERO_NODE,
+   JTI_FLOAT_ZERO_NODE,
+   JTI_DOUBLE_ZERO_NODE,
+   JTI_INTEGER_NEGATIVE_ONE_NODE,
+   JTI_INTEGER_TWO_NODE,
+   JTI_INTEGER_FOUR_NODE,
+   JTI_EMPTY_STMT_NODE,
+ 
+   JTI_METHODTABLE_TYPE,
+   JTI_METHODTABLE_PTR_TYPE,
+ 
+   JTI_UTF8CONST_TYPE,
+   JTI_UTF8CONST_PTR_TYPE,
+ 
+   JTI_CLASS_TYPE_NODE,
+   JTI_CLASS_PTR_TYPE,
+   JTI_FIELD_TYPE_NODE,
+   JTI_CONSTANTS_TYPE_NODE,
+   JTI_DTABLE_TYPE, 
+   JTI_DTABLE_PTR_TYPE,
+   JTI_FIELD_PTR_TYPE_NODE,
+   JTI_FIELD_INFO_UNION_NODE,
+   JTI_EXCEPTION_TYPE,
+   JTI_EXCEPTION_PTR_TYPE,
+   JTI_LINENUMBERENTRY_TYPE,
+   JTI_LINENUMBERS_TYPE,
+   JTI_METHOD_TYPE_NODE,
+   JTI_METHOD_PTR_TYPE_NODE,
+ 
+   JTI_END_PARAMS_NODE,
+ 
+   JTI_ALLOC_OBJECT_NODE,
+   JTI_SOFT_INSTANCEOF_NODE,
+   JTI_SOFT_CHECKCAST_NODE,
+   JTI_SOFT_INITCLASS_NODE,
+   JTI_SOFT_NEWARRAY_NODE,
+   JTI_SOFT_ANEWARRAY_NODE,
+   JTI_SOFT_MULTIANEWARRAY_NODE,
+   JTI_SOFT_BADARRAYINDEX_NODE,
+   JTI_SOFT_NULLPOINTER_NODE,
+   JTI_SOFT_CHECKARRAYSTORE_NODE,
+   JTI_SOFT_MONITORENTER_NODE,
+   JTI_SOFT_MONITOREXIT_NODE,
+   JTI_SOFT_LOOKUPINTERFACEMETHOD_NODE,
+   JTI_SOFT_LOOKUPJNIMETHOD_NODE,
+   JTI_SOFT_GETJNIENVNEWFRAME_NODE,
+   JTI_SOFT_JNIPOPSYSTEMFRAME_NODE,
+   JTI_SOFT_FMOD_NODE,
+   JTI_SOFT_EXCEPTIONINFO_CALL_NODE,
+   JTI_SOFT_IDIV_NODE,
+   JTI_SOFT_IREM_NODE,
+   JTI_SOFT_LDIV_NODE,
+   JTI_SOFT_LREM_NODE,
+ 
+   JTI_ACCESS_FLAGS_TYPE_NODE,
+ 
+   JTI_CLASS_DTABLE_DECL,
+ 
+   JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE,
+ 
+   JTI_WFL_OPERATOR,
+   JTI_CURRENT_CONSTANT_POOL_DATA_REF,
+ 
+   JTI_MAIN_CLASS,
+   JTI_CURRENT_CLASS,
+   JTI_ALL_CLASS_LIST,
+ 
+   JTI_MAX
+ };
+ 
+ extern tree java_global_trees[JTI_MAX];
+ 
  /* "Promoted types" that are used for primitive types smaller
     than int.  We could use int_type_node, but then we would lose
     type information (such as needed for debugging). */
! #define promoted_byte_type_node \
!   java_global_trees[JTI_PROMOTED_BYTE_TYPE_NODE]
! #define promoted_short_type_node \
!   java_global_trees[JTI_PROMOTED_SHORT_TYPE_NODE]
! #define promoted_char_type_node \
!   java_global_trees[JTI_PROMOTED_CHAR_TYPE_NODE]
! #define promoted_boolean_type_node \
!   java_global_trees[JTI_PROMOTED_BOOLEAN_TYPE_NODE]
! 
! #define byte_type_node \
!   java_global_trees[JTI_BYTE_TYPE_NODE]
! #define short_type_node \
!   java_global_trees[JTI_SHORT_TYPE_NODE]
! #define int_type_node \
!   java_global_trees[JTI_INT_TYPE_NODE]
! #define long_type_node \
!   java_global_trees[JTI_LONG_TYPE_NODE]
! 
! #define unsigned_byte_type_node \
!   java_global_trees[JTI_UNSIGNED_BYTE_TYPE_NODE]
! #define unsigned_short_type_node \
!   java_global_trees[JTI_UNSIGNED_SHORT_TYPE_NODE]
! #define unsigned_int_type_node \
!   java_global_trees[JTI_UNSIGNED_INT_TYPE_NODE]
! #define unsigned_long_type_node \
!   java_global_trees[JTI_UNSIGNED_LONG_TYPE_NODE]
! 
! #define boolean_type_node \
!   java_global_trees[JTI_BOOLEAN_TYPE_NODE]
! 
! #define object_type_node \
!   java_global_trees[JTI_OBJECT_TYPE_NODE]
! #define unqualified_object_id_node \
!   java_global_trees[JTI_UNQUALIFIED_OBJECT_ID_NODE]
! #define object_ptr_type_node \
!   java_global_trees[JTI_OBJECT_PTR_TYPE_NODE]
! #define string_type_node \
!   java_global_trees[JTI_STRING_TYPE_NODE]
! #define string_ptr_type_node \
!   java_global_trees[JTI_STRING_PTR_TYPE_NODE]
! #define throwable_type_node \
!   java_global_trees[JTI_THROWABLE_TYPE_NODE]
! #define runtime_exception_type_node \
!   java_global_trees[JTI_RUNTIME_EXCEPTION_TYPE_NODE]
! #define error_exception_type_node \
!   java_global_trees[JTI_ERROR_EXCEPTION_TYPE_NODE]
! #define rawdata_ptr_type_node \
!   java_global_trees[JTI_RAWDATA_PTR_TYPE_NODE]
! 
! #define byte_array_type_node \
!   java_global_trees[JTI_BYTE_ARRAY_TYPE_NODE]
! #define short_array_type_node \
!   java_global_trees[JTI_SHORT_ARRAY_TYPE_NODE]
! #define int_array_type_node \
!   java_global_trees[JTI_INT_ARRAY_TYPE_NODE]
! #define long_array_type_node \
!   java_global_trees[JTI_LONG_ARRAY_TYPE_NODE]
! #define boolean_array_type_node \
!   java_global_trees[JTI_BOOLEAN_ARRAY_TYPE_NODE]
! #define char_array_type_node \
!   java_global_trees[JTI_CHAR_ARRAY_TYPE_NODE]
! #define double_array_type_node \
!   java_global_trees[JTI_DOUBLE_ARRAY_TYPE_NODE]
! #define float_array_type_node \
!   java_global_trees[JTI_FLOAT_ARRAY_TYPE_NODE]
! #define array_array_type_node \
!   java_global_trees[JTI_ARRAY_ARRAY_TYPE_NODE]
! #define object_array_type_node \
!   java_global_trees[JTI_OBJECT_ARRAY_TYPE_NODE]
! #define string_array_type_node \
!   java_global_trees[JTI_STRING_ARRAY_TYPE_NODE]
! #define boolean_array_vtable \
!   java_global_trees[JTI_BOOLEAN_ARRAY_VTABLE]
! #define byte_array_vtable \
!   java_global_trees[JTI_BYTE_ARRAY_VTABLE]
! #define char_array_vtable \
!   java_global_trees[JTI_CHAR_ARRAY_VTABLE]
! #define short_array_vtable \
!   java_global_trees[JTI_SHORT_ARRAY_VTABLE]
! #define int_array_vtable \
!   java_global_trees[JTI_INT_ARRAY_VTABLE]
! #define long_array_vtable \
!   java_global_trees[JTI_LONG_ARRAY_VTABLE]
! #define float_array_vtable \
!   java_global_trees[JTI_FLOAT_ARRAY_VTABLE]
! #define double_array_vtable \
!   java_global_trees[JTI_DOUBLE_ARRAY_VTABLE]
! #define TYPE_identifier_node \
!   java_global_trees[JTI_TYPE_IDENTIFIER_NODE]      /* "TYPE" */
! #define init_identifier_node \
!   java_global_trees[JTI_INIT_IDENTIFIER_NODE]      /* "<init>" */
! #define clinit_identifier_node \
!   java_global_trees[JTI_CLINIT_IDENTIFIER_NODE]      /* "<clinit>" */
! #define finit_identifier_node \
!   java_global_trees[JTI_FINIT_IDENTIFIER_NODE]      /* "finit$" */
! #define finit_leg_identifier_node \
!   java_global_trees[JTI_FINIT_LEG_IDENTIFIER_NODE]  /* "$finit$" */
! #define void_signature_node \
!   java_global_trees[JTI_VOID_SIGNATURE_NODE]       /* "()V" */
! #define length_identifier_node \
!   java_global_trees[JTI_LENGTH_IDENTIFIER_NODE]  /* "length" */
! #define this_identifier_node \
!   java_global_trees[JTI_THIS_IDENTIFIER_NODE]  /* "this" */
! #define super_identifier_node \
!   java_global_trees[JTI_SUPER_IDENTIFIER_NODE]  /* "super" */
! #define continue_identifier_node \
!   java_global_trees[JTI_CONTINUE_IDENTIFIER_NODE]  /* "continue" */
! #define access0_identifier_node \
!   java_global_trees[JTI_ACCESS0_IDENTIFIER_NODE] /* "access$0" */
! #define one_elt_array_domain_type \
!   java_global_trees[JTI_ONE_ELT_ARRAY_DOMAIN_TYPE]
  /* The type of the return address of a subroutine. */
! #define return_address_type_node \
!   java_global_trees[JTI_RETURN_ADDRESS_TYPE_NODE]
  
  /* Nodes for boolean constants TRUE and FALSE. */
! #define boolean_true_node \
!   java_global_trees[JTI_BOOLEAN_TRUE_NODE]
! #define boolean_false_node \
!   java_global_trees[JTI_BOOLEAN_FALSE_NODE]
  
  /* Integer constants not declared in tree.h. */
! #define long_zero_node \
!   java_global_trees[JTI_LONG_ZERO_NODE]
! #define float_zero_node \
!   java_global_trees[JTI_FLOAT_ZERO_NODE]
! #define double_zero_node \
!   java_global_trees[JTI_DOUBLE_ZERO_NODE]
! #define integer_negative_one_node \
!   java_global_trees[JTI_INTEGER_NEGATIVE_ONE_NODE]
! #define integer_two_node \
!   java_global_trees[JTI_INTEGER_TWO_NODE]
! #define integer_four_node \
!   java_global_trees[JTI_INTEGER_FOUR_NODE]
! #define empty_stmt_node \
!   java_global_trees[JTI_EMPTY_STMT_NODE]
  
  /* The type for struct methodtable. */
! #define methodtable_type \
!   java_global_trees[JTI_METHODTABLE_TYPE]
! #define methodtable_ptr_type \
!   java_global_trees[JTI_METHODTABLE_PTR_TYPE]
! 
! #define utf8const_type \
!   java_global_trees[JTI_UTF8CONST_TYPE]
! #define utf8const_ptr_type \
!   java_global_trees[JTI_UTF8CONST_PTR_TYPE]
! 
! #define class_type_node \
!   java_global_trees[JTI_CLASS_TYPE_NODE]
! #define class_ptr_type \
!   java_global_trees[JTI_CLASS_PTR_TYPE]
! #define field_type_node \
!   java_global_trees[JTI_FIELD_TYPE_NODE]
! #define constants_type_node \
!   java_global_trees[JTI_CONSTANTS_TYPE_NODE]
! #define dtable_type \
!   java_global_trees[JTI_DTABLE_TYPE]
! #define dtable_ptr_type \
!   java_global_trees[JTI_DTABLE_PTR_TYPE]
! #define field_ptr_type_node \
!   java_global_trees[JTI_FIELD_PTR_TYPE_NODE]
! #define field_info_union_node \
!   java_global_trees[JTI_FIELD_INFO_UNION_NODE]
! #define jexception_type \
!   java_global_trees[JTI_EXCEPTION_TYPE]
! #define jexception_ptr_type \
!   java_global_trees[JTI_EXCEPTION_PTR_TYPE]
! #define lineNumberEntry_type \
!   java_global_trees[JTI_LINENUMBERENTRY_TYPE]
! #define lineNumbers_type \
!   java_global_trees[JTI_LINENUMBERS_TYPE]
! #define method_type_node \
!   java_global_trees[JTI_METHOD_TYPE_NODE]
! #define method_ptr_type_node \
!   java_global_trees[JTI_METHOD_PTR_TYPE_NODE]
  
! #define end_params_node \
!   java_global_trees[JTI_END_PARAMS_NODE]
  
  /* References to internal libjava functions we use. */
! #define alloc_object_node \
!   java_global_trees[JTI_ALLOC_OBJECT_NODE]
! #define soft_instanceof_node \
!   java_global_trees[JTI_SOFT_INSTANCEOF_NODE]
! #define soft_checkcast_node \
!   java_global_trees[JTI_SOFT_CHECKCAST_NODE]
! #define soft_initclass_node \
!   java_global_trees[JTI_SOFT_INITCLASS_NODE]
! #define soft_newarray_node \
!   java_global_trees[JTI_SOFT_NEWARRAY_NODE]
! #define soft_anewarray_node \
!   java_global_trees[JTI_SOFT_ANEWARRAY_NODE]
! #define soft_multianewarray_node \
!   java_global_trees[JTI_SOFT_MULTIANEWARRAY_NODE]
! #define soft_badarrayindex_node \
!   java_global_trees[JTI_SOFT_BADARRAYINDEX_NODE]
! #define soft_nullpointer_node \
!   java_global_trees[JTI_SOFT_NULLPOINTER_NODE]
  extern tree throw_node[];
! #define soft_checkarraystore_node \
!   java_global_trees[JTI_SOFT_CHECKARRAYSTORE_NODE]
! #define soft_monitorenter_node \
!   java_global_trees[JTI_SOFT_MONITORENTER_NODE]
! #define soft_monitorexit_node \
!   java_global_trees[JTI_SOFT_MONITOREXIT_NODE]
! #define soft_lookupinterfacemethod_node \
!   java_global_trees[JTI_SOFT_LOOKUPINTERFACEMETHOD_NODE]
! #define soft_lookupjnimethod_node \
!   java_global_trees[JTI_SOFT_LOOKUPJNIMETHOD_NODE]
! #define soft_getjnienvnewframe_node \
!   java_global_trees[JTI_SOFT_GETJNIENVNEWFRAME_NODE]
! #define soft_jnipopsystemframe_node \
!   java_global_trees[JTI_SOFT_JNIPOPSYSTEMFRAME_NODE]
! #define soft_fmod_node \
!   java_global_trees[JTI_SOFT_FMOD_NODE]
! #define soft_exceptioninfo_call_node \
!   java_global_trees[JTI_SOFT_EXCEPTIONINFO_CALL_NODE]
! #define soft_idiv_node \
!   java_global_trees[JTI_SOFT_IDIV_NODE]
! #define soft_irem_node \
!   java_global_trees[JTI_SOFT_IREM_NODE]
! #define soft_ldiv_node \
!   java_global_trees[JTI_SOFT_LDIV_NODE]
! #define soft_lrem_node \
!   java_global_trees[JTI_SOFT_LREM_NODE]
! 
! #define access_flags_type_node \
!   java_global_trees[JTI_ACCESS_FLAGS_TYPE_NODE]
! 
! #define class_dtable_decl \
!   java_global_trees[JTI_CLASS_DTABLE_DECL]
  
! #define nativecode_ptr_array_type_node \
!   java_global_trees[JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE]
  
! #define PREDEF_FILENAMES_SIZE 7
! extern tree predef_filenames[PREDEF_FILENAMES_SIZE];
! 
! #define nativecode_ptr_type_node ptr_type_node
  
  /* They need to be reset before processing each class */
  extern struct CPool *outgoing_cpool; 
! /* If non-NULL, an ADDR_EXPR referencing a VAR_DECL containing
!    the constant data array for the current class. */
! #define current_constant_pool_data_ref \
!   java_global_trees[JTI_CURRENT_CONSTANT_POOL_DATA_REF]
  
! #define wfl_operator \
!   java_global_trees[JTI_WFL_OPERATOR]
  
  extern char *cyclic_inheritance_report;
  
*************** extern unsigned long java_hash_hash_tree
*** 798,803 ****
--- 1059,1065 ----
  extern boolean java_hash_compare_tree_node PARAMS ((hash_table_key, 
  						    hash_table_key));
  extern void java_check_methods PARAMS ((tree));
+ extern void init_jcf_parse PARAMS((void));
  
  /* We use ARGS_SIZE_RTX to indicate that gcc/expr.h has been included
     to declare `enum expand_modifier'. */
Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/jcf-parse.c,v
retrieving revision 1.55
diff -c -p -r1.55 jcf-parse.c
*** jcf-parse.c	2000/09/13 17:09:36	1.55
--- jcf-parse.c	2000/09/23 16:35:57
*************** The Free Software Foundation is independ
*** 34,39 ****
--- 34,40 ----
  #include "java-tree.h"
  #include "toplev.h"
  #include "parse.h"
+ #include "ggc.h"
  
  #ifdef HAVE_LOCALE_H
  #include <locale.h>
*************** extern struct obstack permanent_obstack;
*** 69,83 ****
     before static field references.  */
  extern int always_initialize_class_p;
  
- /* The class we are currently processing. */
- tree current_class = NULL_TREE;
- 
- /* The class we started with. */
- tree main_class = NULL_TREE;
- 
- /* List of all class DECL seen so far.  */
- tree all_class_list = NULL_TREE;
- 
  /* The FIELD_DECL for the current field.  */
  static tree current_field = NULL_TREE;
  
--- 70,75 ----
*************** predefined_filename_p (node)
*** 808,814 ****
       tree node;
  {
    int i;
!   for (i = 0; i < predef_filenames_size; i++)
      if (predef_filenames [i] == node)
        return 1;
    return 0;
--- 800,806 ----
       tree node;
  {
    int i;
!   for (i = 0; i < PREDEF_FILENAMES_SIZE; i++)
      if (predef_filenames [i] == node)
        return 1;
    return 0;
*************** DEFUN(jcf_figure_file_type, (jcf),
*** 1095,1097 ****
--- 1087,1098 ----
    return JCF_SOURCE;
  }
  
+ /* Initialization.  */
+ 
+ void
+ init_jcf_parse ()
+ {
+   /* Register roots with the garbage collector.  */
+   ggc_add_tree_root (&current_field, 1);
+   ggc_add_tree_root (&current_method, 1);
+ }
Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/jcf-write.c,v
retrieving revision 1.68
diff -c -p -r1.68 jcf-write.c
*** jcf-write.c	2000/08/29 21:39:49	1.68
--- jcf-write.c	2000/09/23 16:35:59
*************** The Free Software Foundation is independ
*** 34,39 ****
--- 34,40 ----
  #include "parse.h" /* for BLOCK_EXPR_BODY */
  #include "buffer.h"
  #include "toplev.h"
+ #include "ggc.h"
  
  #ifndef DIR_SEPARATOR
  #define DIR_SEPARATOR '/'
*************** generate_classfile (clas, state)
*** 3100,3106 ****
  
    /* generate the SourceFile attribute. */
    if (SourceFile_node == NULL_TREE) 
!     SourceFile_node = get_identifier ("SourceFile");
    i = find_utf8_constant (&state->cpool, SourceFile_node);
    PUT2 (i);  /* attribute_name_index */
    PUT4 (2);
--- 3101,3111 ----
  
    /* generate the SourceFile attribute. */
    if (SourceFile_node == NULL_TREE) 
!     {
!       SourceFile_node = get_identifier ("SourceFile");
!       ggc_add_tree_root (&SourceFile_node, 1);
!     }
! 
    i = find_utf8_constant (&state->cpool, SourceFile_node);
    PUT2 (i);  /* attribute_name_index */
    PUT4 (2);
*************** append_synthetic_attribute (state)
*** 3126,3132 ****
    int i;
  
    if (Synthetic_node == NULL_TREE)
!     Synthetic_node = get_identifier ("Synthetic");
    i = find_utf8_constant (&state->cpool, Synthetic_node);
    PUT2 (i);		/* Attribute string index */
    PUT4 (0);		/* Attribute length */
--- 3131,3140 ----
    int i;
  
    if (Synthetic_node == NULL_TREE)
!     {
!       Synthetic_node = get_identifier ("Synthetic");
!       ggc_add_tree_root (&Synthetic_node, 1);
!     }
    i = find_utf8_constant (&state->cpool, Synthetic_node);
    PUT2 (i);		/* Attribute string index */
    PUT4 (0);		/* Attribute length */
*************** append_innerclasses_attribute (state, cl
*** 3150,3157 ****
  
    ptr = append_chunk (NULL, 8, state); /* 2+4+2 */
    
!   if (InnerClasses_node == NULL_TREE)
!     InnerClasses_node = get_identifier ("InnerClasses");
    i = find_utf8_constant (&state->cpool, InnerClasses_node);
    PUT2 (i);
    length_marker = ptr; PUT4 (0); /* length, to be later patched */
--- 3158,3168 ----
  
    ptr = append_chunk (NULL, 8, state); /* 2+4+2 */
    
!   if (InnerClasses_node == NULL_TREE) 
!     {
!       InnerClasses_node = get_identifier ("InnerClasses");
!       ggc_add_tree_root (&InnerClasses_node, 1);
!     }
    i = find_utf8_constant (&state->cpool, InnerClasses_node);
    PUT2 (i);
    length_marker = ptr; PUT4 (0); /* length, to be later patched */
*************** append_innerclasses_attribute_entry (sta
*** 3198,3205 ****
    unsigned char *ptr = append_chunk (NULL, 8, state);
  
    if (!anonymous_name)
!     anonymous_name = get_identifier ("");
!   
    icii = find_class_constant (&state->cpool, TREE_TYPE (decl));
    ocii = find_class_constant (&state->cpool, TREE_TYPE (DECL_CONTEXT (decl))); 
  
--- 3209,3219 ----
    unsigned char *ptr = append_chunk (NULL, 8, state);
  
    if (!anonymous_name)
!     {
!       anonymous_name = get_identifier ("");
!       ggc_add_tree_root (&anonymous_name, 1);
!     }
! 
    icii = find_class_constant (&state->cpool, TREE_TYPE (decl));
    ocii = find_class_constant (&state->cpool, TREE_TYPE (DECL_CONTEXT (decl))); 
  
Index: lang.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/lang.c,v
retrieving revision 1.48
diff -c -p -r1.48 lang.c
*** lang.c	2000/09/12 22:23:59	1.48
--- lang.c	2000/09/23 16:35:59
*************** The Free Software Foundation is independ
*** 35,40 ****
--- 35,41 ----
  #include "toplev.h"
  #include "flags.h"
  #include "xref.h"
+ #include "ggc.h"
  
  static void put_decl_string PARAMS ((const char *, int));
  static void put_decl_node PARAMS ((tree));
*************** lang_print_error (file)
*** 518,523 ****
--- 519,534 ----
  {
    static tree last_error_function_context = NULL_TREE;
    static tree last_error_function = NULL;
+   static int initialized_p;
+ 
+   /* Register LAST_ERROR_FUNCTION_CONTEXT and LAST_ERROR_FUNCTION with
+      the garbage collector.  */
+   if (!initialized_p)
+     {
+       ggc_add_tree_root (&last_error_function_context, 1);
+       ggc_add_tree_root (&last_error_function, 1);
+       initialized_p = 1;
+     }
  
    if (current_function_decl != NULL
        && DECL_CONTEXT (current_function_decl) != last_error_function_context)
Index: parse.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.h,v
retrieving revision 1.58
diff -c -p -r1.58 parse.h
*** parse.h	2000/09/12 22:23:59	1.58
--- parse.h	2000/09/23 16:36:00
*************** struct parser_ctxt {
*** 764,771 ****
    /* This section is defined only if we compile jc1 */
  #ifndef JC1_LITE
    tree modifier_ctx [11];	    /* WFL of modifiers */
!   tree current_class;		    /* Current class */
!   tree current_function_decl;	    /* Current function decl, save/restore */
  
    struct JCF *current_jcf;	    /* CU jcf */
  
--- 764,771 ----
    /* This section is defined only if we compile jc1 */
  #ifndef JC1_LITE
    tree modifier_ctx [11];	    /* WFL of modifiers */
!   tree class_type;		    /* Current class */
!   tree function_decl;	            /* Current function decl, save/restore */
  
    struct JCF *current_jcf;	    /* CU jcf */
  
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.209
diff -c -p -r1.209 parse.y
*** parse.y	2000/09/12 22:23:59	1.209
--- parse.y	2000/09/23 16:36:08
*************** definitions and other extensions.  */
*** 65,70 ****
--- 65,71 ----
  #include "function.h"
  #include "except.h"
  #include "defaults.h"
+ #include "ggc.h"
  
  #ifndef DIR_SEPARATOR
  #define DIR_SEPARATOR '/'
*************** static enum tree_code binop_lookup[19] =
*** 361,370 ****
     in compound assignements. */
  #define BINOP_COMPOUND_CANDIDATES 11
  
- /* Fake WFL used to report error message. It is initialized once if
-    needed and reused with it's location information is overriden.  */
- tree wfl_operator = NULL_TREE;
- 
  /* The "$L" identifier we use to create labels.  */
  static tree label_id = NULL_TREE;
  
--- 362,367 ----
*************** static tree wpv_id;
*** 399,404 ****
--- 396,408 ----
  /* The list of all packages we've seen so far */
  static tree package_list = NULL_TREE;
   
+ /* Hold THIS for the scope of the current public method decl.  */
+ static tree current_this;
+ 
+ /* Hold a list of catch clauses list. The first element of this list is
+    the list of the catch clauses of the currently analysed try block. */
+ static tree currently_caught_type_list;
+ 
  /* Check modifiers. If one doesn't fit, retrieve it in its declaration
     line and point it out.  */
  /* Should point out the one that don't fit. ASCII/unicode, going
*************** static tree package_list = NULL_TREE;
*** 577,582 ****
--- 581,603 ----
  %%
  /* 19.2 Production from 2.3: The Syntactic Grammar  */
  goal:
+                 {
+ 		  /* Register static variables with the garbage
+ 		     collector.  */
+ 		  ggc_add_tree_root (&label_id, 1);
+ 		  ggc_add_tree_root (&wfl_string_buffer, 1);
+ 		  ggc_add_tree_root (&wfl_append, 1);
+ 		  ggc_add_tree_root (&wfl_to_string, 1);
+ 		  ggc_add_tree_root (&java_lang_id, 1);
+ 		  ggc_add_tree_root (&inst_id, 1);
+ 		  ggc_add_tree_root (&java_lang_cloneable, 1);
+ 		  ggc_add_tree_root (&java_io_serializable, 1);
+ 		  ggc_add_tree_root (&current_static_block, 1);
+ 		  ggc_add_tree_root (&wpv_id, 1);
+ 		  ggc_add_tree_root (&package_list, 1);
+ 		  ggc_add_tree_root (&current_this, 1);
+ 		  ggc_add_tree_root (&currently_caught_type_list, 1);
+ 		}
  	compilation_unit
  		{}
  ;
*************** java_pop_parser_context (generate)
*** 2618,2624 ****
        next->incomplete_class = ctxp->incomplete_class;
        next->gclass_list = ctxp->gclass_list;
        lineno = ctxp->lineno;
!       current_class = ctxp->current_class;
      }
  
    /* If the old and new lexers differ, then free the old one.  */
--- 2639,2645 ----
        next->incomplete_class = ctxp->incomplete_class;
        next->gclass_list = ctxp->gclass_list;
        lineno = ctxp->lineno;
!       current_class = ctxp->class_type;
      }
  
    /* If the old and new lexers differ, then free the old one.  */
*************** java_parser_context_save_global ()
*** 2665,2673 ****
      create_new_parser_context (1);
  
    ctxp->lineno = lineno;
!   ctxp->current_class = current_class;
    ctxp->filename = input_filename;
!   ctxp->current_function_decl = current_function_decl;
    ctxp->saved_data = 1;
  }
  
--- 2686,2694 ----
      create_new_parser_context (1);
  
    ctxp->lineno = lineno;
!   ctxp->class_type = current_class;
    ctxp->filename = input_filename;
!   ctxp->function_decl = current_function_decl;
    ctxp->saved_data = 1;
  }
  
*************** void
*** 2678,2686 ****
  java_parser_context_restore_global ()
  {
    lineno = ctxp->lineno;
!   current_class = ctxp->current_class;
    input_filename = ctxp->filename;
!   current_function_decl = ctxp->current_function_decl;
    ctxp->saved_data = 0;
    if (ctxp->saved_data_ctx)
      java_pop_parser_context (0);
--- 2699,2707 ----
  java_parser_context_restore_global ()
  {
    lineno = ctxp->lineno;
!   current_class = ctxp->class_type;
    input_filename = ctxp->filename;
!   current_function_decl = ctxp->function_decl;
    ctxp->saved_data = 0;
    if (ctxp->saved_data_ctx)
      java_pop_parser_context (0);
*************** java_parser_context_suspend ()
*** 2699,2706 ****
    /* Duplicate the previous context, use it to save the globals we're
       interested in */
    create_new_parser_context (1);
!   ctxp->current_function_decl = current_function_decl;
!   ctxp->current_class = current_class;
  
    /* Then create a new context which inherits all data from the
       previous one. This will be the new current context  */
--- 2720,2727 ----
    /* Duplicate the previous context, use it to save the globals we're
       interested in */
    create_new_parser_context (1);
!   ctxp->function_decl = current_function_decl;
!   ctxp->class_type = current_class;
  
    /* Then create a new context which inherits all data from the
       previous one. This will be the new current context  */
*************** java_parser_context_resume ()
*** 2730,2737 ****
    restored->class_list = old->class_list;
  
    /* Restore the current class and function from the saver */
!   current_class = saver->current_class;
!   current_function_decl = saver->current_function_decl;
  
    /* Retrive the restored context */
    ctxp = restored;
--- 2751,2758 ----
    restored->class_list = old->class_list;
  
    /* Restore the current class and function from the saver */
!   current_class = saver->class_type;
!   current_function_decl = saver->function_decl;
  
    /* Retrive the restored context */
    ctxp = restored;
*************** verify_constructor_circularity (meth, cu
*** 4570,4576 ****
--- 4591,4607 ----
       tree meth, current;
  {
    static tree list = NULL_TREE;
+   static int initialized_p;
    tree c;
+ 
+   /* If we haven't already registered LIST with the garbage collector,
+      do so now.  */
+   if (!initialized_p)
+     {
+       ggc_add_tree_root (&list, 1);
+       initialized_p = 1;
+     }
+ 
    for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
      {
        if (TREE_VALUE (c) == meth)
*************** lookup_cl (decl)
*** 6409,6415 ****
      return NULL_TREE;
  
    if (cl == NULL_TREE)
!     cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
  
    EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
    EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
--- 6440,6449 ----
      return NULL_TREE;
  
    if (cl == NULL_TREE)
!     {
!       cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
!       ggc_add_tree_root (&cl, 1);
!     }
  
    EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
    EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
*************** add_stmt_to_compound (existing, type, st
*** 7249,7257 ****
      return stmt;
  }
  
- /* Hold THIS for the scope of the current public method decl.  */
- static tree current_this;
- 
  void java_layout_seen_class_methods ()
  {
    tree previous_list = all_class_list;
--- 7283,7288 ----
*************** void
*** 7278,7285 ****
  java_reorder_fields ()
  {
    static tree stop_reordering = NULL_TREE;
! 
    tree current;
    for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
      {
        current_class = TREE_TYPE (TREE_VALUE (current));
--- 7309,7324 ----
  java_reorder_fields ()
  {
    static tree stop_reordering = NULL_TREE;
!   static int initialized_p;
    tree current;
+ 
+   /* Register STOP_REORDERING with the garbage collector.  */
+   if (!initialized_p)
+     {
+       ggc_add_tree_root (&stop_reordering, 1);
+       initialized_p = 1;
+     }
+ 
    for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
      {
        current_class = TREE_TYPE (TREE_VALUE (current));
*************** java_complete_expand_methods (class_decl
*** 7490,7499 ****
    TYPE_CPOOL (current_class) = outgoing_cpool;
  }
  
- /* Hold a list of catch clauses list. The first element of this list is
-    the list of the catch clauses of the currently analysed try block. */
- static tree currently_caught_type_list;
- 
  /* Attempt to create <clinit>. Pre-expand static fields so they can be
     safely used in some other methods/constructors.  */
  
--- 7529,7534 ----
*************** build_current_thisn (type)
*** 8175,8190 ****
  {
    static int saved_i = -1;
    static tree saved_thisn = NULL_TREE;
! 
    tree decl;
    char buffer [80];
    int i = 0;
  
!   if (type)
      {
!       static tree saved_type = NULL_TREE;
!       static int saved_type_i = 0;
  
        if (type == saved_type)
  	i = saved_type_i;
        else
--- 8210,8232 ----
  {
    static int saved_i = -1;
    static tree saved_thisn = NULL_TREE;
!   static tree saved_type = NULL_TREE;
!   static int saved_type_i = 0;
!   static int initialized_p;
    tree decl;
    char buffer [80];
    int i = 0;
  
!   /* Register SAVED_THISN and SAVED_TYPE with the garbage collector.  */
!   if (!initialized_p)
      {
!       ggc_add_tree_root (&saved_thisn, 1);
!       ggc_add_tree_root (&saved_type, 1);
!       initialized_p = 1;
!     }
  
+   if (type)
+     {
        if (type == saved_type)
  	i = saved_type_i;
        else
*************** build_dot_class_method (class)
*** 8256,8261 ****
--- 8298,8305 ----
      {
        get_message_wfl = build_wfl_node (get_identifier ("getMessage"));
        type_parm_wfl = build_wfl_node (get_identifier ("type$"));
+       ggc_add_tree_root (&get_message_wfl, 1);
+       ggc_add_tree_root (&type_parm_wfl, 1);
      }
  
    /* Build the arguments */
*************** class_in_current_package (class)
*** 9547,9552 ****
--- 9591,9604 ----
    breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
    if (ctxp->package == left)
      {
+       static int initialized_p;
+       /* Register CACHE with the garbage collector.  */
+       if (!initialized_p)
+ 	{
+ 	  ggc_add_tree_root (&cache, 1);
+ 	  initialized_p = 1;
+ 	}
+ 
        cache = class;
        return 1;
      }
*************** argument_types_convertible (m1, m2_or_ar
*** 10504,10512 ****
--- 10556,10574 ----
  {
    static tree m2_arg_value = NULL_TREE;
    static tree m2_arg_cache = NULL_TREE;
+   static int initialized_p;
  
    register tree m1_arg, m2_arg;
  
+   /* Register M2_ARG_VALUE and M2_ARG_CACHE with the garbage
+      collector.  */
+   if (!initialized_p)
+     {
+       ggc_add_tree_root (&m2_arg_value, 1);
+       ggc_add_tree_root (&m2_arg_cache, 1);
+       initialized_p = 1;
+     }
+ 
    SKIP_THIS_AND_ARTIFICIAL_PARMS (m1_arg, m1)
  
    if (m2_arg_value == m2_or_arglist)
*************** resolve_type_during_patch (type)
*** 13459,13467 ****
     found. Otherwise NODE or something meant to replace it is returned.  */
  
  static tree
! patch_cast (node, wfl_operator)
       tree node;
!      tree wfl_operator;
  {
    tree op = TREE_OPERAND (node, 0);
    tree op_type = TREE_TYPE (op);
--- 13521,13529 ----
     found. Otherwise NODE or something meant to replace it is returned.  */
  
  static tree
! patch_cast (node, wfl_op)
       tree node;
!      tree wfl_op;
  {
    tree op = TREE_OPERAND (node, 0);
    tree op_type = TREE_TYPE (op);
*************** patch_cast (node, wfl_operator)
*** 13530,13536 ****
  
    /* Any other casts are proven incorrect at compile time */
    t1 = xstrdup (lang_printable_name (op_type, 0));
!   parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
  		       t1, lang_printable_name (cast_type, 0));
    free (t1);
    return error_mark_node;
--- 13592,13598 ----
  
    /* Any other casts are proven incorrect at compile time */
    t1 = xstrdup (lang_printable_name (op_type, 0));
!   parse_error_context (wfl_op, "Invalid cast from `%s' to `%s'",
  		       t1, lang_printable_name (cast_type, 0));
    free (t1);
    return error_mark_node;


More information about the Gcc-patches mailing list