Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Jerome Guitton <guitton@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] "lazily" allocate the raw content of lazy values
Date: Tue, 25 Nov 2008 17:59:00 -0000	[thread overview]
Message-ID: <m3fxlgw5t3.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20081124144810.GA90681@adacore.com> (Jerome Guitton's message of "Mon\, 24 Nov 2008 15\:48\:10 +0100")

>>>>> "Jerome" == Jerome Guitton <guitton@adacore.com> writes:

Jerome> Here, an elegant solution would be to manipulate lazy values instead
Jerome> of references
[...]

Very nice background explanation, thanks.

Jerome> +/* Actual contents of the value.  For use of this value; setting it
Jerome> +   uses the stuff defined in struct value.  Target byte-order.  We force it
Jerome> +   to be aligned properly for any possible value.  Note that a value therefore
Jerome> +   extends beyond what is declared here.  */
Jerome> +
Jerome> +union value_aligner
Jerome> +{
Jerome> +  gdb_byte contents[1];
Jerome> +  DOUBLEST force_doublest_align;
Jerome> +  LONGEST force_longest_align;
Jerome> +  CORE_ADDR force_core_addr_align;
Jerome> +  void *force_pointer_align;  
Jerome> +};

The purpose of this union is just to force alignment of the 'contents'
field, so that we can stuff any data type into it without worrying.
Once we're no longer using the struct hack to store the bits, there is
no need for this union.

Jerome> +  union value_aligner *content;

I think you might as well make this "gdb_byte *contents" now.

I think it would be nice to have a test case showing the Ada problem.
This would help prevent mistakes if we ever want to change the value
representation again.  Would this be hard to do?


After that I only have nits.

Jerome> +void
Jerome> +value_free (struct value *val)
Jerome> +{
Jerome> +  if (val && val->content)

No need to check val->content, xfree does that.

Jerome>  struct value *
Jerome>  value_change_enclosing_type (struct value *val, struct type *new_encl_type)

You were right, value_change_enclosing_type is much simpler now :-)

Jerome>        if (value_lazy (arg1))
Jerome> -	set_value_lazy (v, 1);
Jerome> +        {
Jerome> +          v = allocate_value_lazy (value_enclosing_type (arg1));
Jerome> +        }

In the GNU style, a single statement like this does not have braces
around it.  There are a few instances of this in the patch.

Tom


  reply	other threads:[~2008-11-25  8:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-24 18:51 Jerome Guitton
2008-11-25 17:59 ` Tom Tromey [this message]
2008-11-25 18:00   ` Tom Tromey
2008-11-25 18:11   ` [RFA] " Jerome Guitton
2008-11-25 18:47     ` Tom Tromey
2008-11-25 21:05       ` Jerome Guitton
2008-11-26  2:03         ` Joel Brobecker
2008-11-27  2:18           ` Jerome Guitton
2008-11-27 10:05           ` Jerome Guitton

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=m3fxlgw5t3.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=guitton@adacore.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