From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4639 invoked by alias); 20 Oct 2011 15:42:12 -0000 Received: (qmail 4617 invoked by uid 22791); 20 Oct 2011 15:42:11 -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; Thu, 20 Oct 2011 15:41:57 +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 1RGuka-0005D7-5G; Thu, 20 Oct 2011 17:41:47 +0200 Date: Thu, 20 Oct 2011 17:23:00 -0000 From: Basile Starynkevitch To: Jonathan Wakely Cc: gcc@gcc.gnu.org Subject: Re: adding destroyable objects into Ggc Message-Id: <20111020174135.5b04f47ffb72cbc67c5a3118@starynkevitch.net> In-Reply-To: References: <20111018171201.361304028ab94f102f827bd2@starynkevitch.net> <20111018191350.470cd6b1cd291373d5ff3f2c@starynkevitch.net> <20111019135602.GA19325@ours.starynkevitch.net> <20111020115652.GA14705@ours.starynkevitch.net> 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/msg00362.txt.bz2 On Thu, 20 Oct 2011 15:52:25 +0100 Jonathan Wakely wrote: > > Well you haven't showed concrete examples of your C++-friendly Ggc > either (your suggested code wasn't valid C++). >From the C++ side, it probably will be just an operator new, perhaps something as simple as (untested code): class ggc_new {}; // an empty class extern ggc_new the_ggc_new; void* operator new (ggc_new); #define new_ggc new(the_ggc_new) So to allocate a GTY-ed instance of a class Foo, we might have, assuming we have defined: class GTY((...)) Foo { ... }; we would code new_ggc Foo (...) with the important convention that data allocated with with new_ggc should never be explicitly deleted, except implicitly by the Ggc garbage collector, and that its destructor should not allocate Ggc data. Does the above description answers your question? (I'm not sure to have time implement that, and I'm not sure of the details) Cheers. -- 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} ***