Diego -

I have some relatively minor comments. In general, the these changes
and the adjusted GTY doc intro blurb you sent in the other email are
OK with the minor comments addressed and if no objections from global
maintainers.

>         (walk_type): Set D->IN_PTR_FILED when walking a TYPE_POINTER.

"FIELD"

> +fields is completely handled by user-provided routines.  Section
> +@ref{User GC} for details on what functions need to be provided.

"See Section ... " ?

> +code is generated.  For these types, the user is required to provide
> +three functions: one to act as a marker for garbage collection, and
> +two functions to act as marker and pointer walking for pre-compiled
> +headers.

s/walking/walker ?

> +In general, each marker @code{M} should call @code{M} for every
> +pointer field in the structure.  Fields that are not allocated in GC
> +or are not pointers can be ignored.

"must be ignored"

> +create_user_defined_type (const char *type_name, struct fileloc *pos)
...
> +     template by preteding that each type is a field of TY.  This is needed 
> to

pretending

> @@ -548,20 +603,30 @@ resolve_typedef (const char *s, struct fileloc *pos)
>    for (p = typedefs; p != NULL; p = p->next)
>      if (strcmp (p->name, s) == 0)
>        return p->type;
> -  error_at_line (pos, "unidentified type `%s'", s);
> -  return &scalar_nonchar;      /* treat as "int" */
> +
> +  /* If we did not find a typedef registered, assume this is a name
> +     for a user-defined type which will need to provide its own
> +     marking functions.
> +
> +     FIXME cxx-conversion. Emit an error once explicit annotations
> +     for marking user types are implemented.  */
> +  return create_user_defined_type (s, pos);

Are "explicit annotations for marking user types" referring to GTY((user))?

> +static const char *
> +filter_type_name (const char *type_name)
> +{

Maybe this function should return const-less char *? The casts to cast
the const away for freeing it look a bit awkward.

> +      const char *id_for_tag = filter_type_name (s->u.s.tag);
> +      oprintf (of, "gt_%sx_%s", prefix, id_for_tag);
> +      if (id_for_tag != s->u.s.tag)
> +       free (CONST_CAST(char *, id_for_tag));

For example, here.

> diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
> index d3d186d..f43d0c2 100644
> --- a/gcc/ggc-page.c
> +++ b/gcc/ggc-page.c
> @@ -1441,6 +1441,26 @@ gt_ggc_m_S (const void *p)
>    return;
>  }
>
> +
> +/* User-callable entry point for marking string X.  */

"points"

> +
> +void
> +gt_ggc_mx (const char *& x)
> +{
> +  gt_ggc_m_S (x);
> +}
> +
> +void
> +gt_ggc_mx (unsigned char *& x)
> +{
> +  gt_ggc_m_S (x);
> +}
> +
> +void
> +gt_ggc_mx (unsigned char& x ATTRIBUTE_UNUSED)
> +{
> +}
> +
>  /* If P is not marked, marks it and return false.  Otherwise return true.
>     P must have been allocated by the GC allocator; it mustn't point to
>     static objects, stack variables, or memory allocated with malloc.  */
> diff --git a/gcc/ggc-zone.c b/gcc/ggc-zone.c
> index baf8076..3fe0dd2 100644
> --- a/gcc/ggc-zone.c
> +++ b/gcc/ggc-zone.c
> @@ -1508,6 +1508,26 @@ gt_ggc_m_S (const void *p)
>    ggc_set_mark (p);
>  }
>
> +
> +/* User-callable entry point for marking string X.  */

"points"

> diff --git a/gcc/stringpool.c b/gcc/stringpool.c
> index 747db17..281e550 100644
> --- a/gcc/stringpool.c
> +++ b/gcc/stringpool.c
> @@ -49,7 +49,7 @@ static const char digit_vector[] = {
>
>  struct ht *ident_hash;
>
> -static hashnode alloc_node (hash_table *);
> +static hashnode alloc_node (cpp_hash_table *);
>  static int mark_ident (struct cpp_reader *, hashnode, const void *);
>
>  static void *
> @@ -70,7 +70,7 @@ init_stringpool (void)
>
>  /* Allocate a hash node.  */
>  static hashnode
> -alloc_node (hash_table *table ATTRIBUTE_UNUSED)
> +alloc_node (cpp_hash_table *table ATTRIBUTE_UNUSED)
>  {
>    return GCC_IDENT_TO_HT_IDENT (make_node (IDENTIFIER_NODE));
>  }

These changes are not in the ChangeLog, are they intentional?

> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c

> +/* Garbage collection support for edge_def.  */
> +
> +extern void gt_ggc_mx (tree&);
> +extern void gt_ggc_mx (gimple&);
> +extern void gt_ggc_mx (rtx&);
> +extern void gt_ggc_mx (basic_block&);

> +/* PCH support for edge_def.  */
> +
> +extern void gt_pch_nx (tree&);
> +extern void gt_pch_nx (gimple&);
> +extern void gt_pch_nx (rtx&);
> +extern void gt_pch_nx (basic_block&);

I wonder if these externs can be avoided by including gtype-desc.h. I
realize that gtype-desc.h declares a lot of stuff, but if tree-cfg.c
already declares GC roots, then it already should be pulling that
header in in through gt-tree-cfg.h.

--
Laurynas

Reply via email to