This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question on function-at-a-time and GC
- From: Zack Weinberg <zack at codesourcery dot com>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 12 Apr 2004 09:01:43 -0700
- Subject: Re: Question on function-at-a-time and GC
- References: <10404121225.AA14073@vlsi1.ultra.nyu.edu>
kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:
> I'm running into problems with the interaction of GC and generating trees for
> functions in the presence of nested functions.
>
> It seems to me that you need to generate the entire *file* as a tree before
> you can generate code for any function and/or do a GC unless you do peculiar
> stuff with local variables.
Generating the entire file as a tree is the preferred technique ...
> In Ada, we want to translate the Ada tree directly into a GCC tree. So for
> binary operators, for example, we'd want to translate the LHS into a tree, do
> the same for the RHS, then make a new tree node for those. Indeed this is
> what we do now. The natural way of doing that is something like:
>
> build_binary_op (translate_ada_to_gnu_tree (lhs),
> translate_ada_to_gnu_tree (rhs))
>
> But if you do this, you have a serious problem if the second of those calls
> to be evaluated contains a nested function because the pointer to the first
> tree will be in the local stack and hence subject to GC.
... however, the alternative is ggc_push_context(). Do try to avoid
that, though, it has huge overhead and we would like to make it go
away eventually.
zw