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

Re: Perl_peep (was Re: Perl_linklist)

Thread Previous | Thread Next
From:
Reini Urban
Date:
November 27, 2008 08:57
Subject:
Re: Perl_peep (was Re: Perl_linklist)
Message ID:
6910a60811270857t5afd0943r43d80d7642a919dd@mail.gmail.com
2008/11/27 Nicholas Clark <nick@ccl4.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?"

We would need to split it into the mandatory internal peep function
for the fixups,
and at the end we need to call the hookable Perl_peep(), which should be just
empty in CORE.

BTW: optimizer.xs doesn't work yet anyway, because op_seq is gone, and
I have not enough time to finish the rewrite.
When the core patch is in, I can continue on optimizer-0.08

0.07  2008-07-14 18:28:32 Reini Urban <rurban@cpan.org>
	- fixes for 5.8.6 and lower: OPpITER_REVERSED
aha, not yet uploaded.

http://search.cpan.org/~rurban/optimizer-0.06/
0.06  2008-07-13 19:44:57 Reini Urban <rurban@cpan.org>
	- 5.10 and 5.11 patch, fixes for 5.8.8
	- Iop_seqmax and B::OP::seq workaround for 5.10 callbacks
	- added eg/pad.pl
	- added t/04-use.t
-- 
Reini Urban
http://phpwiki.org/              http://murbreak.at/

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