From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17814 invoked by alias); 9 Jan 2014 19:03:08 -0000 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 Received: (qmail 17801 invoked by uid 89); 9 Jan 2014 19:03:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Jan 2014 19:03:07 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s09J34p1018809 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 9 Jan 2014 14:03:05 -0500 Received: from barimba.redhat.com (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s09J344Z000431; Thu, 9 Jan 2014 14:03:04 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] rearrange struct value to save memory Date: Thu, 09 Jan 2014 19:03:00 -0000 Message-Id: <1389294182-982-1-git-send-email-tromey@redhat.com> X-SW-Source: 2014-01/txt/msg00256.txt.bz2 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 * value.c (struct value) : 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