From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32622 invoked by alias); 30 Jan 2018 10:49:30 -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 32609 invoked by uid 89); 30 Jan 2018 10:49:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:static. X-HELO: mail-wr0-f169.google.com Received: from mail-wr0-f169.google.com (HELO mail-wr0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 Jan 2018 10:49:20 +0000 Received: by mail-wr0-f169.google.com with SMTP id s5so10623492wra.0 for ; Tue, 30 Jan 2018 02:49:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=6fKlumAHqZ8c50HI9bTDyaigMZDYwZtL7+108Rdzbj4=; b=HKePiB9+WUCwxRTw0LNVRkSNICn1P1cyLYhP0KhwWdEef0jEjXR9ZpsWPOxh1d8mgk GAoGThQnhYpOks+XRiAUceDrLQALCIE7VpgLGljcDJOK2oMAtvXFD3oIAR+dGCOQKKxN mpNVrW5ALO8Kympw+P5vZE/RYNyOjxIc2thhYSirn+4PAGtjsTvCwtEnNtfhdgKmE2D1 HlTnJYDUu/Lgsfpxq3sLPwaz6OpQK71IjlZ1N3WzLdyWA/E7YFcAPfsJZnxhHhpX2dz3 q6zGCPyq6NP5AFFefUGpaNyf0X6OSDXoFyg5iwv3UVkkUs/GScwB1MiBkXLAMdsCSGYx APEA== X-Gm-Message-State: AKwxytcqt85r07CS6vPVNx4lYp0VNERBoBRmIGx+i3AmzzBrHNbFsYVz 60icIyzI81B2oqrX5pkkaFbUjg== X-Google-Smtp-Source: AH8x225ZaWux9xIuqN3ucWIUf2Gg4UNxeQUkGdnYfwTgu6KjexQ7XNfw8nn9jx60epIC10URMjPgCQ== X-Received: by 10.223.182.4 with SMTP id f4mr700738wre.11.1517309357442; Tue, 30 Jan 2018 02:49:17 -0800 (PST) Received: from E107787-LIN (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id h32sm16374353wrf.65.2018.01.30.02.49.16 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 30 Jan 2018 02:49:16 -0800 (PST) From: Yao Qi To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 4/7] Class-fy partial_die_info References: <1516873114-7449-1-git-send-email-yao.qi@linaro.org> <1516873114-7449-5-git-send-email-yao.qi@linaro.org> Date: Tue, 30 Jan 2018 10:49:00 -0000 In-Reply-To: (Simon Marchi's message of "Sun, 28 Jan 2018 20:15:04 -0500") Message-ID: <86efm7d3kp.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-01/txt/msg00624.txt.bz2 Simon Marchi writes: > From what I understand, the only reason to have that private constructor = is > to construct a temporary partial_die_info object used to search in the ht= ab, > is that right? If so, converting that htab_t to an std::unordered_map wo= uld Right. > > - /* Hash table holding all the loaded partial DIEs > - with partial_die->offset.SECT_OFF as hash. */ > - htab_t partial_dies =3D nullptr; > + /* Hash map holding all the loaded partial DIEs > + with their section offset as the key. */ > + std::unordered_map partial_dies; > This doesn't compile with my g++ 4.9, as library doesn't provide std::hash specialization for enumeration types. It is available since C++ 14. http://en.cppreference.com/w/cpp/utility/hash I can change it to std::unordered_map::type, partial_die_info *> partial_dies; to fix the compiler errors. > @@ -18259,14 +18227,7 @@ load_partial_dies (const struct die_reader_specs= *reader, > if (cu->per_cu->load_all_dies) > load_all =3D 1; > > - cu->partial_dies > - =3D htab_create_alloc_ex (cu->header.length / 12, > - partial_die_hash, > - partial_die_eq, > - NULL, > - &cu->comp_unit_obstack, > - hashtab_obstack_allocate, > - dummy_obstack_deallocate); > + cu->partial_dies.clear (); This changes the behavior, without this patch, cu->partial_dies's elements are allocated on cu->comp_unit_obstack. After this patch, elements are allocated on heap. I don't know how does it affect performance. --=20 Yao (=E9=BD=90=E5=B0=A7)