Missing qualifications

Paolo Carlini pcarlini@suse.de
Thu Mar 10 14:05:00 GMT 2005


Hi Chris

> It is almost able to :) The only (very tiny) problem is that it feels
> the urge to instansiate to zero the "empty classes" which are added
> extra.. the way to get rid of this would be to somehow force the
> forwarding functions to inline the thing they are forwarding to (for
> example make find inline find_if). I'm not sure a) how I can force a
> function to be inlined and b) if this might not confuse other inlining
> (at the moment g++ chooses, unsurprisingly, to always inline the
> forwarding functions)

Hummm, I'm not sure to understand: definitely inlining __find_if(..., 
random_access_iterator_tag), it's not an option, too big. The other one, 
it's ok to inline, and it's already marked as such. Or you mean *the 
latter* it's not inlined *always*, as it should (in order to also deal 
with the problem with zeroing)? In that case, we could play a bit with 
attribute always inline, perhaps. But, in general, I'm not sure to 
really understand what you mean by "instantiate to zero"... In the 
assembly of __ops::equal, before the eventual function call, is 
memory/registers zeroed?!?

Let's deal with such issues once and for all, before going ahead, I 
don't like this kind of regression in the generated code, even it 
doesn't impact too much the performance... In case, we can submit 
optimization PRs: cool new optimizations are going in in mainline (e.g., 
Daniel Berlin struct aliasing work...) and maybe it's just a matter of 
pointing out the problem in detail or waiting a bit.

> The problem with inlining find_if into search and search_n I've now
> tracked down. Now I understand it it's reasonably clear (although I
> still don't entirely understand what is going on in this piece of code)
>
> The problem is that src/string-inst.c instansiates search explicitally,
> and so I have to add to that file all functions that get called by
> search. I was getting confused a) because just changing stl_algo.h and
> then running "make" doesn't seem to realise it has to rebuild this file,
> so I was only getting the error on total rebuilds and b) it was only
> complaining about not being able to find __find_if, as I assume the call
> s to find, _gnu_cxx::__ops::equal, and
> _gnu_cxx::__ops::equal_to::operator() were being inlined away.

Indeed, find it's already used by search in mainline. Expected (minor) 
issues, no problem.

> Now I've figured out the problem, I'm slightly worried that there might
> be other explicitally instansatied functions. I had a quick look around
> but I couldn't find any. I'd be slightly happier if someone could tell
> me how I can certainly check I haven't broken anything here :)

I'm not seriously worried, I don't think there are other instantiations 
lurking around and we have time to deal with that, in case.

Thanks,
Paolo.



More information about the Libstdc++ mailing list