On 5/25/06, Geert Bosch <[EMAIL PROTECTED]> wrote:
On May 23, 2006, at 11:21, Jon Smirl wrote: > A new calling convention could push two return addresses for functions > that return their status in EAX. On EAX=0 you take the first return, > EAX != 0 you take the second. This seems the same as passing an extra function pointer argument and calling that instead of doing a regular return. Tail-call optimization should turn the calll into a jump. Why do you think a custom ABI is necessary?
The new ABI may not be necessary but adding an extra parameter would require changing source everywhere. The ABI scheme is source transparent and lets the compiler locate the places where it would be a win. The ABI scheme would also let the alternative return be pushed on the stack once no matter how many calls were made, a parameter has to be pushed each time. I ran into another snag that taking the alternative return on a P4 has really bad performance impacts since it messes up prefetch. This sequence is the killer. addl $4, %esp ret /* Return to error return */ I can try coding this as a parameter and see how the compiler generates code differently. The sequence of call, test, jne (or slight variations) occurs in 1000's of places, if a better alternative can be found there could be significant perofrmance gains. I haven't found a good solution yet, any help would be appreciated.
-Geert
-- Jon Smirl [EMAIL PROTECTED]