From: Yao Qi <qiyaoltc@gmail.com>
To: Simon Marchi <simark@simark.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 4/7] Class-fy partial_die_info
Date: Tue, 30 Jan 2018 10:49:00 -0000 [thread overview]
Message-ID: <86efm7d3kp.fsf@gmail.com> (raw)
In-Reply-To: <c2b2b52e-707c-b2c3-c7ee-f581bb2e17b7@simark.ca> (Simon Marchi's message of "Sun, 28 Jan 2018 20:15:04 -0500")
Simon Marchi <simark@simark.ca> 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 htab,
> is that right? If so, converting that htab_t to an std::unordered_map would
Right.
>
> - /* Hash table holding all the loaded partial DIEs
> - with partial_die->offset.SECT_OFF as hash. */
> - htab_t partial_dies = nullptr;
> + /* Hash map holding all the loaded partial DIEs
> + with their section offset as the key. */
> + std::unordered_map<sect_offset, partial_die_info *> partial_dies;
>
This doesn't compile with my g++ 4.9, as library doesn't provide
std::hash<T> 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<std::underlying_type<sect_offset>::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 = 1;
>
> - cu->partial_dies
> - = 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.
--
Yao (齐尧)
next prev parent reply other threads:[~2018-01-30 10:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 9:38 [PATCH 0/7] " Yao Qi
2018-01-25 9:38 ` [PATCH 7/7] Move read_partial_die to partial_die_info::read Yao Qi
2018-01-29 1:58 ` Simon Marchi
2018-01-25 9:38 ` [PATCH 5/7] Remove one argument abbrev_len in read_partial_die Yao Qi
2018-01-29 1:30 ` Simon Marchi
2018-01-25 9:38 ` [PATCH 6/7] Move fixup_partial_die to partial_die_info::fixup Yao Qi
2018-01-25 12:59 ` Pedro Alves
2018-01-25 14:45 ` Yao Qi
2018-01-25 9:38 ` [PATCH 2/7] Don't check abbrev is NULL in read_partial_die Yao Qi
2018-01-25 9:38 ` [PATCH 1/7] Re-write partial_die_info allocation in load_partial_dies Yao Qi
2018-01-25 9:38 ` [PATCH 3/7] Change find_partial_die_in_comp_unit to dwarf2_cu::find_partial_die Yao Qi
2018-01-25 9:38 ` [PATCH 4/7] Class-fy partial_die_info Yao Qi
[not found] ` <87vafphpw6.fsf@tromey.com>
2018-01-26 17:25 ` Yao Qi
2018-01-26 20:55 ` Tom Tromey
2018-01-29 1:15 ` Simon Marchi
2018-01-30 10:49 ` Yao Qi [this message]
2018-01-30 15:11 ` Pedro Alves
2018-01-30 11:39 ` Pedro Alves
2018-01-31 3:46 ` Simon Marchi
2018-01-31 11:55 ` Yao Qi
2018-01-31 15:33 ` Pedro Alves
2018-01-25 12:05 ` [PATCH 0/7] " Joel Brobecker
2018-01-25 14:03 ` Yao Qi
2018-02-22 15:36 [PATCH 0/7 v2] " Yao Qi
2018-02-22 15:36 ` [PATCH 4/7] " Yao Qi
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=86efm7d3kp.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/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