From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6983 invoked by alias); 18 Oct 2011 15:37:56 -0000 Received: (qmail 6848 invoked by uid 22791); 18 Oct 2011 15:37:55 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,RDNS_DYNAMIC,TVD_RCVD_IP X-Spam-Check-By: sourceware.org Received: from 195-14-0-142.nuxit.net (HELO de558.ispfr.net) (195.14.0.142) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Oct 2011 15:37:34 +0000 Received: from ours.starynkevitch.net ([213.41.244.95] helo=glinka.lesours) by de558.ispfr.net with smtp (Exim 4.72) (envelope-from ) id 1RGBjP-0005bz-DV; Tue, 18 Oct 2011 17:37:31 +0200 Date: Tue, 18 Oct 2011 16:53:00 -0000 From: Basile Starynkevitch To: Duncan Sands Cc: gcc@gcc.gnu.org Subject: Re: adding destroyable objects into Ggc Message-Id: <20111018173724.e1f493dc02c8a54c75f41971@starynkevitch.net> In-Reply-To: <4E9D991C.6050500@free.fr> References: <20111018171201.361304028ab94f102f827bd2@starynkevitch.net> <4E9D991C.6050500@free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg00279.txt.bz2 On Tue, 18 Oct 2011 17:19:56 +0200 Duncan Sands 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: basilestarynkevitchnet mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***