public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] remove mark_hook gty attribute
@ 2016-01-11 22:57 tbsaunde+gcc
  2016-01-12 15:09 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: tbsaunde+gcc @ 2016-01-11 22:57 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

Hi,

this hardly counts as a bug fix, but going through open bugs I saw PR54809, and
realized we don't actually need this attribute any more, so we might as well
just remove it.

bootstrapped + regtested on x86_64-linux-gnu, ok for now or gcc 7?  I don't
mind waiting, but it would be nice to have one less thing to remember to do.

Trev

gcc/ChangeLog:

2016-01-11  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	PR middle-end/54809
	* doc/gty.texi: Remove documentation of mark_hook.
	* gengtype.c (struct write_types_data): Remove code to support
	mark_hook attribute.
	(walk_type): Likewise.
	(write_func_for_structure): Likewise.
---
 gcc/doc/gty.texi | 10 ----------
 gcc/gengtype.c   | 33 +++------------------------------
 2 files changed, 3 insertions(+), 40 deletions(-)

diff --git a/gcc/doc/gty.texi b/gcc/doc/gty.texi
index d3ca4e0..1a22e4b 100644
--- a/gcc/doc/gty.texi
+++ b/gcc/doc/gty.texi
@@ -261,16 +261,6 @@ garbage collection runs, there's no need to mark anything pointed to
 by this variable, it can just be set to @code{NULL} instead.  This is used
 to keep a list of free structures around for re-use.
 
-@findex mark_hook
-@item mark_hook ("@var{hook-routine-name}")
-
-If provided for a structure or union type, the given
-@var{hook-routine-name} (between double-quotes) is the name of a
-routine called when the garbage collector has just marked the data as
-reachable. This routine should not change the data, or call any ggc
-routine. Its only argument is a pointer to the just marked (const)
-structure or union.
-
 @findex maybe_undef
 @item maybe_undef
 
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 966e597..be49660 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -2407,7 +2407,6 @@ struct write_types_data
   const char *marker_routine;
   const char *reorder_note_routine;
   const char *comment;
-  int skip_hooks;		/* skip hook generation if non zero */
   enum write_types_kinds kind;
 };
 
@@ -2677,8 +2676,6 @@ walk_type (type_p t, struct walk_type_data *d)
       maybe_undef_p = 1;
     else if (strcmp (oo->name, "desc") == 0 && oo->kind == OPTION_STRING)
       desc = oo->info.string;
-    else if (strcmp (oo->name, "mark_hook") == 0)
-      ;
     else if (strcmp (oo->name, "nested_ptr") == 0 
 	     && oo->kind == OPTION_NESTED)
       nested_ptr_d = (const struct nested_ptr_data *) oo->info.nested;
@@ -2918,7 +2915,6 @@ walk_type (type_p t, struct walk_type_data *d)
 	const char *oldval = d->val;
 	const char *oldprevval1 = d->prev_val[1];
 	const char *oldprevval2 = d->prev_val[2];
-	const char *struct_mark_hook = NULL;
 	const int union_p = t->kind == TYPE_UNION;
 	int seen_default_p = 0;
 	options_p o;
@@ -2942,13 +2938,6 @@ walk_type (type_p t, struct walk_type_data *d)
 	  if (!desc && strcmp (o->name, "desc") == 0
 	      && o->kind == OPTION_STRING)
 	    desc = o->info.string;
-	  else if (!struct_mark_hook && strcmp (o->name, "mark_hook") == 0
-		   && o->kind == OPTION_STRING)
-	    struct_mark_hook = o->info.string;
-
-	if (struct_mark_hook)
-	  oprintf (d->of, "%*s%s (&%s);\n",
-		   d->indent, "", struct_mark_hook, oldval);
 
 	d->prev_val[2] = oldval;
 	d->prev_val[1] = oldprevval2;
@@ -3473,7 +3462,6 @@ write_func_for_structure (type_p orig_s, type_p s,
   const char *chain_next = NULL;
   const char *chain_prev = NULL;
   const char *chain_circular = NULL;
-  const char *mark_hook_name = NULL;
   options_p opt;
   struct walk_type_data d;
 
@@ -3509,9 +3497,6 @@ write_func_for_structure (type_p orig_s, type_p s,
     else if (strcmp (opt->name, "chain_circular") == 0
 	     && opt->kind == OPTION_STRING)
       chain_circular = opt->info.string;
-    else if (strcmp (opt->name, "mark_hook") == 0
-	     && opt->kind == OPTION_STRING)
-      mark_hook_name = opt->info.string;
     else if (strcmp (opt->name, "for_user") == 0)
       for_user = true;
   if (chain_prev != NULL && chain_next == NULL)
@@ -3576,17 +3561,11 @@ write_func_for_structure (type_p orig_s, type_p s,
       oprintf (d.of, "))\n");
       if (chain_circular != NULL)
 	oprintf (d.of, "    return;\n  do\n");
-      if (mark_hook_name && !wtd->skip_hooks)
-	{
-	  oprintf (d.of, "    {\n");
-	  oprintf (d.of, "      %s (xlimit);\n   ", mark_hook_name);
-	}
+
       oprintf (d.of, "   xlimit = (");
       d.prev_val[2] = "*xlimit";
       output_escaped_param (&d, chain_next, "chain_next");
       oprintf (d.of, ");\n");
-      if (mark_hook_name && !wtd->skip_hooks)
-	oprintf (d.of, "    }\n");
       if (chain_prev != NULL)
 	{
 	  oprintf (d.of, "  if (x != xlimit)\n");
@@ -3618,18 +3597,12 @@ write_func_for_structure (type_p orig_s, type_p s,
 	      output_mangled_typename (d.of, orig_s);
 	    }
 	  oprintf (d.of, "));\n");
-	  if (mark_hook_name && !wtd->skip_hooks)
-	    oprintf (d.of, "  %s (xlimit);\n", mark_hook_name);
 	  oprintf (d.of, "  do\n");
 	}
       else
 	oprintf (d.of, "  while (x != xlimit)\n");
     }
   oprintf (d.of, "    {\n");
-  if (mark_hook_name && chain_next == NULL && !wtd->skip_hooks)
-    {
-      oprintf (d.of, "      %s (x);\n", mark_hook_name);
-    }
 
   d.prev_val[2] = "*x";
   d.indent = 6;
@@ -3789,14 +3762,14 @@ write_types (outf_p output_header, type_p structures,
 static const struct write_types_data ggc_wtd = {
   "ggc_m", NULL, "ggc_mark", "ggc_test_and_set_mark", NULL,
   "GC marker procedures.  ",
-  FALSE, WTK_GGC
+  WTK_GGC
 };
 
 static const struct write_types_data pch_wtd = {
   "pch_n", "pch_p", "gt_pch_note_object", "gt_pch_note_object",
   "gt_pch_note_reorder",
   "PCH type-walking procedures.  ",
-  TRUE, WTK_PCH
+  WTK_PCH
 };
 
 /* Write out the local pointer-walking routines.  */
-- 
2.7.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] remove mark_hook gty attribute
  2016-01-11 22:57 [PATCH] remove mark_hook gty attribute tbsaunde+gcc
@ 2016-01-12 15:09 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-01-12 15:09 UTC (permalink / raw)
  To: tbsaunde+gcc; +Cc: GCC Patches

On Mon, Jan 11, 2016 at 11:54 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> Hi,
>
> this hardly counts as a bug fix, but going through open bugs I saw PR54809, and
> realized we don't actually need this attribute any more, so we might as well
> just remove it.
>
> bootstrapped + regtested on x86_64-linux-gnu, ok for now or gcc 7?  I don't
> mind waiting, but it would be nice to have one less thing to remember to do.

Ok.

Richard.

> Trev
>
> gcc/ChangeLog:
>
> 2016-01-11  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
>         PR middle-end/54809
>         * doc/gty.texi: Remove documentation of mark_hook.
>         * gengtype.c (struct write_types_data): Remove code to support
>         mark_hook attribute.
>         (walk_type): Likewise.
>         (write_func_for_structure): Likewise.
> ---
>  gcc/doc/gty.texi | 10 ----------
>  gcc/gengtype.c   | 33 +++------------------------------
>  2 files changed, 3 insertions(+), 40 deletions(-)
>
> diff --git a/gcc/doc/gty.texi b/gcc/doc/gty.texi
> index d3ca4e0..1a22e4b 100644
> --- a/gcc/doc/gty.texi
> +++ b/gcc/doc/gty.texi
> @@ -261,16 +261,6 @@ garbage collection runs, there's no need to mark anything pointed to
>  by this variable, it can just be set to @code{NULL} instead.  This is used
>  to keep a list of free structures around for re-use.
>
> -@findex mark_hook
> -@item mark_hook ("@var{hook-routine-name}")
> -
> -If provided for a structure or union type, the given
> -@var{hook-routine-name} (between double-quotes) is the name of a
> -routine called when the garbage collector has just marked the data as
> -reachable. This routine should not change the data, or call any ggc
> -routine. Its only argument is a pointer to the just marked (const)
> -structure or union.
> -
>  @findex maybe_undef
>  @item maybe_undef
>
> diff --git a/gcc/gengtype.c b/gcc/gengtype.c
> index 966e597..be49660 100644
> --- a/gcc/gengtype.c
> +++ b/gcc/gengtype.c
> @@ -2407,7 +2407,6 @@ struct write_types_data
>    const char *marker_routine;
>    const char *reorder_note_routine;
>    const char *comment;
> -  int skip_hooks;              /* skip hook generation if non zero */
>    enum write_types_kinds kind;
>  };
>
> @@ -2677,8 +2676,6 @@ walk_type (type_p t, struct walk_type_data *d)
>        maybe_undef_p = 1;
>      else if (strcmp (oo->name, "desc") == 0 && oo->kind == OPTION_STRING)
>        desc = oo->info.string;
> -    else if (strcmp (oo->name, "mark_hook") == 0)
> -      ;
>      else if (strcmp (oo->name, "nested_ptr") == 0
>              && oo->kind == OPTION_NESTED)
>        nested_ptr_d = (const struct nested_ptr_data *) oo->info.nested;
> @@ -2918,7 +2915,6 @@ walk_type (type_p t, struct walk_type_data *d)
>         const char *oldval = d->val;
>         const char *oldprevval1 = d->prev_val[1];
>         const char *oldprevval2 = d->prev_val[2];
> -       const char *struct_mark_hook = NULL;
>         const int union_p = t->kind == TYPE_UNION;
>         int seen_default_p = 0;
>         options_p o;
> @@ -2942,13 +2938,6 @@ walk_type (type_p t, struct walk_type_data *d)
>           if (!desc && strcmp (o->name, "desc") == 0
>               && o->kind == OPTION_STRING)
>             desc = o->info.string;
> -         else if (!struct_mark_hook && strcmp (o->name, "mark_hook") == 0
> -                  && o->kind == OPTION_STRING)
> -           struct_mark_hook = o->info.string;
> -
> -       if (struct_mark_hook)
> -         oprintf (d->of, "%*s%s (&%s);\n",
> -                  d->indent, "", struct_mark_hook, oldval);
>
>         d->prev_val[2] = oldval;
>         d->prev_val[1] = oldprevval2;
> @@ -3473,7 +3462,6 @@ write_func_for_structure (type_p orig_s, type_p s,
>    const char *chain_next = NULL;
>    const char *chain_prev = NULL;
>    const char *chain_circular = NULL;
> -  const char *mark_hook_name = NULL;
>    options_p opt;
>    struct walk_type_data d;
>
> @@ -3509,9 +3497,6 @@ write_func_for_structure (type_p orig_s, type_p s,
>      else if (strcmp (opt->name, "chain_circular") == 0
>              && opt->kind == OPTION_STRING)
>        chain_circular = opt->info.string;
> -    else if (strcmp (opt->name, "mark_hook") == 0
> -            && opt->kind == OPTION_STRING)
> -      mark_hook_name = opt->info.string;
>      else if (strcmp (opt->name, "for_user") == 0)
>        for_user = true;
>    if (chain_prev != NULL && chain_next == NULL)
> @@ -3576,17 +3561,11 @@ write_func_for_structure (type_p orig_s, type_p s,
>        oprintf (d.of, "))\n");
>        if (chain_circular != NULL)
>         oprintf (d.of, "    return;\n  do\n");
> -      if (mark_hook_name && !wtd->skip_hooks)
> -       {
> -         oprintf (d.of, "    {\n");
> -         oprintf (d.of, "      %s (xlimit);\n   ", mark_hook_name);
> -       }
> +
>        oprintf (d.of, "   xlimit = (");
>        d.prev_val[2] = "*xlimit";
>        output_escaped_param (&d, chain_next, "chain_next");
>        oprintf (d.of, ");\n");
> -      if (mark_hook_name && !wtd->skip_hooks)
> -       oprintf (d.of, "    }\n");
>        if (chain_prev != NULL)
>         {
>           oprintf (d.of, "  if (x != xlimit)\n");
> @@ -3618,18 +3597,12 @@ write_func_for_structure (type_p orig_s, type_p s,
>               output_mangled_typename (d.of, orig_s);
>             }
>           oprintf (d.of, "));\n");
> -         if (mark_hook_name && !wtd->skip_hooks)
> -           oprintf (d.of, "  %s (xlimit);\n", mark_hook_name);
>           oprintf (d.of, "  do\n");
>         }
>        else
>         oprintf (d.of, "  while (x != xlimit)\n");
>      }
>    oprintf (d.of, "    {\n");
> -  if (mark_hook_name && chain_next == NULL && !wtd->skip_hooks)
> -    {
> -      oprintf (d.of, "      %s (x);\n", mark_hook_name);
> -    }
>
>    d.prev_val[2] = "*x";
>    d.indent = 6;
> @@ -3789,14 +3762,14 @@ write_types (outf_p output_header, type_p structures,
>  static const struct write_types_data ggc_wtd = {
>    "ggc_m", NULL, "ggc_mark", "ggc_test_and_set_mark", NULL,
>    "GC marker procedures.  ",
> -  FALSE, WTK_GGC
> +  WTK_GGC
>  };
>
>  static const struct write_types_data pch_wtd = {
>    "pch_n", "pch_p", "gt_pch_note_object", "gt_pch_note_object",
>    "gt_pch_note_reorder",
>    "PCH type-walking procedures.  ",
> -  TRUE, WTK_PCH
> +  WTK_PCH
>  };
>
>  /* Write out the local pointer-walking routines.  */
> --
> 2.7.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-12 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-11 22:57 [PATCH] remove mark_hook gty attribute tbsaunde+gcc
2016-01-12 15:09 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).