Skip to content

bpo-45094: Add Py_ALWAYS_INLINE macro - #28141

Closed
vstinner wants to merge 2 commits into
python:mainfrom
vstinner:always_inline
Closed

bpo-45094: Add Py_ALWAYS_INLINE macro#28141
vstinner wants to merge 2 commits into
python:mainfrom
vstinner:always_inline

Conversation

@vstinner

@vstinnervstinner commented Sep 3, 2021

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

@Fidget-SpinnerFidget-Spinner left a comment

Copy link
Copy Markdown
Member

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.

Comment threadDoc/c-api/intro.rst Outdated
Comment threadInclude/object.h Outdated
Comment threadInclude/pyport.h Outdated
#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
Copy Markdown
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

Comment threadInclude/object.h Outdated

@erlend-aaslanderlend-aasland left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

Sign up for freeto 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

@vstinner@erlend-aasland@Fidget-Spinner@the-knights-who-say-ni@bedevere-bot