Re:The cost of dynamic vs. static dispatch in C++
by mappu on Thursday December 05, 2013 @03:29PM
(#6856977)
I use push/ret idiom all the time to stdcall off the stack.. did not realise there was a return cache, that's very interesting.
[ Parent
| on HN ]
Re:The cost of dynamic vs. static dispatch in C++
by Taniwha on Thursday December 05, 2013 @03:50PM
(#6857121)
depends on the CPU - but it's relatively trivial thing to build (especially because unlike other caches it's a stack) on x86s return nominally is ALWAYS a bad pipe bubble: a pop followed by an indirect jump - the pop gets resolved at the end of its micro-op and the jump wants to be resolved early on so as to start decoding the next instruction
In the end it can't hurt to generate a bad jump prediction off of the return cache, it's no worse than being idle - the effect of messing with the cache though can cause it to always fail so as a result you get no advantage from it