[Python-Dev] Optimization targets - refcount (original) (raw)
Jeff Epler jepler at unpythonic.net
Fri Apr 16 15:06:22 EDT 2004
- Previous message: [Python-Dev] Optimization targets - refcount
- Next message: [Python-Dev] Optimization targets - refcount
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Maybe something like this:
#ifdef GCC #define constant_p(x) __builtin_constant_p(x) #else #define constant_p(x) 0 #endif
#define Py_INCREF(x)
if( ! constant_p(x) || (x != Py_None && x != other immortals))
actual Py_INCREF body(x)
this should allow the compiler, by constant propagation, to skip actual Py_INCREF body when it sees Py_INCREF(Py_None) and when it's Py_INCREF(nonconstant) to have no test for equality with the immortal values.
does this actually work? I didn't check. I think that on some important systems there may be no equivalent to gcc's __builtin_constant_p(), and that Py_None is not a compile-time constant (cough DLLs cough)
Jeff
- Previous message: [Python-Dev] Optimization targets - refcount
- Next message: [Python-Dev] Optimization targets - refcount
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]