Re: Bad inlining because of "throw"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Donnerstag, den 11.11.2010, 21:08 -0500 schrieb John Fine:
> Probably de-inlining your cold block requires the extra function you 
> added.  If speed is more important you would want that function to have 
> the cold attribute so the branch would be predicted correctly and so 
> that the call to the extra function wouldn't pollute the L1 cache.

Well, thats what I do now, g++ generates much better asm. 

CMove::CMove(const char* packet, unsigned size):
		packetStruct(reinterpret_cast<const SMove*>(packet))
{
	if(size != sizeof(SMove))
	{
		CException::Throw(WRONG_SIZE,"Packet size..");
	}
}

with CException::Throw with
__attribute__ (( noinline , cold , noreturn)) and
CMove::CMove is marked as "inline"

But I am just wonder why g++ doesn't have a "throw" as a "cold-path".
Because the asm it generates looks like a "hot-path".

Anyways problem solved, thanks for the help.

Luca BÃla Palkovics




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux