public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Basile Starynkevitch <basile@starynkevitch.net>
Cc: gcc@gcc.gnu.org
Subject: Re: adding destroyable objects into Ggc
Date: Tue, 18 Oct 2011 18:11:00 -0000	[thread overview]
Message-ID: <CAKOQZ8zD7k-NztD03z-tL5wg-=N-iEZ41wAwujd4v7YxUndr4A@mail.gmail.com> (raw)
In-Reply-To: <20111018194123.1d5103e320cbed0a35363349@starynkevitch.net>

On Tue, Oct 18, 2011 at 10:41 AM, Basile Starynkevitch
<basile@starynkevitch.net> wrote:
> On Tue, 18 Oct 2011 10:36:08 -0700
> Ian Lance Taylor <iant@google.com> wrote:
>
>> On Tue, Oct 18, 2011 at 10:13 AM, Basile Starynkevitch
>> <basile@starynkevitch.net> wrote:
>> >
>> > Still, I find strange that while some very smart & nice GCC guys want to get rid of Ggc,
>> > no patch made into the trunk towards that goal (which I Basile dislike and don't share,
>> > so don't expect me Basile to work on this.).
>>
>> I've put a lot of work into making it possible to build gcc as a C++ program.
>
> I do know that, and as many GCC developers I am grateful to you Ian for your big work.
>
> However, I don't know very well auto_ptr.  Could you explain to use how do they deal with
> *circular* memory references.... (perhaps by taking as examples code inside GCC).
> My feeling is that auto_ptr is not able to deal with them, but I'll be delighted to be
> proven wrong.

auto_ptr is confusing and hard to use.  Don't think about it.

I think a better approach here is likely to be a reference counted
shared_ptr for the
most general case.  It's true that it works poorly with cycles, but
gcc data structures
are only occasionally cyclical.

Also, I think that actually many cases in gcc do not require
shared_ptr.  Instead, we
can think of terms of pools, with the smart pointers being aware of
which pool they are
associated with.  Then we can detect at compile time an accidental use
of a pointer to
one pool being assigned to a pointer to a different pool.  Before we
introduced garbage
collection, gcc used pools (well, obstacks), but there were severe
problems because
pointers to one pool would be assigned to a pointer to a different
pool and then become
dangling pointers when the first pool was deleted.  C++ will let us
avoid that problem.

Ian

  parent reply	other threads:[~2011-10-18 17:50 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18 16:35 Basile Starynkevitch
2011-10-18 16:43 ` Duncan Sands
2011-10-18 16:53   ` Basile Starynkevitch
2011-10-18 17:11 ` Ian Lance Taylor
2011-10-18 17:14   ` Gabriel Dos Reis
2011-10-18 17:20   ` Basile Starynkevitch
2011-10-18 17:36     ` Ian Lance Taylor
2011-10-18 17:41   ` Basile Starynkevitch
2011-10-18 17:50     ` Ian Lance Taylor
2011-10-18 17:53       ` Basile Starynkevitch
2011-10-18 18:03         ` Jonathan Wakely
2011-10-18 18:11         ` Ian Lance Taylor [this message]
2011-10-18 19:41           ` Basile Starynkevitch
2011-10-18 20:52           ` Gabriel Dos Reis
2011-10-18 19:50         ` Gabriel Dos Reis
2011-10-18 23:11           ` Basile Starynkevitch
2011-10-19  0:49             ` Jonathan Wakely
2011-10-18 19:46     ` Gabriel Dos Reis
2011-10-19  6:04     ` Chiheng Xu
2011-10-19  6:08       ` Basile Starynkevitch
2011-10-19  6:43         ` Chiheng Xu
2011-10-19  6:12       ` Gabriel Dos Reis
2011-10-19  6:17         ` Basile Starynkevitch
2011-10-19  6:22         ` Chiheng Xu
     [not found]         ` <20111019080021.4e1acb3687fc8ceacc2fd7a3@starynkevitch.net>
     [not found]           ` <CAAiZkiB-aXfE8MyY_S6YvecdxgsBnuBHp3JDWx4kirVkQx8w+A@mail.gmail.com>
2011-10-19  7:41             ` Gabriel Dos Reis
2011-10-19  7:43             ` Basile Starynkevitch
2011-10-19 12:14               ` Gabriel Dos Reis
2011-10-19 13:31                 ` Duncan Sands
2011-10-19 22:19                   ` Jonathan Wakely
2011-10-19 15:06         ` David Malcolm
2011-10-20  6:03       ` Lawrence Crowl
2011-10-20  8:29         ` Basile Starynkevitch
2011-10-20  8:37           ` Marc Glisse
2011-10-20  8:38             ` Basile Starynkevitch
2011-10-20 11:57               ` Marc Glisse
2011-10-20 12:10                 ` Basile Starynkevitch
2011-10-20 15:34                   ` Marc Glisse
2011-10-21  9:03                     ` Basile Starynkevitch
2011-10-21 12:24                       ` Marc Glisse
2011-10-21 12:28                       ` Richard Guenther
2011-10-21 23:53                         ` Basile Starynkevitch
2011-10-22  1:31                           ` Gabriel Dos Reis
2011-10-22 11:20                             ` Basile Starynkevitch
2011-10-23 13:50                           ` Richard Guenther
2011-10-19 15:56     ` Laurynas Biveinis
2011-10-19 16:54       ` Basile Starynkevitch
2011-10-20  8:52         ` Laurynas Biveinis
2011-10-20 12:27           ` Basile Starynkevitch
2011-10-20 12:51             ` Andrew Haley
2011-10-20 14:07               ` Basile Starynkevitch
2011-10-20 13:10             ` Duncan Sands
2011-10-20 14:52               ` Torvald Riegel
2011-10-20 15:14             ` Jonathan Wakely
2011-10-20 15:26               ` Richard Guenther
2011-10-20 17:23               ` Basile Starynkevitch
2011-10-20 18:38                 ` Jonathan Wakely
2011-10-18 18:39 ` Jonathan Wakely
2011-10-18 18:48   ` Basile Starynkevitch
2011-10-18 19:42     ` Jonathan Wakely
2011-10-18 19:45       ` Basile Starynkevitch
2011-10-18 22:43         ` Gabriel Dos Reis
2011-10-18 21:24     ` Gabriel Dos Reis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKOQZ8zD7k-NztD03z-tL5wg-=N-iEZ41wAwujd4v7YxUndr4A@mail.gmail.com' \
    --to=iant@google.com \
    --cc=basile@starynkevitch.net \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).