On Tue, 18 Oct 2011 17:19:56 +0200
Duncan Sands <baldr...@free.fr> wrote:

> Hi Basile,
> 
> > I would like to add destroyable objects into Ggc (the GCC garbage 
> > collector, see files
> > gcc/ggc*.[ch]).
> >
> > The main motivation is to permit C++ objects to be garbage collected (I 
> > discussed that
> > briefly in the Gcc meeting at Google in London): adding destroyable object 
> > is a
> > prerequisite for that goal.
> 
> it is already possible to have garbage collected C++ objects with destructors.
> I use this in the dragonegg plugin (see the file Cache.cpp).  I do only use
> htab's though, which comes with support for destructors.  

Thanks for the tip.

I'm not sure to understand what you mean, and I did have a look into the 
htab_create_ggc
macro of gcc/ggc.h and also at 
lvm.org/viewvc/llvm-project/dragonegg/trunk/src/Cache.cpp

To be concrete:

How do you create inside Ggc heap an instance of std::ostringstream (as 
provided by the
standard C++ library) or of std::string ?

or, to be more Gcc specific,
how do you create inside Ggc heap a PPL constraint, that is a pointer to a 
struct ppl_Constraint_tag*, ie a ppl_Constraint_t opaque type, which should call
ppl_delete_Constraint at destruction time?

I don't want to have an explicit hash-table keeping these things... (because I 
have no
specific hash keys for them). Or are you suggesting it is the way to have 
destructed
objects in Ggc? Are these hash-tables weak, in the sense that when nothing 
points to the
value, the association of the key to the value is removed?

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 mine, sont seulement les miennes} ***

Reply via email to