From: Richard Biener <richard.guenther@gmail.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>,
Jeffrey A Law <law@redhat.com>,
Richard Sandiford <richard.sandiford@arm.com>,
Trevor Saunders <tsaunders@mozilla.com>
Subject: Re: RFA (hash-*): PATCH for c++/68309
Date: Mon, 14 Dec 2015 08:51:00 -0000 [thread overview]
Message-ID: <CAFiYyc19o2_d5SJdX7-f2fvbQMr_yTjkNr4p8g2LN511468STw@mail.gmail.com> (raw)
In-Reply-To: <566B1E93.3010802@redhat.com>
On Fri, Dec 11, 2015 at 8:05 PM, Jason Merrill <jason@redhat.com> wrote:
> On 12/11/2015 05:10 AM, Richard Biener wrote:
>>
>> On Thu, Dec 10, 2015 at 11:03 PM, Jason Merrill <jason@redhat.com> wrote:
>>>
>>> The C++ front end uses a temporary hash table to remember specializations
>>> of
>>> local variables during template instantiations. In a nested function
>>> such
>>> as a lambda or local class member function, we need to retain the
>>> elements
>>> from the enclosing function's local_specializations table; otherwise the
>>> testcase crashes because we don't find a local specialization for the
>>> non-captured use of 'args' in the decltype.
>>>
>>> This patch addresses that by making a copy of the enclosing
>>> local_specializations table if it exists; to enable that I've added copy
>>> constructors to hash_table and hash_map.
>>>
>>> Tested x86_64-pc-linux-gnu. OK for trunk?
>>
>>
>> I don't think you can copy the elements with memcpy they may be C++
>> classes
>> that are not copyable.
>
>
> True. Fixed thus:
>
>> + for (size_t i = 0; i < size; ++i)
>> + {
>> + value_type &entry = h.m_entries[i];
>> + if (is_deleted (entry))
>> + mark_deleted (m_entries[i]);
>> + else if (!is_empty (entry))
>> + m_entries[i] = entry;
>> + }
>
>
>> Also watch out for the bool gather_mem_stats = true
>> to bool gather_mem_stats = GATHER_STATISTICS change if that crosses your
>> change.
>
>
> OK.
>
>> I also think copying hash tables should be discouraged ;) I wonder if you
>> can get around the copying by adding a generation count (to easily
>> "backtrack")
>> instead.
>
>
> I considered having a chain of tables to check, to handle generations, but I
> figured that the tables in question were small enough (only containing local
> variables for a single function) that a simple copy was reasonable.
Looks good to me now. Needs adjustment to use GATHER_STATISTICS
as default-arg for gather_mem_stats now.
Thanks,
Richard.
> Jason
>
next prev parent reply other threads:[~2015-12-14 8:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-10 22:03 Jason Merrill
2015-12-11 10:11 ` Richard Biener
2015-12-11 19:06 ` Jason Merrill
2015-12-14 8:51 ` Richard Biener [this message]
2015-12-15 0:50 ` Trevor Saunders
2015-12-15 16:22 ` Jason Merrill
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=CAFiYyc19o2_d5SJdX7-f2fvbQMr_yTjkNr4p8g2LN511468STw@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=law@redhat.com \
--cc=richard.sandiford@arm.com \
--cc=tsaunders@mozilla.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).