adding destroyable objects into Ggc

Basile Starynkevitch basile@starynkevitch.net
Thu Oct 20 12:27:00 GMT 2011


On Thu, Oct 20, 2011 at 11:28:40AM +0300, Laurynas Biveinis wrote:

> 2011/10/19 Basile Starynkevitch <basile@starynkevitch.net>:
> > On Wed, Oct 19, 2011 at 04:31:48PM +0300, Laurynas Biveinis wrote:
> >> In the end I believe that it is the patches that talk. Whatever
> >> patches are going to be submitted, reviewed and accepted, that is
> >> going to be GCC's future, be it memory management, or something els
> >
> >
> > I was beginning to work on a patch to add finalizable (that is destroyable)
> > objects to Ggc. So I understand you Laurynas suggest that it might be worth
> > working on it (while I percieved most other emails, e.g. Ian's or Duncan's
> > messages, as a hint to avoid losing my time).
> 
> I'm not sure in this case. I think that C++ would reduce the need for
> it, but you need the feature *now*, and GCC codebase is not C++ yet. I
> agree with other suggestions that the safest option for you is to make
> it MELT-specific. Or, you could use C++ in MELT.
> 
> In any case I cannot offer much of opinion, should you work on this or
> not. Sorry.


To be clear, I don't need finalized objects myself, and I don't need them
in MELT neither. (MELT runtime has already ad-hoc finalization for some few
MELT values, notably those boxing PPL stuff. That finalization uses the
existing Ggc plugin hooks.).

So, I am trying to add finalized objects in Ggc not for MELT (it does not
need them, and it already has some finalization tricks which I could use
when some GCC begins to use C++ objects), but for general use.

I still don't grasp how a future GCC coded in C++ could realistically avoid
Ggc, because nobody (amongst those advocating C++ smart or whatever _ptr-s)
explained how he believes the current GCC GTY-ed representations (like tree,
gimple, gimple_seq, edge, loop-s...) could be re-implemented in C++ using
C++ tricks without Ggc, and what could be the transition from the current
state of GCC to such a future state (C++--full, but Ggc-less) of GCC.

I'm quite confident that if I continue working on MELT (which I hope to, and
I believe I will) and if GCC is going entirely the C++ way (which I don't
hope that much, but apparently it is the way it is going) I would be able to
adapt MELT to whatever coding rules & styles GCC will require.

But I don't understand how Ggc could be avoided (and I am not sure to
understand how even LLVM can avoid any kind of garbage collection in the
long run).

What I do hope, is that when Gcc becomes written in C++, the coding rules
and styles for manual memory management would be well documented.

Apparently, adding finalization into Ggc seems quite easy (but until I did
it, I can be wrong). And my feeling is that, together with some support for
GTY-ed classes in gengtype, that could offer a realistic transition route to
more C++ inside GCC.

And be able to use more of PPL stuff inside plugins and passes seems to
motivate & justify adding finalizers in Ggc (and later, C++ support in
gengtype).

I might be grossly wrong, but nobody explained -with concrete examples- us
how the current major GCC representations could be done inside GCC with C++
but without Ggc. For instance, nobody explained what an hypothetical class
Gimple or class Gimple_Seq could be.

Cheers.
-- 
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} ***



More information about the Gcc mailing list