Message ID | 20200208152758.29385-6-tom@tromey.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 69464 invoked by alias); 8 Feb 2020 15:28:05 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 69336 invoked by uid 89); 8 Feb 2020 15:28:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.53.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 08 Feb 2020 15:28:04 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 907F6400C6FD4 for <gdb-patches@sourceware.org>; Sat, 8 Feb 2020 08:14:37 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 0S1ZjRpcqRP4z0S1ZjuLrg; Sat, 08 Feb 2020 09:28:01 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Sl3f7zhbMNgf9t4FZvlMhsERHul5ZsBNaVKYjKgp2Lw=; b=cV0dZTPMhmFni59NA2hDE/k+XP alPeWYycOnxfD0owlotSVHfycq+qvs7rcJ14Kny/vMuwKxt87+YZnZjVFUt/GrlPcPsxzPpsHkm2b T2edfYS7l3jSqrbjAzlOjXhiy; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:38112 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from <tom@tromey.com>) id 1j0S1Z-001WwE-71; Sat, 08 Feb 2020 08:28:01 -0700 From: Tom Tromey <tom@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey <tom@tromey.com> Subject: [PATCH 5/8] Add per-unit obstack Date: Sat, 8 Feb 2020 08:27:55 -0700 Message-Id: <20200208152758.29385-6-tom@tromey.com> In-Reply-To: <20200208152758.29385-1-tom@tromey.com> References: <20200208152758.29385-1-tom@tromey.com> |
Commit Message
Tom Tromey
Feb. 8, 2020, 3:27 p.m. UTC
This adds an auto_obstack to the DWARF frame comp_unit object, and then changes the remaining code here to use the comp_unit obstack rather than the objfile obstack. At this point, all the storage for frame data is self-contained -- that is, it is independent of the objfile. gdb/ChangeLog 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/frame.c (struct comp_unit) <obstack>: New member. (decode_frame_entry_1): Use the comp_unit obstack. Change-Id: I8a1af090bcc2811762a38afbbea1512be7d952fb --- gdb/ChangeLog | 5 +++++ gdb/dwarf2/frame.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
Comments
On 2/8/20 12:27 PM, Tom Tromey wrote: > This adds an auto_obstack to the DWARF frame comp_unit object, and > then changes the remaining code here to use the comp_unit obstack > rather than the objfile obstack. > > At this point, all the storage for frame data is self-contained -- > that is, it is independent of the objfile. > > gdb/ChangeLog > 2020-02-08 Tom Tromey <tom@tromey.com> > > * dwarf2/frame.c (struct comp_unit) <obstack>: New member. > (decode_frame_entry_1): Use the comp_unit obstack. > > Change-Id: I8a1af090bcc2811762a38afbbea1512be7d952fb > --- > gdb/ChangeLog | 5 +++++ > gdb/dwarf2/frame.c | 7 +++++-- > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c > index 0e74b8e7e68..7e1a744513b 100644 > --- a/gdb/dwarf2/frame.c > +++ b/gdb/dwarf2/frame.c > @@ -158,6 +158,9 @@ struct comp_unit > > /* The FDE table. */ > dwarf2_fde_table fde_table; > + > + /* Hold data used by this module. */ > + auto_obstack obstack; > }; > > static struct dwarf2_fde *dwarf2_frame_find_fde (CORE_ADDR *pc, > @@ -1771,7 +1774,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, > if (find_cie (cie_table, cie_pointer)) > return end; > > - cie = XOBNEW (&unit->objfile->objfile_obstack, struct dwarf2_cie); > + cie = XOBNEW (&unit->obstack, struct dwarf2_cie); > cie->initial_instructions = NULL; > cie->cie_pointer = cie_pointer; > > @@ -1950,7 +1953,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, > if (cie_pointer >= unit->dwarf_frame_size) > return NULL; > > - fde = XOBNEW (&unit->objfile->objfile_obstack, struct dwarf2_fde); > + fde = XOBNEW (&unit->obstack, struct dwarf2_fde); > fde->cie = find_cie (cie_table, cie_pointer); > if (fde->cie == NULL) > { > LGTM.
On 2020-02-08 10:27 a.m., Tom Tromey wrote: > This adds an auto_obstack to the DWARF frame comp_unit object, and > then changes the remaining code here to use the comp_unit obstack > rather than the objfile obstack. > > At this point, all the storage for frame data is self-contained -- > that is, it is independent of the objfile. Would it be simpler to eliminate the obstack by making dwarf2_cie_table and dwarf2_fde_table hold objects instead of pointers? On top of that, it should be good for performance as well, at least when doing lookups. The only issue is that dwarf2_cie objects are referenced by address by the FDEs, so we must make sure they don't get moved by the container. But I believe std::unordered_map guarantees that (disabling copy and assign on dwarf2_cie would verify it). Or worst case, the it could be an std::unordered_map of std::unique_ptr. Simon
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
Simon> Would it be simpler to eliminate the obstack by making dwarf2_cie_table
Simon> and dwarf2_fde_table hold objects instead of pointers? On top of that,
Simon> it should be good for performance as well, at least when doing lookups.
Simon> The only issue is that dwarf2_cie objects are referenced by address by
Simon> the FDEs, so we must make sure they don't get moved by the container.
Simon> But I believe std::unordered_map guarantees that (disabling copy and
Simon> assign on dwarf2_cie would verify it). Or worst case, the it could
Simon> be an std::unordered_map of std::unique_ptr.
I think I would rather defer this change, like the other one, since it's
not directly related to the purpose of the series.
Tom
On 2020-02-12 5:41 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes: > > Simon> Would it be simpler to eliminate the obstack by making dwarf2_cie_table > Simon> and dwarf2_fde_table hold objects instead of pointers? On top of that, > Simon> it should be good for performance as well, at least when doing lookups. > > Simon> The only issue is that dwarf2_cie objects are referenced by address by > Simon> the FDEs, so we must make sure they don't get moved by the container. > Simon> But I believe std::unordered_map guarantees that (disabling copy and > Simon> assign on dwarf2_cie would verify it). Or worst case, the it could > Simon> be an std::unordered_map of std::unique_ptr. > > I think I would rather defer this change, like the other one, since it's > not directly related to the purpose of the series. > > Tom > No problem, I suggested this in case it actually made things simpler, but I am fine with what you have. Simon
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
Simon> No problem, I suggested this in case it actually made things
Simon> simpler, but I am fine with what you have.
Thanks. I'm going to push this series now.
Tom
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index 0e74b8e7e68..7e1a744513b 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -158,6 +158,9 @@ struct comp_unit /* The FDE table. */ dwarf2_fde_table fde_table; + + /* Hold data used by this module. */ + auto_obstack obstack; }; static struct dwarf2_fde *dwarf2_frame_find_fde (CORE_ADDR *pc, @@ -1771,7 +1774,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, if (find_cie (cie_table, cie_pointer)) return end; - cie = XOBNEW (&unit->objfile->objfile_obstack, struct dwarf2_cie); + cie = XOBNEW (&unit->obstack, struct dwarf2_cie); cie->initial_instructions = NULL; cie->cie_pointer = cie_pointer; @@ -1950,7 +1953,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, if (cie_pointer >= unit->dwarf_frame_size) return NULL; - fde = XOBNEW (&unit->objfile->objfile_obstack, struct dwarf2_fde); + fde = XOBNEW (&unit->obstack, struct dwarf2_fde); fde->cie = find_cie (cie_table, cie_pointer); if (fde->cie == NULL) {