New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Py_LOCAL_INLINE(type) doesn't actually inline except using MSC #49803
Comments
Below is the relevant snippet from pyport.h. There are two reasons that First, "configure" does not have code to test the compiler and define Second, the code undefines USE_INLINE even if defined! (oops? ;) ) The snippet is replicated with slightly different names near the top of #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 |
Configure could call macro to define inline - cf. autoconf manuals. |
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. |
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. |
I should add that the patch is against the py3k branch, since it's too late for performance improvements to land in trunk. |
The patch looks ok to me. |
Committed in r84379 |
Note: autoreconf failure caused by r84379 was fixed by r84512. |
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! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: