This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ASM_OUTPUT_DWARF_ADDR_CONST patch


On Tue, Jan 25, 2000 at 01:59:39AM -0800, Richard Henderson wrote:
> Um, ggc_add_tree_varray_root isn't what you should be using.
> They aren't trees.

I went ahead and fixed this so that I could continue
tracking down a reported irix failure.


r~


        * dwarf2out.c (dwarf2out_init): Use ggc_add_rtx_varray_root.
        * ggc-common.c (ggc_add_rtx_varray_root): New.
        (ggc_mark_rtx_varray): New.
        (ggc_mark_rtx_varray_ptr): New.  Shift all ggc_mark_foo_ptr
        functions down below ggc_mark_foo.
        * ggc.h (ggc_add_rtx_varray_root, ggc_mark_rtx_varray): Declare.

Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.144
diff -c -p -d -r1.144 dwarf2out.c
*** dwarf2out.c	2000/01/25 05:59:17	1.144
--- dwarf2out.c	2000/01/25 10:44:08
*************** dwarf2out_init (asm_out_file, main_input
*** 9829,9835 ****
    if (ggc_p)
      {
        VARRAY_RTX_INIT (used_rtx_varray, 32, "used_rtx_varray");
!       ggc_add_tree_varray_root (&used_rtx_varray, 1);
      }
  
    ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
--- 9829,9835 ----
    if (ggc_p)
      {
        VARRAY_RTX_INIT (used_rtx_varray, 32, "used_rtx_varray");
!       ggc_add_rtx_varray_root (&used_rtx_varray, 1);
      }
  
    ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
Index: ggc-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ggc-common.c,v
retrieving revision 1.19
diff -c -p -d -r1.19 ggc-common.c
*** ggc-common.c	2000/01/17 17:16:20	1.19
--- ggc-common.c	2000/01/25 10:44:08
*************** static ggc_statistics *ggc_stats;
*** 35,40 ****
--- 35,41 ----
  
  static void ggc_mark_rtx_ptr PARAMS ((void *));
  static void ggc_mark_tree_ptr PARAMS ((void *));
+ static void ggc_mark_rtx_varray_ptr PARAMS ((void *));
  static void ggc_mark_tree_varray_ptr PARAMS ((void *));
  static void ggc_mark_tree_hash_table_ptr PARAMS ((void *));
  static void ggc_mark_string_ptr PARAMS ((void *));
*************** struct ggc_root
*** 56,112 ****
  
  static struct ggc_root *roots;
  
- /* Type-correct function to pass to ggc_add_root.  It just forwards
-    *ELT (which is an rtx) to ggc_mark_tree_varray.  */
- 
- static void
- ggc_mark_rtx_ptr (elt)
-      void *elt;
- {
-   ggc_mark_rtx (*(rtx *) elt);
- }
- 
- /* Type-correct function to pass to ggc_add_root.  It just forwards
-    *ELT (which is a tree) to ggc_mark_tree.  */
- 
- static void
- ggc_mark_tree_ptr (elt)
-      void *elt;
- {
-   ggc_mark_tree (*(tree *) elt);
- }
- 
- /* Type-correct function to pass to ggc_add_root.  It just forwards
-    ELT (which is really a varray_type *) to ggc_mark_tree_varray.  */
- 
- static void
- ggc_mark_tree_varray_ptr (elt)
-      void *elt;
- {
-   ggc_mark_tree_varray (*(varray_type *) elt);
- }
- 
- /* Type-correct function to pass to ggc_add_root.  It just forwards
-    ELT (which is really a struct hash_table **) to
-    ggc_mark_tree_hash_table.  */
- 
- static void
- ggc_mark_tree_hash_table_ptr (elt)
-      void *elt;
- {
-   ggc_mark_tree_hash_table (*(struct hash_table **) elt);
- }
- 
- /* Type-correct function to pass to ggc_add_root.  It just forwards
-    ELT (which is really a char **) to ggc_mark_string.  */
- 
- static void
- ggc_mark_string_ptr (elt)
-      void *elt;
- {
-   ggc_mark_string (*(char **) elt);
- }
- 
  /* Add BASE as a new garbage collection root.  It is an array of
     length NELT with each element SIZE bytes long.  CB is a 
     function that will be called with a pointer to each element
--- 57,62 ----
*************** ggc_add_tree_root (base, nelt)
*** 150,155 ****
--- 100,116 ----
    ggc_add_root (base, nelt, sizeof(tree), ggc_mark_tree_ptr);
  }
  
+ /* Register a varray of rtxs as a GC root.  */
+ 
+ void
+ ggc_add_rtx_varray_root (base, nelt)
+      varray_type *base;
+      int nelt;
+ {
+   ggc_add_root (base, nelt, sizeof (varray_type), 
+ 		ggc_mark_rtx_varray_ptr);
+ }
+ 
  /* Register a varray of trees as a GC root.  */
  
  void
*************** ggc_mark_tree_children (t)
*** 476,481 ****
--- 437,455 ----
      }
  }
  
+ /* Mark all the elements of the varray V, which contains rtxs.  */
+ 
+ void
+ ggc_mark_rtx_varray (v)
+      varray_type v;
+ {
+   int i;
+ 
+   if (v)
+     for (i = v->num_elements - 1; i >= 0; --i) 
+       ggc_mark_rtx (VARRAY_RTX (v, i));
+ }
+ 
  /* Mark all the elements of the varray V, which contains trees.  */
  
  void
*************** ggc_mark_tree_hash_table (ht)
*** 507,512 ****
--- 481,547 ----
       struct hash_table *ht;
  {
    hash_traverse (ht, ggc_mark_tree_hash_table_entry, /*info=*/0);
+ }
+ 
+ /* Type-correct function to pass to ggc_add_root.  It just forwards
+    *ELT (which is an rtx) to ggc_mark_rtx.  */
+ 
+ static void
+ ggc_mark_rtx_ptr (elt)
+      void *elt;
+ {
+   ggc_mark_rtx (*(rtx *) elt);
+ }
+ 
+ /* Type-correct function to pass to ggc_add_root.  It just forwards
+    *ELT (which is a tree) to ggc_mark_tree.  */
+ 
+ static void
+ ggc_mark_tree_ptr (elt)
+      void *elt;
+ {
+   ggc_mark_tree (*(tree *) elt);
+ }
+ 
+ /* Type-correct function to pass to ggc_add_root.  It just forwards
+    ELT (which is really a varray_type *) to ggc_mark_rtx_varray.  */
+ 
+ static void
+ ggc_mark_rtx_varray_ptr (elt)
+      void *elt;
+ {
+   ggc_mark_rtx_varray (*(varray_type *) elt);
+ }
+ 
+ /* Type-correct function to pass to ggc_add_root.  It just forwards
+    ELT (which is really a varray_type *) to ggc_mark_tree_varray.  */
+ 
+ static void
+ ggc_mark_tree_varray_ptr (elt)
+      void *elt;
+ {
+   ggc_mark_tree_varray (*(varray_type *) elt);
+ }
+ 
+ /* Type-correct function to pass to ggc_add_root.  It just forwards
+    ELT (which is really a struct hash_table **) to
+    ggc_mark_tree_hash_table.  */
+ 
+ static void
+ ggc_mark_tree_hash_table_ptr (elt)
+      void *elt;
+ {
+   ggc_mark_tree_hash_table (*(struct hash_table **) elt);
+ }
+ 
+ /* Type-correct function to pass to ggc_add_root.  It just forwards
+    ELT (which is really a char **) to ggc_mark_string.  */
+ 
+ static void
+ ggc_mark_string_ptr (elt)
+      void *elt;
+ {
+   ggc_mark_string (*(char **) elt);
  }
  
  /* Allocate a gc-able string.  If CONTENTS is null, then the memory will
Index: ggc.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ggc.h,v
retrieving revision 1.21
diff -c -p -d -r1.21 ggc.h
*** ggc.h	2000/01/17 17:16:20	1.21
--- ggc.h	2000/01/25 10:44:08
*************** void ggc_add_root PARAMS ((void *base, i
*** 50,61 ****
--- 50,63 ----
  void ggc_add_rtx_root PARAMS ((struct rtx_def **, int nelt));
  void ggc_add_tree_root PARAMS ((union tree_node **, int nelt));
  void ggc_add_string_root PARAMS ((char **, int nelt));
+ void ggc_add_rtx_varray_root PARAMS ((struct varray_head_tag **, int nelt));
  void ggc_add_tree_varray_root PARAMS ((struct varray_head_tag **, int nelt));
  void ggc_add_tree_hash_table_root PARAMS ((struct hash_table **, int nelt));
  void ggc_del_root PARAMS ((void *base));
  
  /* Mark nodes from the gc_add_root callback.  These functions follow
     pointers to mark other objects too.  */
+ extern void ggc_mark_rtx_varray PARAMS ((struct varray_head_tag *));
  extern void ggc_mark_tree_varray PARAMS ((struct varray_head_tag *));
  extern void ggc_mark_tree_hash_table PARAMS ((struct hash_table *));
  extern void ggc_mark_roots PARAMS ((void));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]