in reply to Significance of #define PERL_NO_GET_CONTEXT in XS
On threaded (or more accurately, MULTIPLICITY) perls, all the interpreter state is collected into a single structure which is accessed via the my_perl local var; so for example you have
Under MULTIPLICITY, most perl API functions take an extra initial my_perl argument, which you have to provide. Within perl core itself, this is handled by the pTHX and aTHX macros, which declare the extra arg, and pass that arg down to lower-level functions.#define PL_stack_sp my_perl->Istack_sp
However, if your caller didn't provide my_perl, you have to retrieve it yourself, e.g. from thread-local storage (which may be relatively slow). In the absence of PERL_NO_GET_CONTEXT, every API function call is defined in such a way that it does the (slow) retrieve of my_perl before calling that function. So it takes care of the details for you, but slowly.
See Background and PERL_IMPLICIT_CONTEXT for more info.
Dave.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Significance of #define PERL_GET_NO_CONTEXT in XS
by halfcountplus (Hermit) on Mar 13, 2014 at 18:08 UTC | |
|
Re^2: Significance of #define PERL_GET_NO_CONTEXT in XS
by syphilis (Archbishop) on Mar 14, 2014 at 03:20 UTC | |
by dave_the_m (Monsignor) on Mar 14, 2014 at 12:34 UTC | |
by syphilis (Archbishop) on Mar 14, 2014 at 13:57 UTC |