public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Nathan Sidwell <nathan@acm.org>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ PATCH] Reimplement ADL
Date: Thu, 25 May 2017 19:17:00 -0000	[thread overview]
Message-ID: <CADzB+2n=CR+t1BzGhFtYABc8XM4bUp7H=H3Fx0LkcA+OuB3qvA@mail.gmail.com> (raw)
In-Reply-To: <4f2b3ce9-7f06-6a10-f1c9-4542b3651bd0@acm.org>

On Thu, May 25, 2017 at 9:03 AM, Nathan Sidwell <nathan@acm.org> wrote:
> Anyway, this implementation introduces LOOKUP_SEEN_P and LOOKUP_FOUND_P to
> directly mark the DECL node.  Hence determination is now O(1) rather than
> O(N^2).  We still have a vector to recall which decls we need to unmark at
> the end of the lookup.  We need two markers on a class, because depending on
> how we found it we may need to search additional things about it. (These two
> maker bits will be used in later changes too.)
>
> One quirk is that ADL can be recursive.  ADL can cause template
> instantiation, which can in turn cause a different ADL to happen.  The new
> testcase is an example of this.  So, we need to detect this and undo/redo
> the outer DECL marking during the inner ADL.  Thus implementing a simple
> chain of ADLs and using their record of which decls got marked to undo/redo.
> The fiddly bit there is recording whether LOOKUP_FOUND_P was set or not
> (LOOKUP_SEEN_P will be).  To record that I simply push those DECLS with
> lookup_found_p set onto the stack.  They'll thus appear twice, and we can
> infer from the second sighting that it had FOUND_P set (and pop the stack).
> The recursion is a rare event, so we optimize the non-recursive case.

Sounds like it would make sense to use a hash_set rather than flags on
the decls.

Jason

  reply	other threads:[~2017-05-25 19:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 13:26 Nathan Sidwell
2017-05-25 19:17 ` Jason Merrill [this message]
2017-05-25 19:42   ` Nathan Sidwell
2017-05-26  8:08 ` Jakub Jelinek
2017-05-26 11:38   ` Nathan Sidwell
2017-05-26 11:50     ` Jakub Jelinek

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='CADzB+2n=CR+t1BzGhFtYABc8XM4bUp7H=H3Fx0LkcA+OuB3qvA@mail.gmail.com' \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nathan@acm.org \
    /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).