[gc-improv] Convert majority of GGC_NEWVAR allocation sites

Laurynas Biveinis laurynas.biveinis@gmail.com
Sat Aug 22 12:11:00 GMT 2009


This patch tweaks gengtype dump, converts one GGC_NEWVAR allocation
site in Java frontend, kills a lot of unused code: cgraph_node_set
data structure and all of its associated functions, removes
write_summary from ipa_opt_pass, converts build_access_matrix in
graphite.c to obstack allocation and also opportunistically converts a
couple of GGC_NEW/GGC_CNEW sites too.

With this, only two GGC_NEWVAR sites remain that for some reason
resist variable_size GTY option annotation. I will convert these next.

Bootstrapped/regtested on x86_64-unknown-linux-gnu, commited to gc-improv.

cp/ChangeLog:

2009-08-22  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* cp/class.c (finish_struct_1): Use typed GC allocation.
	* cp/pt.c (maybe_process_partial_specialization): Likewise.
	(register_specialization): Likewise.
	(lookup_template_class): Likewise.

java/ChangeLog:

2009-08-22  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* jcf.h (union cpool_entry): add GTY option variable_size.
	* constants.c (set_constant_entry): Pass size parameter to typed
	GC allocator.
	* jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation.

ChangeLog:

2009-08-22  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* cgraph.h (cgraph_node_ptr, cgraph_node_set): Remove vector
	definitions.
	(struct cgraph_node_set_def, cgraph_node_set): Remove.
	(struct cgraph_node_set_element_def): Remove.
	(cgraph_node_set_element, const_cgraph_node_set_element): Remove.
	(cgraph_node_set_iterator, cgraph_node_set_new): Remove.
	(cgraph_node_set_find, cgraph_node_set_add): Remove.
	(cgraph_node_set_remove, dump_cgraph_node_set): Remove.
	(debug_cgraph_node_set, csi_end_p, csi_next, csi_start): Remove.
	(cgraph_node_in_set_p, cgraph_node_set_size): Remove.
	* tree-pass.h (cgraph_node_set_def): Remove forward declaration.
	(ipa_opt_pass_d): Remove write_summary member.
	* passes.c (order): use cgraph_node_ptr * instead of struct
	cgraph_node **.
	* c-common.h (struct sorted_fields_type): add GTY option
	variable_size.
	* ggc-page.c: Do not mention ggc_alloc in comments.
	* ggc-zone.c: Likewise.
	* graphite.c (build_access_matrix): New argument
	graphite_obstack.  Use obstack allocation instead of GC.
	(build_scop_data_accesses): New argument graphite_obstack.  Pass
	it down.
	* ipa.c (cgraph_node_set_add): Remove.
	(cgraph_node_set_remove): Remove.
	(cgraph_node_set_find): Remove.
	(dump_cgraph_node_set): Remove.
	(debug_cgraph_node_set): Remove.
	* c-decl.c (make_label): Use typed GC allocation.
	(lookup_label_for_goto): Likewise.
	(finish_struct): Likewise.
	* dwarf2out.c (add_name_and_src_coords_attributes): Likewise.
	* ipa-reference.c (pass_ipa_reference): Remove write_summary
	member initialization.
	* ipa-pure-const.c (pass_ipa_pure_const): Likewise.
	* ipa-inline.c (pass_ipa_inline): Likewise.
	* ipa-cp.c (ipcp_create_replace_map): Use typed GC allocation.
	(pass_ipa_cp): Remove write_summary member initialization.
	* gengtype.c (dump_type_u_s_lang_struct): New.
	(dump_type_u_s): Do not dump lang_struct member.
	(dump_type): Adjust for TYPE_LANG_STRUCT.

Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	(revision 150993)
+++ gcc/gengtype.c	(working copy)
@@ -3885,6 +3885,13 @@
   printf ("%*cend of fields of type %p\n", indent, ' ', (void *) t);
   dump_options (indent, t->u.s.opt);
   printf ("%*cu.s.bitmap = %X\n", indent, ' ', t->u.s.bitmap);
+}
+
+static void
+dump_type_u_s_lang_struct (int indent, type_p t)
+{
+  gcc_assert (t->kind == TYPE_LANG_STRUCT);
+
   printf ("%*cu.s.lang_struct:\n", indent, ' ');
   dump_type_list (indent + INDENT, t->u.s.lang_struct);
 }
@@ -3955,9 +3962,12 @@
       break;
     case TYPE_STRUCT:
     case TYPE_UNION:
-    case TYPE_LANG_STRUCT: /* FIXME LANG_STRUCT */
       dump_type_u_s (indent + INDENT, t);
       break;
+    case TYPE_LANG_STRUCT:
+      dump_type_u_s (indent + INDENT, t);
+      dump_type_u_s_lang_struct (indent + INDENT, t);
+      break;
     case TYPE_POINTER:
       printf ("%*cp:\n", indent + INDENT, ' ');
       dump_type (indent + INDENT, t->u.p);
Index: gcc/java/constants.c
===================================================================
--- gcc/java/constants.c	(revision 150498)
+++ gcc/java/constants.c	(working copy)
@@ -46,7 +46,9 @@
       cpool->capacity = 100;
       cpool->tags = (uint8 *) ggc_alloc_cleared_atomic (sizeof (uint8)
 						* cpool->capacity);
-      cpool->data = ggc_alloc_cleared_vec_cpool_entry (cpool->capacity);
+      cpool->data = ggc_alloc_cleared_vec_cpool_entry (sizeof
+						       (union cpool_entry),
+						       cpool->capacity);
       cpool->count = 1;
     }
   if (index >= cpool->capacity)
Index: gcc/java/jcf-reader.c
===================================================================
--- gcc/java/jcf-reader.c	(revision 150498)
+++ gcc/java/jcf-reader.c	(working copy)
@@ -331,7 +331,7 @@
   int i, n;
   JPOOL_SIZE (jcf) = (JCF_FILL (jcf, 2), JCF_readu2 (jcf));
   jcf->cpool.tags = (uint8 *) ggc_alloc_atomic (JPOOL_SIZE (jcf));
-  jcf->cpool.data = GGC_NEWVAR (union cpool_entry, sizeof (jword) *
JPOOL_SIZE (jcf));
+  jcf->cpool.data = ggc_alloc_cpool_entry (sizeof (jword) * JPOOL_SIZE (jcf));
   jcf->cpool.tags[0] = 0;
 #ifdef HANDLE_START_CONSTANT_POOL
   HANDLE_START_CONSTANT_POOL (JPOOL_SIZE (jcf));
Index: gcc/java/jcf.h
===================================================================
--- gcc/java/jcf.h	(revision 150498)
+++ gcc/java/jcf.h	(working copy)
@@ -66,7 +66,7 @@
 struct JCF;
 typedef int (*jcf_filbuf_t) (struct JCF*, int needed);

-union GTY(()) cpool_entry {
+union GTY((variable_size)) cpool_entry {
   jword GTY ((tag ("0"))) w;
   tree GTY ((tag ("1"))) t;
 };
Index: gcc/cgraph.h
===================================================================
--- gcc/cgraph.h	(revision 150498)
+++ gcc/cgraph.h	(working copy)
@@ -225,43 +225,6 @@

 typedef struct cgraph_node *cgraph_node_ptr;

-DEF_VEC_P(cgraph_node_ptr);
-DEF_VEC_ALLOC_P(cgraph_node_ptr,heap);
-DEF_VEC_ALLOC_P(cgraph_node_ptr,gc);
-
-/* A cgraph node set is a collection of cgraph nodes.  A cgraph node
-   can appear in multiple sets.  */
-struct GTY(()) cgraph_node_set_def
-{
-  htab_t GTY((param_is (struct cgraph_node_set_element_def))) hashtab;
-  VEC(cgraph_node_ptr, gc) *nodes;
-  PTR GTY ((skip)) aux;
-};
-
-typedef struct cgraph_node_set_def *cgraph_node_set;
-
-DEF_VEC_P(cgraph_node_set);
-DEF_VEC_ALLOC_P(cgraph_node_set,gc);
-DEF_VEC_ALLOC_P(cgraph_node_set,heap);
-
-/* A cgraph node set element contains an index in the vector of nodes in
-   the set.  */
-struct GTY(()) cgraph_node_set_element_def
-{
-  struct cgraph_node *node;
-  HOST_WIDE_INT index;
-};
-
-typedef struct cgraph_node_set_element_def *cgraph_node_set_element;
-typedef const struct cgraph_node_set_element_def
*const_cgraph_node_set_element;
-
-/* Iterator structure for cgraph node sets.  */
-typedef struct
-{
-  cgraph_node_set set;
-  unsigned index;
-} cgraph_node_set_iterator;
-
 #define DEFCIFCODE(code, string)	CIF_ ## code,
 /* Reasons for inlining failures.  */
 typedef enum {
@@ -478,15 +441,7 @@
 /* In ipa.c  */
 bool cgraph_remove_unreachable_nodes (bool, FILE *);
 int cgraph_postorder (struct cgraph_node **);
-cgraph_node_set cgraph_node_set_new (void);
-cgraph_node_set_iterator cgraph_node_set_find (cgraph_node_set,
-					       struct cgraph_node *);
-void cgraph_node_set_add (cgraph_node_set, struct cgraph_node *);
-void cgraph_node_set_remove (cgraph_node_set, struct cgraph_node *);
-void dump_cgraph_node_set (FILE *, cgraph_node_set);
-void debug_cgraph_node_set (cgraph_node_set);

-
 /* In predict.c  */
 bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e);

@@ -557,55 +512,6 @@
 /* Create a new static variable of type TYPE.  */
 tree add_new_static_var (tree type);

-
-/* Return true if iterator CSI points to nothing.  */
-static inline bool
-csi_end_p (cgraph_node_set_iterator csi)
-{
-  return csi.index >= VEC_length (cgraph_node_ptr, csi.set->nodes);
-}
-
-/* Advance iterator CSI.  */
-static inline void
-csi_next (cgraph_node_set_iterator *csi)
-{
-  csi->index++;
-}
-
-/* Return the node pointed to by CSI.  */
-static inline struct cgraph_node *
-csi_node (cgraph_node_set_iterator csi)
-{
-  return VEC_index (cgraph_node_ptr, csi.set->nodes, csi.index);
-}
-
-/* Return an iterator to the first node in SET.  */
-static inline cgraph_node_set_iterator
-csi_start (cgraph_node_set set)
-{
-  cgraph_node_set_iterator csi;
-
-  csi.set = set;
-  csi.index = 0;
-  return csi;
-}
-
-/* Return true if SET contains NODE.  */
-static inline bool
-cgraph_node_in_set_p (struct cgraph_node *node, cgraph_node_set set)
-{
-  cgraph_node_set_iterator csi;
-  csi = cgraph_node_set_find (set, node);
-  return !csi_end_p (csi);
-}
-
-/* Return number of nodes in SET.  */
-static inline size_t
-cgraph_node_set_size (cgraph_node_set set)
-{
-  return htab_elements (set->hashtab);
-}
-
 /* Uniquize all constants that appear in memory.
    Each constant in memory thus far output is recorded
    in `const_desc_table'.  */
Index: gcc/tree-pass.h
===================================================================
--- gcc/tree-pass.h	(revision 150498)
+++ gcc/tree-pass.h	(working copy)
@@ -165,7 +165,6 @@

 struct varpool_node;
 struct cgraph_node;
-struct cgraph_node_set_def;

 /* Description of IPA pass with generate summary, write, execute, read and
    transform stages.  */
@@ -177,9 +176,6 @@
       using this hook and produce summary.  */
   void (*generate_summary) (void);

-  /* This hook is used to serialize IPA summaries on disk.  */
-  void (*write_summary) (struct cgraph_node_set_def *);
-
   /* For most ipa passes, the information can only be deserialized in
      one chunk.  However, function bodies are read function at a time
      as needed so both calls are necessary.  */
Index: gcc/ipa-cp.c
===================================================================
--- gcc/ipa-cp.c	(revision 150498)
+++ gcc/ipa-cp.c	(working copy)
@@ -788,7 +788,7 @@
   struct ipa_replace_map *replace_map;
   tree const_val;

-  replace_map = GGC_NEW (struct ipa_replace_map);
+  replace_map = ggc_alloc_ipa_replace_map ();
   const_val = build_const_val (lat, TREE_TYPE (parm_tree));
   if (dump_file)
     {
@@ -1256,7 +1256,6 @@
   TODO_remove_functions /* todo_flags_finish */
  },
  ipcp_generate_summary,			/* generate_summary */
- NULL,					/* write_summary */
  NULL,					/* read_summary */
  NULL,					/* function_read_summary */
  0,					/* TODOs */
Index: gcc/ipa-reference.c
===================================================================
--- gcc/ipa-reference.c	(revision 150498)
+++ gcc/ipa-reference.c	(working copy)
@@ -1270,7 +1270,6 @@
   0                                     /* todo_flags_finish */
  },
  generate_summary,		        /* generate_summary */
- NULL,					/* write_summary */
  NULL,					/* read_summary */
  NULL,					/* function_read_summary */
  0,					/* TODOs */
Index: gcc/cp/class.c
===================================================================
--- gcc/cp/class.c	(revision 150498)
+++ gcc/cp/class.c	(working copy)
@@ -5370,9 +5370,8 @@
   n_fields = count_fields (TYPE_FIELDS (t));
   if (n_fields > 7)
     {
-      struct sorted_fields_type *field_vec = GGC_NEWVAR
-	 (struct sorted_fields_type,
-	  sizeof (struct sorted_fields_type) + n_fields * sizeof (tree));
+      struct sorted_fields_type *field_vec = ggc_alloc_sorted_fields_type
+	 (sizeof (struct sorted_fields_type) + n_fields * sizeof (tree));
       field_vec->len = n_fields;
       add_fields_to_record_type (TYPE_FIELDS (t), field_vec, 0);
       qsort (field_vec->elts, n_fields, sizeof (tree),
Index: gcc/cp/pt.c
===================================================================
--- gcc/cp/pt.c	(revision 150498)
+++ gcc/cp/pt.c	(working copy)
@@ -863,7 +863,7 @@

 		  slot = (spec_entry **)
 		    htab_find_slot (type_specializations, &elt, INSERT);
-		  *slot = GGC_NEW (spec_entry);
+		  *slot = ggc_alloc_spec_entry ();
 		  **slot = elt;
 		}
 	      else if (COMPLETE_TYPE_P (inst) || TYPE_BEING_DEFINED (inst))
@@ -1372,7 +1372,7 @@
   if (!optimize_specialization_lookup_p (tmpl))
     {
       gcc_assert (tmpl && args && spec);
-      *slot = GGC_NEW (spec_entry);
+      *slot = ggc_alloc_spec_entry ();
       **slot = elt;
       if (TREE_CODE (spec) == FUNCTION_DECL && DECL_NAMESPACE_SCOPE_P (spec)
 	  && PRIMARY_TEMPLATE_P (tmpl)
@@ -6213,7 +6213,7 @@
       elt.spec = t;
       slot = (spec_entry **) htab_find_slot_with_hash (type_specializations,
 						       &elt, hash, INSERT);
-      *slot = GGC_NEW (spec_entry);
+      *slot = ggc_alloc_spec_entry ();
       **slot = elt;

       /* Note this use of the partial instantiation so we can check it
Index: gcc/ipa-pure-const.c
===================================================================
--- gcc/ipa-pure-const.c	(revision 150498)
+++ gcc/ipa-pure-const.c	(working copy)
@@ -935,7 +935,6 @@
   0                                     /* todo_flags_finish */
  },
  generate_summary,		        /* generate_summary */
- NULL,					/* write_summary */
  NULL,					/* read_summary */
  NULL,					/* function_read_summary */
  0,					/* TODOs */
Index: gcc/ipa-inline.c
===================================================================
--- gcc/ipa-inline.c	(revision 150498)
+++ gcc/ipa-inline.c	(working copy)
@@ -2006,7 +2006,6 @@
   | TODO_remove_functions		/* todo_flags_finish */
  },
  inline_generate_summary,		/* generate_summary */
- NULL,					/* write_summary */
  NULL,					/* read_summary */
  NULL,					/* function_read_summary */
  0,					/* TODOs */
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 150498)
+++ gcc/dwarf2out.c	(working copy)
@@ -13330,7 +13330,7 @@
 	    {
 	      limbo_die_node *asm_name;

-	      asm_name = GGC_CNEW (limbo_die_node);
+	      asm_name = ggc_alloc_cleared_limbo_die_node();
 	      asm_name->die = die;
 	      asm_name->created_for = decl;
 	      asm_name->next = deferred_asm_name;
Index: gcc/c-decl.c
===================================================================
--- gcc/c-decl.c	(revision 150498)
+++ gcc/c-decl.c	(working copy)
@@ -2949,7 +2949,7 @@
   DECL_CONTEXT (label) = current_function_decl;
   DECL_MODE (label) = VOIDmode;

-  label_vars = GGC_NEW (struct c_label_vars);
+  label_vars = ggc_alloc_c_label_vars ();
   label_vars->shadowed = NULL;
   set_spot_bindings (&label_vars->label_bindings, defining);
   label_vars->decls_in_scope = make_tree_vector ();
@@ -3047,7 +3047,7 @@
     {
       struct c_goto_bindings *g;

-      g = GGC_NEW (struct c_goto_bindings);
+      g = ggc_alloc_c_goto_bindings ();
       g->loc = loc;
       set_spot_bindings (&g->goto_bindings, true);
       VEC_safe_push (c_goto_bindings_p, gc, label_vars->gotos, g);
@@ -6815,8 +6815,8 @@
 	  All decls in an inline function need to be saved.  */

 	space = ggc_alloc_cleared_lang_type();
-	space2 = GGC_NEWVAR (struct sorted_fields_type,
-			     sizeof (struct sorted_fields_type) + len * sizeof (tree));
+	space2 = ggc_alloc_sorted_fields_type
+	  (sizeof (struct sorted_fields_type) + len * sizeof (tree));

 	len = 0;
 	space->s = space2;
Index: gcc/ipa.c
===================================================================
--- gcc/ipa.c	(revision 150498)
+++ gcc/ipa.c	(working copy)
@@ -327,126 +327,3 @@
   TODO_remove_functions | TODO_dump_cgraph/* todo_flags_finish */
  }
 };
-
-
-/* Add cgraph_node NODE to cgraph_node_set SET.  */
-
-void
-cgraph_node_set_add (cgraph_node_set set, struct cgraph_node *node)
-{
-  void **slot;
-  cgraph_node_set_element element;
-  struct cgraph_node_set_element_def dummy;
-
-  dummy.node = node;
-  slot = htab_find_slot (set->hashtab, &dummy, INSERT);
-
-  if (*slot != HTAB_EMPTY_ENTRY)
-    {
-      element = (cgraph_node_set_element) *slot;
-      gcc_assert (node == element->node
-		  && (VEC_index (cgraph_node_ptr, set->nodes, element->index)
-		      == node));
-      return;
-    }
-
-  /* Insert node into hash table.  */
-  element =
-    (cgraph_node_set_element) GGC_NEW (struct cgraph_node_set_element_def);
-  element->node = node;
-  element->index = VEC_length (cgraph_node_ptr, set->nodes);
-  *slot = element;
-
-  /* Insert into node vector.  */
-  VEC_safe_push (cgraph_node_ptr, gc, set->nodes, node);
-}
-
-/* Remove cgraph_node NODE from cgraph_node_set SET.  */
-
-void
-cgraph_node_set_remove (cgraph_node_set set, struct cgraph_node *node)
-{
-  void **slot, **last_slot;
-  cgraph_node_set_element element, last_element;
-  struct cgraph_node *last_node;
-  struct cgraph_node_set_element_def dummy;
-
-  dummy.node = node;
-  slot = htab_find_slot (set->hashtab, &dummy, NO_INSERT);
-  if (slot == NULL)
-    return;
-
-  element = (cgraph_node_set_element) *slot;
-  gcc_assert (VEC_index (cgraph_node_ptr, set->nodes, element->index)
-	      == node);
-
-  /* Remove from vector. We do this by swapping node with the last element
-     of the vector.  */
-  last_node = VEC_pop (cgraph_node_ptr, set->nodes);
-  if (last_node != node)
-    {
-      dummy.node = last_node;
-      last_slot = htab_find_slot (set->hashtab, &dummy, NO_INSERT);
-      last_element = (cgraph_node_set_element) *last_slot;
-      gcc_assert (last_element);
-
-      /* Move the last element to the original spot of NODE.  */
-      last_element->index = element->index;
-      VEC_replace (cgraph_node_ptr, set->nodes, last_element->index,
-		   last_node);
-    }
-
-  /* Remove element from hash table.  */
-  htab_clear_slot (set->hashtab, slot);
-  ggc_free (element);
-}
-
-/* Find NODE in SET and return an iterator to it if found.  A null iterator
-   is returned if NODE is not in SET.  */
-
-cgraph_node_set_iterator
-cgraph_node_set_find (cgraph_node_set set, struct cgraph_node *node)
-{
-  void **slot;
-  struct cgraph_node_set_element_def dummy;
-  cgraph_node_set_element element;
-  cgraph_node_set_iterator csi;
-
-  dummy.node = node;
-  slot = htab_find_slot (set->hashtab, &dummy, NO_INSERT);
-  if (slot == NULL)
-    csi.index = (unsigned) ~0;
-  else
-    {
-      element = (cgraph_node_set_element) *slot;
-      gcc_assert (VEC_index (cgraph_node_ptr, set->nodes, element->index)
-		  == node);
-      csi.index = element->index;
-    }
-  csi.set = set;
-
-  return csi;
-}
-
-/* Dump content of SET to file F.  */
-
-void
-dump_cgraph_node_set (FILE *f, cgraph_node_set set)
-{
-  cgraph_node_set_iterator iter;
-
-  for (iter = csi_start (set); !csi_end_p (iter); csi_next (&iter))
-    {
-      struct cgraph_node *node = csi_node (iter);
-      dump_cgraph_node (f, node);
-    }
-}
-
-/* Dump content of SET to stderr.  */
-
-void
-debug_cgraph_node_set (cgraph_node_set set)
-{
-  dump_cgraph_node_set (stderr, set);
-}
-
Index: gcc/graphite.c
===================================================================
--- gcc/graphite.c	(revision 150498)
+++ gcc/graphite.c	(working copy)
@@ -3710,10 +3710,12 @@
    succeeded.  */

 static bool
-build_access_matrix (data_reference_p ref, graphite_bb_p gb)
+build_access_matrix (data_reference_p ref, graphite_bb_p gb,
+		     struct obstack * graphite_obstack)
 {
   int i, ndim = DR_NUM_DIMENSIONS (ref);
-  struct access_matrix *am = GGC_NEW (struct access_matrix);
+  struct access_matrix *am = (struct access_matrix *) obstack_alloc
+    (graphite_obstack, sizeof (struct access_matrix));

   AM_MATRIX (am) = VEC_alloc (lambda_vector, gc, ndim);
   DR_SCOP (ref) = GBB_SCOP (gb);
@@ -3737,7 +3739,7 @@
 /* Build the access matrices for the data references in the SCOP.  */

 static void
-build_scop_data_accesses (scop_p scop)
+build_scop_data_accesses (scop_p scop, struct obstack * graphite_obstack)
 {
   int i;
   graphite_bb_p gb;
@@ -3757,7 +3759,7 @@
 	   VEC_iterate (data_reference_p, GBB_DATA_REFS (gb), j, dr);
 	   j++)
 	{
-	  bool res = build_access_matrix (dr, gb);
+	  bool res = build_access_matrix (dr, gb, graphite_obstack);

 	  /* FIXME: At this point the DRs should always have an affine
 	     form.  For the moment this fails as build_access_matrix
@@ -6172,7 +6174,7 @@
       add_conditions_to_constraints (scop);
       build_scop_canonical_schedules (scop);

-      build_scop_data_accesses (scop);
+      build_scop_data_accesses (scop, &graphite_obstack);
       build_scop_dynamic_schedules (scop);

       if (dump_file && (dump_flags & TDF_DETAILS))
Index: gcc/ggc-zone.c
===================================================================
--- gcc/ggc-zone.c	(revision 150498)
+++ gcc/ggc-zone.c	(working copy)
@@ -418,9 +418,9 @@
 #ifdef GATHER_STATISTICS
   struct
   {
-    /* Total memory allocated with ggc_alloc.  */
+    /* Total GC-allocated memory.  */
     unsigned long long total_allocated;
-    /* Total overhead for memory to be allocated with ggc_alloc.  */
+    /* Total overhead for GC-allocated memory.  */
     unsigned long long total_overhead;

     /* Total allocations and overhead for sizes less than 32, 64 and 128.
@@ -1376,7 +1376,7 @@
     }
 }

-/* Normal ggc_alloc simply allocates into the main zone.  */
+/* Normal GC allocation simply allocates into the main zone.  */

 void *
 ggc_alloc_stat (size_t size MEM_STAT_DECL)
Index: gcc/ggc-page.c
===================================================================
--- gcc/ggc-page.c	(revision 150498)
+++ gcc/ggc-page.c	(working copy)
@@ -419,9 +419,9 @@
 #ifdef GATHER_STATISTICS
   struct
   {
-    /* Total memory allocated with ggc_alloc.  */
+    /* Total GC-allocated memory.  */
     unsigned long long total_allocated;
-    /* Total overhead for memory to be allocated with ggc_alloc.  */
+    /* Total overhead for GC-allocated memory.  */
     unsigned long long total_overhead;

     /* Total allocations and overhead for sizes less than 32, 64 and 128.
Index: gcc/c-common.h
===================================================================
--- gcc/c-common.h	(revision 150498)
+++ gcc/c-common.h	(working copy)
@@ -338,7 +338,7 @@

 /* In a RECORD_TYPE, a sorted array of the fields of the type, not a
    tree for size reasons.  */
-struct GTY(()) sorted_fields_type {
+struct GTY((variable_size)) sorted_fields_type {
   int len;
   tree GTY((length ("%h.len"))) elts[1];
 };
Index: gcc/passes.c
===================================================================
--- gcc/passes.c	(revision 150498)
+++ gcc/passes.c	(working copy)
@@ -863,7 +863,7 @@
    keep the array visible to garbage collector to avoid reading collected
    out nodes.  */
 static int nnodes;
-static GTY ((length ("nnodes"))) struct cgraph_node **order;
+static GTY ((length ("nnodes"))) cgraph_node_ptr *order;

 /* If we are in IPA mode (i.e., current_function_decl is NULL), call
    function CALLBACK for every function in the call graph.  Otherwise,


-- 
Laurynas



More information about the Gcc-patches mailing list