This is the mail archive of the
mailing list for the GDB project.
Re: Value reference counting
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: gdb-patches at sourceware dot org, Tom Tromey <tromey at redhat dot com>
- Date: Mon, 20 Jul 2009 10:13:35 +0400
- Subject: Re: Value reference counting
- References: <20090717184152.GA6863@caradoc.them.org>
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.