This is the mail archive of the gcc@gcc.gnu.org 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: Question on function-at-a-time and GC


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


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