develooper Front page | perl.perl5.porters | Postings from November 2008

Re: Perl_peep (was Re: Perl_linklist)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
November 27, 2008 08:42
Subject:
Re: Perl_peep (was Re: Perl_linklist)
Message ID:
20081127164227.GF49335@plum.flirble.org
On Thu, Nov 27, 2008 at 12:26:51AM +0100, Vincent Pit wrote:
> 
> > ... which also means that it should probably not be public, if we
> > follow the logic that the optree construction should not be public;
> > Devel::BeginLift is already copying parts of op.c to do its magic.
> >
> >   
> 
> But isn't the optree construction already kind of public through the
> pluggable check functions ? They can alter it by replacing ops as they
> are created.

Um. Yes. Good point. Not sure.
Why are these pluggable?

> > To be consistent that would mean that Perl_peep() becomes static S_peep().
> > Which, at least, will cause optimizer.xs to fail to link.
> >   
> 
> If peep just does local optree optimizations, then I think it could also
> be made hookable à la optimizer.xs.

I hoped that someone else was going to reply to you, and do a better job than
this. peep() isn't just local optree optimisations. It also does some
mandatory op fixups. perltodo.pod says

=head2 optional optimizer

Make the peephole optimizer optional. Currently it performs two tasks as
it walks the optree - genuine peephole optimisations, and necessary fixups of
ops. It would be good to find an efficient way to switch out the
optimisations whilst keeping the fixups.

=cut

So right now it can't be hookable. I'm not the right person to answer
"what would need to be changed to make it hookable?"

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About