in reply to Re^10: Perl 5 Optimizing Compiler, Part 4: LLVM Backend?
in thread Perl 5 Optimizing Compiler, Part 4: LLVM Backend?
This requires (at least the last time I looked in the linux pthreads library) the current stack pointer to be compared against the stack range allocated to each current thread, to determine which thread we are.
As an aside, I don't understand why the context needs to be passed from function to function to function anyway?
On windows, you allocate a global uint, assign the return from DWORD tlsindex = TlsAlloc() to it at process startup, and then whenever thread needs access to its TLS, it calls TlsSetValue( tlsIndex, pointer ); and struct context p = TlsGetValue( tilsIndex );.
And I read that pthreads has the equivalent pthread_key_create(), pthread_setspecific(), pthread_getspecific() calls which perate in a similar fashion.
So why does context have to be passed around, and reasserted in every routine, even those that (apparently) do not make any ised of it or what it points to?
I really do not understand why the perl context cannot be retrieved from TLS when it is needed, rather than passed around like a baton?
|
|---|