develooper Front page | perl.perl5.porters | Postings from September 2014

Re: PL_comppad_name at run time?

Thread Previous
Dave Mitchell
September 24, 2014 11:34
Re: PL_comppad_name at run time?
Message ID:
On Wed, Sep 24, 2014 at 09:17:31AM +0200, Rafael Garcia-Suarez wrote:
> On 23 September 2014 17:38, Father Chrysostomos <> wrote:
> > Currently we set up PL_curpad to point to the sub’s pad in
> > pp_entersub.  But anything that needs to access the name pad (only
> > lexical subs, I think) has to call find_runcv, which searches the call
> > stack, and then extract the name pad from it.
> >
> > If we introduce lvalue references (which I am working on now), lexical
> > scalars and state variables will have to access the name pad.  That
> > will slow things down considerably.
> >
> > I know that pp_entersub avoids unnecessary work because it is very hot
> > code, but I think that having it set PL_comppad_name (or maybe a new
> > PL_curpad_name) would be a reasonable tradeoff.
> >
> > Thoughts?
> I'm tempted to say that this ship has already sailed, and thus go for it.
> I think the tradeoff is ok, because of the potential benefits of lvalue
> references.

Without having looked too closely at it, if we're going to the bother
of setting/restoring an extra var for each sub call, I suspect we'd
be better off recording the current executing CV rather than the current
namepad, since the latter can be derived from the former, and the former
may be useful for other stuff too (basically anywhere which currently
calls find_runcv).

I also wonder if, when we always know the current running CV, whether we
still need to set/restore PL_comppad on each sub call, and instead just
derive it when necessary from PL_compcv. But its so long since I messed in
that area that I can't remember how much PL_comppad used at run time.

Spock (or Data) is fired from his high-ranking position for not being able
to understand the most basic nuances of about one in three sentences that
anyone says to him.
    -- Things That Never Happen in "Star Trek" #19

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About