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: Statically-allocated objects with non-trivial ctors (was Re: [PATCH 33/35] Change use to type-based pool allocator in ira-color.c.)


On May 28, 2015 7:06:36 PM GMT+02:00, Jeff Law <law@redhat.com> wrote:
>On 05/28/2015 04:42 AM, David Malcolm wrote:
>>
>> 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).
>That idiom is used in various places by Martin's patches.   I didn't
>see 
>a strong rhyme or reason behind why it was used over allocating 
>something in automatic or heap storage.
>
>As to supporting it, I'm not terribly concerned about other buggy C++ 
>runtimes.  GCC bootstraps with GCC, which means we've got our C++ 
>runtime.  The only worry becomes the low level bits that we build our 
>static ctor/dtor support on top of -- and I haven't seen major problems
>
>with that for eons.

But we've been trying to avoid this. And the jit might not be too happy about it either.

>jeff



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