From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11601 invoked by alias); 20 Jul 2009 06:13:48 -0000 Received: (qmail 11589 invoked by uid 22791); 20 Jul 2009 06:13:47 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Jul 2009 06:13:39 +0000 Received: (qmail 9349 invoked from network); 20 Jul 2009 06:13:36 -0000 Received: from unknown (HELO wind.localnet) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 20 Jul 2009 06:13:36 -0000 From: Vladimir Prus To: Daniel Jacobowitz Subject: Re: Value reference counting Date: Mon, 20 Jul 2009 09:55:00 -0000 User-Agent: KMail/1.11.90 (Linux/2.6.24-24-generic; KDE/4.2.90; i686; svn-979530; 2009-06-10) Cc: gdb-patches@sourceware.org, Tom Tromey References: <20090717184152.GA6863@caradoc.them.org> In-Reply-To: <20090717184152.GA6863@caradoc.them.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200907201013.36183.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00465.txt.bz2 On Friday 17 July 2009 Daniel Jacobowitz wrote: > * value.c (struct value): Add reference_count field. > (allocate_value_lazy): Initialize reference_count. > (value_incref): New function. > (value_free): Check the reference count. > * value.h (value_incref): New prototype. > > --- > gdb/value.c | 27 +++++++++++++++++++++++++++ > gdb/value.h | 2 ++ > 2 files changed, 29 insertions(+) > > Index: src/gdb/value.c > =================================================================== > --- src.orig/gdb/value.c 2009-07-17 09:52:16.000000000 -0400 > +++ src/gdb/value.c 2009-07-17 10:07:10.000000000 -0400 > @@ -194,6 +194,11 @@ struct value > /* Actual contents of the value. Target byte-order. NULL or not > valid if lazy is nonzero. */ > gdb_byte *contents; > + > + /* The number of references to this value. This initially includes > + one reference from the value chain; if release_value is called, > + it converts that into a normal reference. */ > + int reference_count; > }; I do not fully understand this comment, specifically the "it converts that into a normal reference". What is "it", what is "that" and what is "normal reference" and where the convention happens? From your email, I gather it's intentional that release_value does not have to be changed, but I don't understand anything else :-( I am sure it's just me, but a better comment would be good. - Volodya