This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [PR c++/80290] recycle tinst garbage sooner


On Apr 16, 2018, Jason Merrill <jason@redhat.com> wrote:

> This change looks good. One other nit: get_decl_maybe can also return a
> list, so the name seems wrong.

Uhh, it's "give me the decl if you got one, but it's ok if you give me a
list" (the latter is what makes it _maybe).  It replaces what used to be
called just 'decl'.  Maybe wrong is a bit too strong, but...  do you
have any suggestion?  get_decl_or_tree_list_but_dont_build_the_list is a
bit too long IMHO ;-)

> And this line

> +      if (obj->list_p () && obj->get_decl_maybe ())

> could be

>   if (tree_list_p ())

It could if we made tree_list_p public.  It's private because that's an
internal implementation detail, though it's one that happens to leak
through the combination of calls above.

> I think, and then get_decl_maybe wouldn't need to return a list anymore?

That's backwards.  It doesn't need to; the point of get_decl_maybe is to
make as simple a test as possible and return fast, without having to
look in the "decl" to find out what it is.  I even considered making it
return tldcl unconditionally, but that would just cause trouble for the
various pieces of code that used to compare tinst_level::decls for
equality, and would now get false positives out of split lists sharing
the same tmpl decl in the first element of the list.  Testing targs in
get_decl_maybe to avoid returning a partial former decl rules out this
case and is as cheap as it gets.

Do we need more detailed comments, besides a name change?

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]