From: Eric Botcazou <ebotcazou@adacore.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Richard Biener <richard.guenther@gmail.com>
Subject: Re: [C++] Fix PR bootstrap/81926
Date: Fri, 22 Sep 2017 20:20:00 -0000 [thread overview]
Message-ID: <11616972.pR5rpf8R4I@polaris> (raw)
In-Reply-To: <CADzB+2=GBK-QMeb6QC_6jERp6mNYYkiNwGLy6OKm9RmJi0hNGg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
> This looks good. But let's call it debug_type_hash instead. OK with
> that change.
Thanks. It occured to me that we don't need to look up the type twice when we
need to insert it so I have installed the attached patchlet as obvious after
boostrapping/regtesting on x86-64/Linux.
PR bootstrap/81926
* cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
--
Eric Botcazou
[-- Attachment #2: pr81926-2b.diff --]
[-- Type: text/x-patch, Size: 1195 bytes --]
Index: cp-objcp-common.c
===================================================================
--- cp-objcp-common.c (revision 253049)
+++ cp-objcp-common.c (working copy)
@@ -162,13 +162,13 @@ cp_get_debug_type (const_tree type)
types on the fly for the debug info only, they would not be attached
to any GC root and always be swept, so we would make the contents of
the debug info depend on the collection points. */
- struct tree_map in, *h;
+ struct tree_map in, *h, **slot;
in.base.from = CONST_CAST_TREE (type);
in.hash = htab_hash_pointer (type);
- h = debug_type_hash->find_with_hash (&in, in.hash);
- if (h)
- return h->to;
+ slot = debug_type_hash->find_slot_with_hash (&in, in.hash, INSERT);
+ if (*slot)
+ return (*slot)->to;
tree t = build_offset_type (TYPE_PTRMEMFUNC_OBJECT_TYPE (type),
TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type)));
@@ -177,7 +177,7 @@ cp_get_debug_type (const_tree type)
h->base.from = CONST_CAST_TREE (type);
h->hash = htab_hash_pointer (type);
h->to = t;
- *debug_type_hash->find_slot_with_hash (h, h->hash, INSERT) = h;
+ *slot = h;
return t;
}
prev parent reply other threads:[~2017-09-22 20:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-02 11:01 Eric Botcazou
2017-09-02 14:33 ` Richard Biener
2017-09-03 8:05 ` Eric Botcazou
2017-09-03 8:43 ` Richard Biener
2017-09-03 14:16 ` Eric Botcazou
2017-09-04 9:08 ` Richard Biener
2017-09-04 8:08 ` Eric Botcazou
2017-09-09 8:30 ` Jason Merrill
2017-09-22 20:20 ` Eric Botcazou [this message]
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=11616972.pR5rpf8R4I@polaris \
--to=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=richard.guenther@gmail.com \
/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).