Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: reference counting for value
Date: Tue, 07 Jul 2009 01:49:00 -0000	[thread overview]
Message-ID: <20090707014914.GA30559@caradoc.them.org> (raw)
In-Reply-To: <m3tz26k87c.fsf@fleche.redhat.com>

On Tue, Jun 23, 2009 at 02:26:31PM -0600, Tom Tromey wrote:
> The "increment reference" function is called "release_value" for
> historical reasons (I can change this if anybody cares).  Most code
> does not require any change, as one always had to pair release_value
> and value_free calls anyhow.

IMO it would be nice to rename it (separately).

I am trying to resurrect an old patch of Vladimir's, which gives
bitfield values a parent pointer.  We fetch the parent once, instead
of once per bitfield.  That raised an interesting question:

> +  /* The reference count.  A value that is still on the `all_values'
> +     list will have a reference count of 0.  A call to `release_value'
> +     will increment the reference count (and remove the value from the
> +     list, the first time).  A call to `value_free' will decrement the
> +     reference count, and will free the value when there are no more
> +     references.  */
> +  int refcount;
> +
>    /* Register number if the value is from a register.  */
>    short regnum;
>  

If we release_value the parent every time we create a child, and
value_free it every time we collect a child, the parent will be freed
as soon as its last child is.  This is a change in the value behavior,
because otherwise it would hang around until value_free_to_mark or
free_all_values.

Is this going to bite us?  We could, instead, record release_value
references separately from parent references and leave the value on
the chain.  But if it doesn't matter, I'd rather not.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2009-07-07  1:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-23 20:26 Tom Tromey
2009-07-07  1:49 ` Daniel Jacobowitz [this message]
2009-07-07 14:26   ` Tom Tromey
2009-07-07 14:59     ` Daniel Jacobowitz
2009-07-07 17:03       ` Tom Tromey

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=20090707014914.GA30559@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /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