Dag Sverre Seljebotn wrote: > Lisandro Dalcin wrote: >> On Sat, Oct 3, 2009 at 5:46 AM, Dag Sverre Seljebotn wrote: >>> In the interest of fixing >>> >>> http://trac.cython.org/cython_trac/ticket/281 >>> >> I was thinking on this a couple of days ago. Why the filename is not >> just passed to Pyx_AddTracebak... and further, why the lineno is not >> just stored the C function stack? > > Since these are only used in exceptional circumstances, one reason to > make them globals though might be to help the compiler by making sure > the variables doesn't occupy registers (because unless the compiler is > smart enough to take into account the unlikely(), perhaps it will think > that the except branch will be taken and take a register from some other > variable that could have better need of it?).
But that would still only apply to the exception case, which is always followed by a "goto", i.e. it jumps to a different section of the function (or module code) which likely uses different variables. I doubt that this has any performance impact, even if the C compiler decides to put the values into registers before the jump. For non trivial functions, I expect register allocation to be almost never function wide, especially on the limited x86 architecture. You also shouldn't assume a 1:1 mapping between a variable and a register. C compilers can alias variables between subsequent assignments, for example. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
