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]
Other format: [Raw text]

[boehms-gc] Use atomic allocation for data types that currently do not have marker routines


Hi,

I'm in progress of making gengtype create custom marker routines for
Boehm's GC. During that, I've fixed gengtype to output typed
allocation routines only for data types it can output marker routines
for. That means, that some of the typed allocation calls must be
changed back to atomic allocation, this is what this patch does.

Index: gcc/value-prof.c
===================================================================
--- gcc/value-prof.c	(revision 116166)
+++ gcc/value-prof.c	(working copy)
@@ -736,7 +736,7 @@
	{
	  /* Check for the case where the divisor is the same value most
	     of the time.  */
-	  hist = ggc_alloc_histogram_value_t ();
+	  hist = ggc_alloc_atomic (sizeof (struct histogram_value_t));
	  hist->hvalue.value = divisor;
	  hist->hvalue.stmt = stmt;
	  hist->type = HIST_TYPE_SINGLE_VALUE;
@@ -749,13 +749,13 @@
	  && TYPE_UNSIGNED (type))
	{
	  /* Check for a special case where the divisor is power of 2.  */
-	  hist = ggc_alloc_histogram_value_t ();
+	  hist = ggc_alloc_atomic (sizeof (struct histogram_value_t));
	  hist->hvalue.value = divisor;
	  hist->hvalue.stmt = stmt;
	  hist->type = HIST_TYPE_POW2;
	  VEC_quick_push (histogram_value, *values, hist);

-	  hist = ggc_alloc_histogram_value_t ();
+	  hist = ggc_alloc_atomic (sizeof (struct histogram_value_t));
	  hist->hvalue.stmt = stmt;
	  hist->hvalue.value
		  = build2 (TRUNC_DIV_EXPR, type, op0, divisor);
Index: gcc/c-format.c
===================================================================
--- gcc/c-format.c	(revision 116231)
+++ gcc/c-format.c	(working copy)
@@ -2077,7 +2077,7 @@
	      fci = fci->chain;
	      if (fci)
		{
-		  wanted_type_ptr = ggc_alloc_format_wanted_type();
+		  wanted_type_ptr = ggc_alloc_atomic (sizeof (struct format_wanted_type));
		  arg_num++;
		  wanted_type = *fci->types[length_chars_val].type;
		  wanted_type_name = fci->types[length_chars_val].name;
Index: gcc/c-typeck.c
===================================================================
--- gcc/c-typeck.c	(revision 116231)
+++ gcc/c-typeck.c	(working copy)
@@ -4803,9 +4803,10 @@
/* Structure for managing pending initializer elements, organized as an
   AVL tree.  */

-struct init_node
+struct init_node GTY(())
{
-  struct init_node *left, *right;
+  struct init_node *left;
+  struct init_node *right;
  struct init_node *parent;
  int balance;
  tree purpose;
@@ -4878,9 +4879,10 @@
/* This stack represents designators from some range designator up to
   the last designator in the list.  */

-struct constructor_range_stack
+struct constructor_range_stack GTY(())
{
-  struct constructor_range_stack *next, *prev;
+  struct constructor_range_stack *next;
+  struct constructor_range_stack *prev;
  struct constructor_stack *stack;
  tree range_start;
  tree index;
@@ -5538,7 +5540,7 @@
{
  struct constructor_range_stack *p;

-  p = ggc_alloc_constructor_range_stack();
+  p = ggc_alloc_atomic (sizeof (struct constructor_range_stack));
  p->prev = constructor_range_stack;
  p->next = 0;
  p->fields = constructor_fields;
@@ -5703,7 +5705,7 @@
	}
    }

-  r = ggc_alloc_init_node();
+  r = ggc_alloc_atomic (sizeof (struct init_node));
  r->purpose = purpose;
  r->value = value;

Index: gcc/ggc-common.c
===================================================================
--- gcc/ggc-common.c	(revision 116231)
+++ gcc/ggc-common.c	(working copy)
@@ -149,17 +149,17 @@

/* These are for splay_tree_new_ggc.  */
void *
-ggc_splay_alloc_tree (int sz ATTRIBUTE_UNUSED, void *nl)
+ggc_splay_alloc_tree (int sz, void *nl)
{
  gcc_assert (!nl);
-  return ggc_alloc_splay_tree_s();
+  return ggc_alloc_atomic(sz);
}

void *
-ggc_splay_alloc_tree_node (int sz ATTRIBUTE_UNUSED, void *nl)
+ggc_splay_alloc_tree_node (int sz, void *nl)
{
  gcc_assert (!nl);
-  return ggc_alloc_splay_tree_node_s();
+  return ggc_alloc_atomic(sz);
}

void
Index: gcc/tree-dfa.c
===================================================================
--- gcc/tree-dfa.c	(revision 116231)
+++ gcc/tree-dfa.c	(working copy)
@@ -142,7 +142,7 @@
  gcc_assert (DECL_P (t));
  gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN);

-  ann = ggc_alloc_var_ann_d();
+  ann = ggc_alloc_atomic (sizeof (struct var_ann_d));
  memset ((void *) ann, 0, sizeof (*ann));

  ann->common.type = VAR_ANN;
@@ -163,7 +163,7 @@
  gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
  gcc_assert (!t->common.ann || t->common.ann->common.type == FUNCTION_ANN);

-  ann = ggc_alloc_function_ann_d ();
+  ann = ggc_alloc_atomic (sizeof (struct function_ann_d));
  memset ((void *) ann, 0, sizeof (*ann));

  ann->common.type = FUNCTION_ANN;
@@ -183,7 +183,7 @@
  gcc_assert (is_gimple_stmt (t));
  gcc_assert (!t->common.ann || t->common.ann->common.type == STMT_ANN);

-  ann = ggc_alloc_stmt_ann_d();
+  ann = ggc_alloc_atomic (sizeof (struct stmt_ann_d));
  memset ((void *) ann, 0, sizeof (*ann));

  ann->common.type = STMT_ANN;
Index: gcc/integrate.c
===================================================================
--- gcc/integrate.c	(revision 116231)
+++ gcc/integrate.c	(working copy)
@@ -237,10 +237,11 @@
  ivs = cfun->hard_reg_initial_vals;
  if (ivs == 0)
    {
-      ivs = ggc_alloc_initial_value_struct();
+      ivs = ggc_alloc_atomic (sizeof (struct initial_value_struct));
      ivs->num_entries = 0;
      ivs->max_entries = 5;
-      ivs->entries = ggc_alloc_vec_initial_value_pair (5);
+      ivs->entries = ggc_alloc_vec_atomic (5,
+					   sizeof (struct initial_value_pair));
      cfun->hard_reg_initial_vals = ivs;
    }

Index: gcc/stmt.c
===================================================================
--- gcc/stmt.c	(revision 116166)
+++ gcc/stmt.c	(working copy)
@@ -2124,7 +2124,7 @@


/* Add this label to the chain. Make sure to drop overflow flags. */ - r = ggc_alloc_case_node (); + r = ggc_alloc_atomic (sizeof (struct case_node)); r->low = build_int_cst_wide (TREE_TYPE (low), TREE_INT_CST_LOW (low), TREE_INT_CST_HIGH (low)); r->high = build_int_cst_wide (TREE_TYPE (high), TREE_INT_CST_LOW (high),


-- Laurynas


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