develooper Front page | perl.perl5.porters | Postings from July 2010

Re: [perl #76438] peephole optimiser could prune more dead code

Thread Previous
Nicholas Clark
July 11, 2010 03:17
Re: [perl #76438] peephole optimiser could prune more dead code
Message ID:
On Sun, Jul 11, 2010 at 10:35:05AM +0100, James Mastros wrote:

> I think what Nick was getting at, and certainly what I was getting at,
> was not that we should bypass get magic, but rather that, in marked
> blocks, it should be acceptable to not call get magic *when the output
> is not relevant*, and to cache the value of the get magic during that
> lexical scope, each execution.  That is, we assume that values act
> like values, and not like hidden accessors.  $! would still work, so
> long as we don't look at $! twice and expect it to change.  That is:

No, that's not what *I* was getting at. That's the entire thread that has gone
sideways from what I originally reported. What *I* reported was that:

$ ./perl -Ilib -MO=Deparse -e 'if ($a && "Pie" eq "Good") {print}'
if ($a and !1) {
    print $_;
-e syntax OK

ie there is provably dead code still in the optree - the print statement.

(Which could be removed by the optimiser, without any change to any semantic
of the language. ie it's 100% safe)

Nicholas Clark

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