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

Interesting self contained task

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
February 11, 2008 02:53
Subject:
Interesting self contained task
Message ID:
20080211105346.GV23790@plum.flirble.org
On Mon, Feb 11, 2008 at 02:45:04AM -0800, Nicholas Clark wrote:
> Change 33277 by nicholas@nicholas-plum on 2008/02/11 10:43:35
> 
> 	In Perl_ck_lengthconst, "XXX length optimization goes here" is TODO.

So I spotted this:

OP *
Perl_ck_lengthconst(pTHX_ OP *o)
{
    /* XXX length optimization goes here */
    return ck_fun(o);
}

I figure it relates to this:

$ /usr/bin/perl -MO=Concise -e 'length "Pie"'
5  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 1 -e:1) v ->3
4     <1> length[t1] vK/1 ->5
3        <$> const[PV "Pie"] s ->4
-e syntax OK


in that it ought to be possible to replace the pair of op length/op const with
just an op const. (Presumably by re-using the existing op const)

This looks to be small, self-contained and interesting*

Anyone fancy having a go?

Nicholas Clark

* For some value of interesting. If you suspect that it's not interesting, you
  probably won't find it fun either.

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