New submission from Jeffrey Yasskin <[EMAIL PROTECTED]>: I'm using Apple's gcc-4.0.1 on a 2.33GHz Intel Core 2 Duo to test this. Measurements from other compilers or other chips would be cool.
Specifically, this patch: 1) Moves the declarations of most of the local variables inside the for(;;) loop. That shortens their lifetimes so that the compiler can skip spilling them to memory in some cases. Pushing them further down into the individual case statements didn't change the generated assembly in most cases, although there are probably a few opcodes where it would. 2) Eliminates the initialization of w, and fixes the "possibly used uninitialized" warning by changing how the PRINT opcodes initialize it from stream. That lets my compiler avoid using its stack entry most of the time. 3) In two hot opcodes, LOAD_FAST and LOAD_CONST, changes the 'x' to a 'w'. 'x' is always written to memory because it's used for error detection, while 'w' can stay on the stack. 4) Changes --_Py_Ticker in the periodic things check to _Py_Ticker--. Because _Py_Ticker is volatile, predecrement (at least on my compiler) needs 3 memory accesses, while postdecrement gets away with 2. Together, these changes are worth about 3% on pybench on my machine. ---------- components: Interpreter Core files: elim_mem_refs.patch keywords: patch, patch messages: 63426 nosy: jyasskin severity: normal status: open title: Helping the compiler avoid memory references in PyEval_EvalFrameEx type: behavior versions: Python 2.6 Added file: http://bugs.python.org/file9643/elim_mem_refs.patch __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2262> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com