Apologies for not replying earlier. I'm now back to work on this issue.
Nicholas Clark wrote:
On Sun, Jun 12, 2005 at 07:29:02PM +1000, Stas Bekman wrote:
Thanks Steve for the suggestion, but this is not good since it requires
aTHX + PERL_SET_CONTEXT which creates a chicken and an egg problem. Any
other more suitable candidates to use instead of:
HvPMROOT(*Perl_Imodglobal_ptr(thx)) = (PMOP*)interp
?
It needs to be really quick, as we already have a way too many context
switch overheads in the perl-core.
Is all this messing around with hiding things in HvPMROOT because really
mod_perl 2 would like a private pointer of its own in the perl interpreter
structure?
No, it wants to have a reference from the current perl interpreter to
modperl_interp_t which is needed to be able to put the perl interpreter
back to the pool of interpreters and such.
struct modperl_interp_t {
modperl_interp_pool_t *mip;
PerlInterpreter *perl;
int num_requests;
U8 flags;
request_rec *request;
int refcnt;
#ifdef MP_TRACE
unsigned long tid;
#endif
};
Of course we could have created a special entry in modglobal and store it
there, but since the operation of reading and setting of modperl_interp_t
is very frequent, it must be very fast. I suppose Doug has chosen
HvPMROOT(*Perl_Imodglobal_ptr(thx)) as the quickest possible way to
accomplish that.
If you really really feel the need to cheat then you have the choice of these:
#define xhv_keys xiv_u.xivu_iv
typedef struct {
STRLEN xhv_fill; /* how full xhv_array currently is */
STRLEN xhv_max; /* subscript of last element of xhv_array */
union {
IV xivu_iv; /* integer value or pv offset */
UV xivu_uv;
void * xivu_p1;
} xiv_u;
MAGIC* xmg_magic; /* magic for scalar array */
HV* xmg_stash; /* class package */
} xpvhv_allocated;
Only xmg_magic and xmg_stash aren't needed for the operation of a regular hash.
I've no idea what modglobal_ptr gets used for throughout the perl codebase,
but hanging something that isn't MAGIC* from xmg_magic feels like a bad plan.
You mean because it might be used later on for some purpose? If so any
other ideas for a quick stash inside the interpreter that is not used by
perl itself? May be something else besides modglobal?
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]