[Python-Dev] Re: Pass the Python thread state to internal C functions

2019-11-14 Thread Steve Dower
On 13Nov2019 1954, Larry Hastings wrote: On 11/13/19 5:52 AM, Victor Stinner wrote: Le mer. 13 nov. 2019 à 14:28, Larry Hastings a écrit : I did exactly that in the Gilectomy prototype. Pulling it out of TLS was too slow, What do you mean? Getting tstate from a TLS was a performance bottle

[Python-Dev] Re: Pass the Python thread state to internal C functions

2019-11-14 Thread Random832
On Thu, Nov 14, 2019, at 07:43, Antoine Pitrou wrote: > On Wed, 13 Nov 2019 14:52:32 +0100 > Victor Stinner wrote: > > > > #define _PyRuntimeState_GetThreadState(runtime) \ > > > > ((PyThreadState*)_Py_atomic_load_relaxed(&(runtime)->gilstate.tstate_current)) > > #define _PyThreadState_GET()

[Python-Dev] Re: Pass the Python thread state to internal C functions

2019-11-14 Thread Antoine Pitrou
On Wed, 13 Nov 2019 14:52:32 +0100 Victor Stinner wrote: > > #define _PyRuntimeState_GetThreadState(runtime) \ > > ((PyThreadState*)_Py_atomic_load_relaxed(&(runtime)->gilstate.tstate_current)) > #define _PyThreadState_GET() _PyRuntimeState_GetThreadState(&_PyRuntime) > > _PyThreadState_GET

[Python-Dev] Re: Pass the Python thread state to internal C functions

2019-11-14 Thread Victor Stinner
Le jeu. 14 nov. 2019 à 04:55, Larry Hastings a écrit : > I'm pretty sure you understand the sentence "Pulling it out of TLS was too > slow". At the time CPython used the POSIX APIs for accessing thread local > storage, and I didn't know about and therefore did not try this "__thread" > GCC ext