This is the mail archive of the gcc-patches@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: [PATCH] Avoid some unnecessary set_cfun calls


On Wed, 13 Nov 2013, Jakub Jelinek wrote:

> On Wed, Nov 13, 2013 at 11:53:32AM +0100, Richard Biener wrote:
> > > So, perhaps we should just define SWITCHABLE_TARGET on i?86/x86_64/powerpc*
> > > (and rx if maintainer cares) and tweak it to attach somehow
> > > struct target_globals * to TARGET_OPTION_NODE somehow.
> > > A problem might be that lots of the save_target_globals
> > > allocated structures are heap allocated rather than GC, so we might leak
> > > memory.  Wonder if save_target_globals couldn't just compute the
> > > aggregate size of all the structures it allocates with XCNEW right now
> > > (plus required alignment if needed) and just allocate them together
> > > with the ggc_alloc_target_globals after the target_globals structure
> > > itself.
> > 
> > If you want to re-use it from functions with same options don't you
> > have a hashtable anyway?  You could add a reference count.
> 
> build_target_option_node is such a hash table for that.

Ah, and we already have some custom pointers in the tree node.  Looks
like a suitable place to put in memory management then.

Richard.


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