-@c Copyright (C) 2002, 2003, 2004
+@c Copyright (C) 2002, 2003, 2004, 2007
@c Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
has been marked already; in fact, the usual case is to use
@code{if_marked ("ggc_marked_p")}.
+@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
const char *marker_routine;
const char *reorder_note_routine;
const char *comment;
+ int skip_hooks; /* skip hook generation if non zero */
};
static void output_escaped_param (struct walk_type_data *d,
use_params_p = 1;
else if (strcmp (oo->name, "desc") == 0)
desc = oo->info;
+ else if (strcmp (oo->name, "mark_hook") == 0)
+ ;
else if (strcmp (oo->name, "nested_ptr") == 0)
nested_ptr_d = (const struct nested_ptr_data *) oo->info;
else if (strcmp (oo->name, "dot") == 0)
int i;
const char *chain_next = NULL;
const char *chain_prev = NULL;
+ const char *mark_hook_name = NULL;
options_p opt;
struct walk_type_data d;
chain_next = opt->info;
else if (strcmp (opt->name, "chain_prev") == 0)
chain_prev = opt->info;
+ else if (strcmp (opt->name, "mark_hook") == 0)
+ mark_hook_name = opt->info;
if (chain_prev != NULL && chain_next == NULL)
error_at_line (&s->u.s.line, "chain_prev without chain_next");
output_type_enum (d.of, orig_s);
}
oprintf (d.of, "))\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");
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;
walk_type (s, &d);
static const struct write_types_data ggc_wtd =
{
"ggc_m", NULL, "ggc_mark", "ggc_test_and_set_mark", NULL,
- "GC marker procedures. "
+ "GC marker procedures. ",
+ FALSE
};
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. "
+ "PCH type-walking procedures. ",
+ TRUE
};
/* Write out the local pointer-walking routines. */