Skip to content

Conversation

vstinner
Copy link
Member

Currently, calling Py_EnterRecursiveCall() and
Py_LeaveRecursiveCall() may use a function call or a static inline
function call, depending if the internal pycore_ceval.h header file
is included or not. Use a different name for the static inline
function to ensure that the static inline function is always used in
Python internals for best performance. Similar approach than
PyThreadState_GET() (function call) and _PyThreadState_GET() (static
inline function).

  • Rename _Py_EnterRecursiveCall() to _Py_EnterRecursiveCallTstate()
  • Rename _Py_LeaveRecursiveCall() to _Py_LeaveRecursiveCallTstate()
  • pycore_ceval.c: Rename Py_EnterRecursiveCall() to
    _Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() and
    _Py_LeaveRecursiveCall()

@vstinner
Copy link
Member Author

I'm not convinced that the performance of the static inline function is worth it. Maybe it can just be removed to only keep the variant with a tstate parameter?

Currently, calling Py_EnterRecursiveCall() and
Py_LeaveRecursiveCall() may use a function call or a static inline
function call, depending if the internal pycore_ceval.h header file
is included or not. Use a different name for the static inline
function to ensure that the static inline function is always used in
Python internals for best performance. Similar approach than
PyThreadState_GET() (function call) and _PyThreadState_GET() (static
inline function).

* Rename _Py_EnterRecursiveCall() to _Py_EnterRecursiveCallTstate()
* Rename _Py_LeaveRecursiveCall() to _Py_LeaveRecursiveCallTstate()
* pycore_ceval.c: Rename Py_EnterRecursiveCall() to
  _Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() and
  _Py_LeaveRecursiveCall()
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.

2 participants