From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76011 invoked by alias); 25 May 2017 19:08:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 75996 invoked by uid 89); 25 May 2017 19:08:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy=maker, rare X-HELO: mail-io0-f181.google.com Received: from mail-io0-f181.google.com (HELO mail-io0-f181.google.com) (209.85.223.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 May 2017 19:08:16 +0000 Received: by mail-io0-f181.google.com with SMTP id k91so142508007ioi.1 for ; Thu, 25 May 2017 12:08:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JG0of14MnxveNpYC8u23eliXklA37cu0zdpAMayP/6w=; b=Qnb/wpZm3gNmad7H9nY1EApDLh1f/3kbjU6ltM62wSUfc/uXgctSpVAgwnP3h275h3 3BZzxEKW4ulveKywzM9+tgmpdE4NdiMN7Jt4dfath3ncRcx8SQ+V8LnQp++z73yIP/+u qWq+e5zQay0SbJnEFPKRjXbghMWhw3OsHERshm/d85GgdgUe3QDFSbqx3hLbe1xl9L3j LI4NjgvHTDzXIjtBjStAo3k108IW+R4PmafO7ThmbwAJwdzRPmhI3luDq1jhp31XLxwZ 4j3sYm4km9Z/5+uW+2hh3RIaJ8qplMs5ta97q2o2QBgbM3cJG/v46uQNPoa2puDvLcIO rCfw== X-Gm-Message-State: AODbwcDKHAu3prP9IIHV6pfehRuekIj4xlbXNvbFZzPkY615Awl2bZTU fOLiNNFApzIMlDtFy5oZU+Qjib062ZuF X-Received: by 10.107.6.218 with SMTP id f87mr38420912ioi.2.1495739298942; Thu, 25 May 2017 12:08:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.6.226 with HTTP; Thu, 25 May 2017 12:07:58 -0700 (PDT) In-Reply-To: <4f2b3ce9-7f06-6a10-f1c9-4542b3651bd0@acm.org> References: <4f2b3ce9-7f06-6a10-f1c9-4542b3651bd0@acm.org> From: Jason Merrill Date: Thu, 25 May 2017 19:17:00 -0000 Message-ID: Subject: Re: [C++ PATCH] Reimplement ADL To: Nathan Sidwell Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg01983.txt.bz2 On Thu, May 25, 2017 at 9:03 AM, Nathan Sidwell 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