develooper Front page | perl.perl5.porters | Postings from March 2015

Re: OP_SIGNATURE

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
March 4, 2015 14:52
Subject:
Re: OP_SIGNATURE
Message ID:
20150304145151.709007fa@shy.leonerd.org.uk
On Wed, 4 Mar 2015 13:35:57 +0000
"Paul \"LeoNerd\" Evans" <leonerd@leonerd.org.uk> wrote:

> If instead we can find a way to decompose the "signature" behaviour
> into a few smaller, simpler ops, can we not find a way to implement
> them just as efficiently, but now with greater flexibility to be able
> to reuse those ops elsewhere, or in new combinations?

E.g. a random thought: I notice that the OP_SIGNATURE has a generic way
to say the default value of an arg is some IV stored in the optree, and
also two specific cases for the (presumably common) cases of zero and
one, possibly to cut down on the extra pointer reference overhead in
fetching the IV. All well and good.

But maybe instead we want an OP_ZERO operator, that sets its TARG to be
a zero IV? That could be used in its place in whatever new optree shape
we make the signature-parsing code; but *also* the peephole optimiser
can now use that where-ever it finds an OP_SASSIGN(OP_CONST zero)
combination. Now any occurance of

  $foo = 0

becomes more optimised, not just those ones appearing in signatures.

This is one example of the kind of thing I'm thinking here - this
OP_SIGNATURE has far too much special-casing of things like this, that
could help in other places that currently it can't reach.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk
http://www.leonerd.org.uk/  |  https://metacpan.org/author/PEVANS

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