msg84089 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2009-03-24 14:49 |
Below is the relevant snippet from pyport.h. There are two reasons that Py_LOCAL_INLINE doesn't actually emit the "inline" keyword (unless compiling with MSC). First, "configure" does not have code to test the compiler and define USE_INLINE if appropriate. Second, the code undefines USE_INLINE even if defined! (oops? ;) ) The snippet is replicated with slightly different names near the top of _sre.c. #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 */ #define Py_LOCAL(type) static type __fastcall #define Py_LOCAL_INLINE(type) static __inline type __fastcall #elif defined(USE_INLINE) #define Py_LOCAL(type) static type #define Py_LOCAL_INLINE(type) static inline type #else #define Py_LOCAL(type) static type #define Py_LOCAL_INLINE(type) static type #endif |
|
|
msg104470 - (view) |
Author: Roumen Petrov (rpetrov) * |
Date: 2010-04-28 21:57 |
Configure could call macro to define inline - cf. autoconf manuals. |
|
|
msg104476 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-04-29 00:01 |
Py_LOCAL_INLINE is also not used a lot. Usually, the compiler will inline small static functions by itself. Most of the time, we used #defines rather than functions when we want to inline short snippets of code. |
|
|
msg104641 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2010-04-30 15:00 |
Attached is a patch. The diff to configure is just what autoconf produces as a result of the diff to configure.in. With the patch, pyconfig.h will: - do nothing if the compiler supports the "inline" keyword - #define inline to __inline or __inline__ if that's the compiler supports - #define inline to nothing if the compiler doesn't support inlining The patch also updates pyport.h and _sre.c appropriately. |
|
|
msg104644 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2010-04-30 15:06 |
I should add that the patch is against the py3k branch, since it's too late for performance improvements to land in trunk. |
|
|
msg105940 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-05-17 21:38 |
The patch looks ok to me. |
|
|
msg115275 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2010-08-31 19:52 |
Committed in r84379 |
|
|
msg115621 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2010-09-05 00:34 |
Note: autoreconf failure caused by r84379 was fixed by r84512. |
|
|
msg115625 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2010-09-05 04:43 |
Ned, thanks for bringing that to my attention. I might have missed it otherwise. I had run "autoconf" but had not known to run "autoreconf", so I had missed the failure there. *embarrassed* Benjamin, thanks for fixing my error! |
|
|