From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16559 invoked by alias); 9 Feb 2015 06:52:21 -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 16543 invoked by uid 89); 9 Feb 2015 06:52:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 09 Feb 2015 06:52:19 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 0F55D11654C; Mon, 9 Feb 2015 01:52:18 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id k6d5JGA81qVC; Mon, 9 Feb 2015 01:52:18 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 926A51163FC; Mon, 9 Feb 2015 01:52:17 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id D433540EAF; Mon, 9 Feb 2015 10:52:13 +0400 (RET) Date: Mon, 09 Feb 2015 06:52:00 -0000 From: Joel Brobecker To: Keven Boell Cc: gdb-patches@sourceware.org, Doug Evans Subject: Re: [V4 01/18] vla: introduce allocated/associated flags Message-ID: <20150209065213.GA15579@adacore.com> References: <1421243390-24015-1-git-send-email-keven.boell@intel.com> <1421243390-24015-2-git-send-email-keven.boell@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1421243390-24015-2-git-send-email-keven.boell@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-02/txt/msg00188.txt.bz2 [Copying Doug, as I think Doug has experience in this area, and is also dealing with the kind of giant programs where size of types really make a big difference] > Fortran 90 provide types whose values may be dynamically > allocated or associated with a variable under explicit > program control. The purpose of this commit is to read > allocated/associated DWARF tags and store them to the > main_type. > > 2014-05-28 Keven Boell > Sanimir Agovic > > * dwarf2read.c (set_die_type): Add reading of > allocated/associated flags. > * gdbtypes.h (struct main_type): Add allocated/ > associated dwarf2_prop attributes. > (TYPE_ALLOCATED_PROP): New macro. > (TYPE_ASSOCIATED_PROP): New macro. > (TYPE_NOT_ALLOCATED): New macro. > (TYPE_NOT_ASSOCIATED): New macro. struct main_type is size-critical, so we simply cannot add fields to it that only a very small minority of instances will actually be using.. To avoid the size increase, I propose that we turn... struct dynamic_prop *data_location; ... into a chained list of dynamic properties. To determine which type of property each element in the list is, we'll need to introduce an enumerated type to be used as discriminant. So, I propose something like that: /* FIXME: Add comment. */ enum dynamic_prop_kind { /* FIXME: Document. */ DYNAMIC_PROP_DATA_LOCATION, /* FIXME: Document. */ DYNAMIC_PROP_ALLOCATED, /* FIXME: Document. */ DYNAMIC_PROP_ASSOCIATED, }; /* FIXME: Document. */ struct dynamic_prop_list { enum dynamic_prop_kind kind; struct dynamic_prop *prop; struct dynamic_prop_list *next; }; ... then replace... struct dynamic_prop *data_location; ... into ... struct dynamic_prop_list *dyn_prop_list; ... and finally adjust the macros to go through the list instead of accessing the data through the dedicated fields. Using a function which does the search for a given kind will probably be useful. I think you might find it easier to do it in 2 stages (and therefore two patches): 1. Convert the current "data_location" field to the list scheme; 2. Then add the two new kinds of properties, which should then be fairly straightforward. -- Joel