On Fri, Jun 14, 2013 at 11:21:06PM -0400, David Malcolm wrote:
> I'm hoping that gcc 4.9 can support multiple "parallel universes" of gcc
> state within one process, to ultimately support gcc usage as a library,
> where multiple client threads can each have their own gcc context (or
> "universe").
> 
> One issue with the above is the garbage collector.
> 
> I think there are two possible ways in which "universe instances" could
> interact with the GC:
> 
> (a) have the universe instances be GC-managed: all parallel universes
> share the same heap, requiring a rewrite of the GC code to be
> thread-safe,
> 
> or
> 
> (b) have the "universe instance"/context manage GC, so that the state of
> GC is per-universe: each universe has its own GC heap, entirely
> independent of each other universe's GC heap.  You can't share GC
> pointers between universes.
> 
> I don't think (a) is feasible.


I agree, but what would be the purpose to run many threads of GCC in parallel 
which don't share anything? 
At the very least, I would expect predefined global trees to be common to all 
of them. 
I'm thinking at least of The global_trees array.

And don't forget plugins, which can (and do, for MELT) run the Ggc collector, 
and use the 
PLUGIN_GGC_START, PLUGIN_GGC_MARKING, PLUGIN_GGC_END

I do think that making (in the long term) GCC usable as a library (like LLVM 
is) is a 
worthwhile goal, but I don't think that aiming that future library to be 
multi-threadable
(or thread-friendly) is very realistic. At least, we should make the two goals 
separate:
first, make GCC a library, then (and later) make that library thread friendly.


So I might not be very happy of your patch ....

Regards.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

Reply via email to