From: Jason Merrill <jason@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [pushed] c++: remove nsdmi_inst hashtable
Date: Wed, 26 Apr 2023 17:16:13 -0400 [thread overview]
Message-ID: <20230426211613.463855-1-jason@redhat.com> (raw)
Tested x86_64-pc-linux-gnu, applying to trunk.
-- 8< --
It occurred to me that we have a perfectly good DECL_INITIAL field to put
the instantiated DMI into, we don't need a separate hash table.
gcc/cp/ChangeLog:
* init.cc (nsdmi_inst): Remove.
(maybe_instantiate_nsdmi_init): Use DECL_INITIAL instead.
---
gcc/cp/init.cc | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index 9571d18170e..1dd24e30d7c 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -564,21 +564,19 @@ perform_target_ctor (tree init)
/* Instantiate the default member initializer of MEMBER, if needed.
Only get_nsdmi should use the return value of this function. */
-static GTY((cache)) decl_tree_cache_map *nsdmi_inst;
-
tree
maybe_instantiate_nsdmi_init (tree member, tsubst_flags_t complain)
{
tree init = DECL_INITIAL (member);
- if (init && DECL_LANG_SPECIFIC (member) && DECL_TEMPLATE_INFO (member))
+
+ /* tsubst_decl uses void_node to indicate an uninstantiated DMI. */
+ if (init == void_node)
{
init = DECL_INITIAL (DECL_TI_TEMPLATE (member));
location_t expr_loc
= cp_expr_loc_or_loc (init, DECL_SOURCE_LOCATION (member));
if (TREE_CODE (init) == DEFERRED_PARSE)
/* Unparsed. */;
- else if (tree *slot = hash_map_safe_get (nsdmi_inst, member))
- init = *slot;
/* Check recursive instantiation. */
else if (DECL_INSTANTIATING_NSDMI_P (member))
{
@@ -639,7 +637,7 @@ maybe_instantiate_nsdmi_init (tree member, tsubst_flags_t complain)
DECL_INSTANTIATING_NSDMI_P (member) = 0;
if (init != error_mark_node)
- hash_map_safe_put<hm_ggc> (nsdmi_inst, member, init);
+ DECL_INITIAL (member) = init;
current_function_decl = cfd;
current_binding_level = cbl;
base-commit: 50d866038a910ceb9075b97295a12d77a8d09a3a
prerequisite-patch-id: 4ed1b4e9cbee2ce090bd119cbf47056c35aaeb57
prerequisite-patch-id: cd3a881f1b6cd3bca0064002d9a96f2f52c85a79
prerequisite-patch-id: b42a3670c7e30ee21934698ade2156884b63c19f
--
2.31.1
reply other threads:[~2023-04-26 21:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230426211613.463855-1-jason@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.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).