optimizing calling conventions for function returns

Florian Weimer fw@deneb.enyo.de
Tue May 23 20:29:00 GMT 2006


* Jon Smirl:

> Is the callstack branch correctly predicted if the routine being
> called is complex?

At least the AMD CPUs have implemented a special return stack cache,
so the answer is probably "yes".

> This does eliminate the test./jmp after every function call.

Yes, but the test/jump now happens in the callee, and you need to
maintain an additional stack slot.  I wouldn't be surprised if the
change isn't a win.  Some form of exception handling for truly
exceptional situations would probably be better (and might have helped
to avoid quite a few of the last CVEs 8-).



More information about the Gcc mailing list