This is the mail archive of the 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]

Re: [LTO][PATCH] Fix ICE in output_tree.

2008/11/18 Doug Kwan (???) <>:

>   This is another patch and it uses walk_tree().  The problem is that
> is not very efficient in terms of stack usage as tail recursion is not
> possible with a chain of trees.  The call-back has to call walk_tree
> again to handle cases it does not.  It is certainly shorter than the
> first one though.

Did you consider the idea of registering trees that need fixups
during streaming?  I haven't thought it through, so I'm not sure
if it's really useful.  For now, the important thing is to fix
the bug.

> 2008-11-18  Doug Kwan  <>
>        * lto.c (LTO_FIXUP_SUBTREE): New macro.
>        (no_fixup_p, lto_fixup_common, lto_fixup_decl_minimal,
>        lto_fixup_decl_common, lto_fixup_decl_with_vis,
>        lto_fixup_decl_non_common, lto_fixup_field_decl, lto_fixup_type,
>        lto_fixup_binfo): New functions.
>        (lto_fixup_tree): Handle missing cases in walk_tree.
> +
> +static tree lto_fixup_tree (tree*, int*, void *);

space before '*'.

> +
> +/* Return true if T needs not to be fixed up recursively.  */

s/needs not/does not need/

> +static void
> +lto_fixup_common (tree t, void *data)
> +{
> +  /* This is not very efficient because we cannot do tail recursion with
> +     a long chain of trees. */

What about this?

  for (n = TREE_CHAIN (t); n; n = TREE_CHAIN (n))

Avoids the recursive explosion.

> +}
> +
> +/* Fix up fields of a decl_minimal T.  DATA points to fix-up states.  */
> +
> +static void
> +lto_fixup_decl_minimal (tree t, void *data)
> +{
> +  lto_fixup_common (t, data);
> +  LTO_FIXUP_SUBTREE (t->decl_minimal.context);

I prefer if we access the fields using the the DECL_* macros.
I've been meaning to change this in the streamer for a while now,
so I'd rather not generate new instances of this.  We won't need
explicit call to *_CHECK in that case.

OK with those changes and a test case.

Thanks.  Diego.

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