From patchwork Tue May 2 20:26:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1776036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=V4aiOwyl; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q9s7n1n2Xz1ymp for ; Wed, 3 May 2023 06:27:17 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 796E5394CC2E for ; Tue, 2 May 2023 20:27:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 796E5394CC2E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683059234; bh=5YNlKuM0mad9eY7M90EVBkLY+UPPHulvO92sK8gsKmo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=V4aiOwylwhEimvqoIRoGIGz9fAXGBicd/6W+ucxt7u5tov2uYe4jm6R8FI6f1ZwMs YKUS0r3Wq8w9K8T9aJK4/TMu/9AE+DUfaCB0DlK78gQlXpTUXmWtLfUib3x5qFy6Pg tXfm5A1mF+SsDhRaij3MkjzQA15R3DLsugCkRLhU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A22623899016 for ; Tue, 2 May 2023 20:26:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A22623899016 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-658-LGk-fFrENIGcL_KRzHCgcQ-1; Tue, 02 May 2023 16:26:28 -0400 X-MC-Unique: LGk-fFrENIGcL_KRzHCgcQ-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-3ef691d1eebso23257951cf.3 for ; Tue, 02 May 2023 13:26:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683059188; x=1685651188; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5YNlKuM0mad9eY7M90EVBkLY+UPPHulvO92sK8gsKmo=; b=EUxVrLFvNYx96v0bxRt/aRLqjelLk5EQfFyUKSlO8XT1gStYvrHMlvn8CsiEz8wrIL +oEzH1BqpeIZRl9fapMDc9O9yooa0zzTmeIgX1Z4JwRs23n66nBLy3aIlVlFMG/M/a9w iUx4RqxG+amlplRdpPcyrBK4ETOK5SQuZXtw7jLEIo/yD6c6XotoeZstzPKeLVrhW20Z i24d6DC+fi6QuneZ2Y524KsPbnCsjvH1HlMfGN/E0t/EJzAzPHY4fdefLAJL72nQID9C JeLk9CT9o6ECQ96YhqkRHZdsEH6thATyZIuG+flSj9+0aHzVgzZ+C4juDSZoctHqFSGh 9j0A== X-Gm-Message-State: AC+VfDyTvbXAeZlUpTfC1YAydRnpqv32HltShMmmmbgRVSKayO2VWY0P bXRBc6CqRwmroCi0pOs/lS9ezKW4XCzLQIny6f5Dsi52Y6U/oVXflq0GyGbXEI2dmaIYl3Rhs3G AIA/PgAvYcxGAQMdZgDaunLuZoHoYJ1utac5HfYlwLzkvmjVs3V+euGDiSxpyjeAvyDApC07NGw == X-Received: by 2002:ac8:5b91:0:b0:3e6:71d6:5d5b with SMTP id a17-20020ac85b91000000b003e671d65d5bmr31183875qta.4.1683059188163; Tue, 02 May 2023 13:26:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ79jDRV3oXx1W9oilo1aBruXjgRRLwTbGqyU972gSOkY0he8OKC4IV+SB4DcB9dZASQTPFqgQ== X-Received: by 2002:ac8:5b91:0:b0:3e6:71d6:5d5b with SMTP id a17-20020ac85b91000000b003e671d65d5bmr31183848qta.4.1683059187841; Tue, 02 May 2023 13:26:27 -0700 (PDT) Received: from jason.com (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id h27-20020ac8777b000000b003ee2fb84d0dsm10622622qtu.11.2023.05.02.13.26.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 13:26:27 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: less invalidate_class_lookup_cache Date: Tue, 2 May 2023 16:26:23 -0400 Message-Id: <20230502202623.1965601-1-jason@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jason Merrill via Gcc-patches From: Jason Merrill Reply-To: Jason Merrill Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- In the testcase below, we push_to_top_level to instantiate f and g, and they can both use the previous_class_level cache from instantiating A. Wiping the cache in pop_from_top_level is not helpful; we'll do that in pushclass if needed. template struct A { int i; void f() { i = 42; } void g() { i = 24; } }; int main() { A a; a.f(); a.g(); } gcc/cp/ChangeLog: * name-lookup.cc (pop_from_top_level): Don't invalidate_class_lookup_cache. --- gcc/cp/name-lookup.cc | 3 --- 1 file changed, 3 deletions(-) base-commit: bc24c51c0ccd64617864897ad071c98004ffc0a4 diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index 7c61bc3bf61..8fd5733c1e2 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -8205,9 +8205,6 @@ pop_from_top_level (void) auto_cond_timevar tv (TV_NAME_LOOKUP); - /* Clear out class-level bindings cache. */ - if (previous_class_level) - invalidate_class_lookup_cache (); pop_class_stack (); release_tree_vector (current_lang_base);