needforspeed: added PY_LOCAL_AGGRESSIVE macro to enable "aggressive"

LOCAL inlining; also added some missing whitespace
This commit is contained in:
Fredrik Lundh 2006-05-26 11:54:04 +00:00
parent 567a8ffd09
commit 57640f5c57
2 changed files with 31 additions and 15 deletions

View File

@ -141,6 +141,10 @@ typedef Py_intptr_t Py_ssize_t;
* convention for functions that are local to a given module. It also enables
* inlining, where suitable.
*
* If PY_LOCAL_AGGRESSIVE is defined before python.h is included, a more
* "aggressive" inlining is enabled. This may lead to code bloat, and may
* slow things down for those reasons. Use with care.
*
* NOTE: You can only use this for functions that are entirely local to a
* module; functions that are exported via method tables, callbacks, etc,
* should keep using static.
@ -149,6 +153,10 @@ typedef Py_intptr_t Py_ssize_t;
#undef USE_INLINE /* XXX - set via configure? */
#if defined(_MSC_VER)
#if defined(PY_LOCAL_AGGRESSIVE)
/* enable more aggressive optimization for visual studio */
#pragma optimize("agtw", on)
#endif
/* ignore warnings if the compiler decides not to inline a function */
#pragma warning(disable: 4710)
/* fastest possible local call under MSVC */

View File

@ -6,6 +6,9 @@
XXX document it!
*/
/* enable more aggressive local inlining (platform dependent) */
#define PY_LOCAL_AGGRESSIVE
#include "Python.h"
#include "code.h"
@ -16,6 +19,11 @@
#include <ctype.h>
#if defined(_MSC_VER)
/* enable more aggressive optimization for visual studio */
#pragma optimize("agtw", on)
#endif
#ifndef WITH_TSC
#define READ_TIMESTAMP(var)
@ -476,7 +484,7 @@ enum why_code {
WHY_YIELD = 0x0040 /* 'yield' operator */
};
static enum why_code do_raise(PyObject *, PyObject *, PyObject *);
Py_LOCAL(enum why_code) do_raise(PyObject *, PyObject *, PyObject *);
Py_LOCAL(int) unpack_iterable(PyObject *, int, PyObject **);
/* for manipulating the thread switch and periodic "stuff" - used to be
@ -2971,7 +2979,7 @@ reset_exc_info(PyThreadState *tstate)
/* Logic for the raise statement (too complicated for inlining).
This *consumes* a reference count to each of its arguments. */
static enum why_code
Py_LOCAL(enum why_code)
do_raise(PyObject *type, PyObject *value, PyObject *tb)
{
if (type == NULL) {