On Wed, 2015-05-27 at 15:56 +0200, mliska wrote: > gcc/ChangeLog: > > 2015-04-30 Martin Liska <mli...@suse.cz> > > * ira-color.c (init_update_cost_records): Use new type-based pool > allocator. > (get_update_cost_record): Likewise. > (free_update_cost_record_list): Likewise. > (finish_update_cost_records): Likewise. > (initiate_cost_update): Likewise. > --- > gcc/ira-color.c | 19 +++++-------------- > 1 file changed, 5 insertions(+), 14 deletions(-) > > diff --git a/gcc/ira-color.c b/gcc/ira-color.c > index 4750714..4aec98e 100644 > --- a/gcc/ira-color.c > +++ b/gcc/ira-color.c > @@ -1166,16 +1166,8 @@ setup_profitable_hard_regs (void) > allocnos. */ > > /* Pool for update cost records. */ > -static alloc_pool update_cost_record_pool; > - > -/* Initiate update cost records. */ > -static void > -init_update_cost_records (void) > -{ > - update_cost_record_pool > - = create_alloc_pool ("update cost records", > - sizeof (struct update_cost_record), 100); > -} > +static pool_allocator<update_cost_record> update_cost_record_pool > + ("update cost records", 100);
Am I right in thinking that this is a statically-allocated object with a non-trivial constructor? i.e. that this constructor has to run before "main" is entered? Do our coding guidelines allow for this? (I've been burned by this before, on a buggy C++ runtime that didn't manage to support these). I'm a little nervous about this, touching global state before "main" (e.g. from the point-of-view of the JIT), though I don't know yet if this is just a gut reaction, or if there's a valid concern here (I'm officially on holiday this week, so I haven't had a chance to dig deeply into these patches yet, sorry). [...snip...] > @@ -1264,7 +1256,6 @@ initiate_cost_update (void) > = (struct update_cost_queue_elem *) ira_allocate (size); > memset (update_cost_queue_elems, 0, size); > update_cost_check = 0; > - init_update_cost_records (); > } (for reference, this is where the manually-coded initialization call was made) Hope this is constructive Dave