Skip to content
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

bpo-45094: Add Py_ALWAYS_INLINE macro #28141

Closed
wants to merge 2 commits into from
Closed

bpo-45094: Add Py_ALWAYS_INLINE macro #28141

wants to merge 2 commits into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 3, 2021

Add Py_ALWAYS_INLINE macro to ask the compiler to always inline a
static inline function.

Use Py_ALWAYS_INLINE on static inline functions:

  • Py_DECREF(), Py_XDECREF()
  • Py_INCREF(), Py_XINCREF()
  • Py_IS_TYPE()
  • Py_NewRef(), Py_XNewRef()
  • Py_REFCNT()
  • Py_SET_REFCNT(), Py_SET_SIZE(), Py_SET_TYPE()

https://bugs.python.org/issue45094

Add Py_ALWAYS_INLINE macro to ask the compiler to always inline a
static inline function.

Use Py_ALWAYS_INLINE on static inline functions:

* Py_DECREF(), Py_XDECREF()
* Py_INCREF(), Py_XINCREF()
* Py_IS_TYPE()
* Py_NewRef(), Py_XNewRef()
* Py_REFCNT()
* Py_SET_REFCNT(), Py_SET_SIZE(), Py_SET_TYPE()
@vstinner
Copy link
Member Author

vstinner commented Sep 3, 2021

Copy link
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just have some minor nits with wording and usage.

Include/pyport.h Outdated
@@ -557,6 +557,28 @@ extern "C" {
#define _Py_HOT_FUNCTION
#endif

// Ask the compiler to always inline a static inline function. The compiler is
// free is ignored this "hint". This attribute can be used to avoid increasing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// free is ignored this "hint". This attribute can be used to avoid increasing
// free to ignore this "hint". This attribute can be used to avoid increasing

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have nothing to add after Ken's comments. LGTM :)

@vstinner
Copy link
Member Author

vstinner commented Sep 4, 2021

Sadly, it doesn't seem to solve PR #28128 problem.

@vstinner vstinner marked this pull request as draft September 4, 2021 01:15
@vstinner
Copy link
Member Author

vstinner commented Sep 7, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants