public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Patrick Palka <patrick@parcs.ath.cx>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix PR c++/70452 (regression in C++ parsing performance)
Date: Mon, 04 Apr 2016 15:39:00 -0000	[thread overview]
Message-ID: <57028AA7.6090807@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.20.11.1604021715510.1308@idea>

On 04/02/2016 05:18 PM, Patrick Palka wrote:
> Here's a version that uses a separate deletable table to cache the
> function copies.  For simplicity I used a hash_map instead of a
> hash_table.  Does this look OK to commit after bootstrap + regtest?

Thanks.  Minor nits:

 > +struct fundef_copies_table_t
 > +{
 > +  hash_map<tree, fun_copy *> *map;
 > +};

Why wrap the pointer in a struct?

> +	  maybe_initialize_fundef_copies_table ();
> +	  fun_copy *copy = get_fun_copy (fun);

Let's move the initialization call inside get_fun_copy.

> On a related note, I noticed that the constexpr_call_table is not marked
> deletable.  Marking it deletable speeds up the test case in the PR by
> about 10% and saves about 10MB.  Do you think doing so is a good idea?

Please.

> On another related note, I noticed that marking something as both
> GTY((deletable, cache)) doesn't work as intended, because the
> gt_cleare_cache functions run _after_ all deletable roots get
> zeroed out.  So during GC the gt_cleare_cache function of a root
> marked "deletable, cache" would always be a no-op.  Concretely I think
> this means that our cv_cache and fold_cache leak memory during GC
> because their underlying hash_map (allocated by operator new) is zeroed
> before gc_cleare_cache could clear it.

Hmm, I thought I remembered hitting the breakpoint in gt_cleare_cache 
and it being non-null.  But I guess we can get rid of the cache_map 
class and use the approach you have here, of a deletable gc-allocated 
hash_map pointer; I'd still use ->empty() for dumping the cache outside 
of GC, though.

Jason

  parent reply	other threads:[~2016-04-04 15:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 19:13 Patrick Palka
2016-04-01 19:25 ` Patrick Palka
2016-04-02  1:28 ` Jason Merrill
2016-04-02  1:55   ` Patrick Palka
2016-04-02  2:10     ` Patrick Palka
2016-04-02 21:18   ` Patrick Palka
2016-04-03  3:52     ` Trevor Saunders
2016-04-03 22:06       ` Patrick Palka
2016-04-04 15:39     ` Jason Merrill [this message]
2016-04-04 16:55       ` Patrick Palka
2016-04-05 13:06         ` 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=57028AA7.6090807@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=patrick@parcs.ath.cx \
    /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).