From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [PATCH] rearrange struct value to save memory
Date: Thu, 09 Jan 2014 19:03:00 -0000 [thread overview]
Message-ID: <1389294182-982-1-git-send-email-tromey@redhat.com> (raw)
This patch rearranges struct value a tiny bit, moving the "regnum"
field into a hole. This saves 8 bytes per value on a 64-bit machine,
and 4 bytes per value on a 32 bit machine. I think it does not
negatively affect readability or performance.
Built and regtested on x86-64 Fedora 18.
Let me know what you think.
2014-01-09 Tom Tromey <tromey@redhat.com>
* value.c (struct value) <regnum>: Move earlier.
---
gdb/ChangeLog | 4 ++++
gdb/value.c | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gdb/value.c b/gdb/value.c
index 8542316..0e13b76 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -216,6 +216,9 @@ struct value
/* If the value has been released. */
unsigned int released : 1;
+ /* Register number if the value is from a register. */
+ short regnum;
+
/* Location of value (if lval). */
union
{
@@ -324,9 +327,6 @@ struct value
taken off this list. */
struct value *next;
- /* Register number if the value is from a register. */
- short regnum;
-
/* Actual contents of the value. Target byte-order. NULL or not
valid if lazy is nonzero. */
gdb_byte *contents;
--
1.8.1.4
next reply other threads:[~2014-01-09 19:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 19:03 Tom Tromey [this message]
2014-01-10 3:32 ` Yao Qi
2014-01-10 17:12 ` Tom Tromey
2014-01-13 20:02 ` Tom Tromey
2014-01-14 13:50 ` Yao Qi
2014-01-16 21:54 ` 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=1389294182-982-1-git-send-email-tromey@redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.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).