You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Py_LOCAL_INLINE(type) doesn't actually inline except using MSC #49803
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 */#definePy_LOCAL(type) static type __fastcall
#definePy_LOCAL_INLINE(type) static __inline type __fastcall
#elif defined(USE_INLINE)
#definePy_LOCAL(type) static type
#definePy_LOCAL_INLINE(type) static inline type
#else#definePy_LOCAL(type) static type
#definePy_LOCAL_INLINE(type) static type
#endif
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.
stutzbach commented on Apr 30, 2010
stutzbachmannequin
MannequinAuthor
More actions
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.
stutzbach commented on Apr 30, 2010
stutzbachmannequin
MannequinAuthor
More actions
I should add that the patch is against the py3k branch, since it's too late for performance improvements to land in trunk.
Activity
stutzbach commentedon Mar 24, 2009
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? */
rpetrov commentedon Apr 28, 2010
Configure could call macro to define inline - cf. autoconf manuals.
pitrou commentedon Apr 29, 2010
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.
stutzbach commentedon Apr 30, 2010
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:
The patch also updates pyport.h and _sre.c appropriately.
stutzbach commentedon Apr 30, 2010
I should add that the patch is against the py3k branch, since it's too late for performance improvements to land in trunk.
pitrou commentedon May 17, 2010
The patch looks ok to me.
stutzbach commentedon Aug 31, 2010
Committed in r84379
ned-deily commentedon Sep 5, 2010
Note: autoreconf failure caused by r84379 was fixed by r84512.
stutzbach commentedon Sep 5, 2010
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!