develooper Front page | perl.perl5.porters | Postings from January 2014

Re: [perl #121077] [PATCH] Optimise 'my $x; my $y' into 'my ($x, $y)'

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
January 27, 2014 16:47
Subject:
Re: [perl #121077] [PATCH] Optimise 'my $x; my $y' into 'my ($x, $y)'
Message ID:
20140127164717.GI27210@iabyn.com
On Mon, Jan 27, 2014 at 10:27:47AM -0500, Matthew Horsfall (alh) wrote:
> But one final question.
> 
> In rpeep, sometimes ops are cleared manually:
> 
>  o->op_type = OP_NULL;
>  o->op_ppaddr = PL_ppaddr[OP_NULL];

That's just a one-off special case

> Other times:
> 
>   op_null(o);

That's for when the op is no longer needed, but is still linked to from
other ops.

> And still:
> 
>   op_free(o);

That's for when the op is no longer linked, and is what you should so in
this case.

> Or even:
> 
>   cop_free(o);

That's only used once in rpeep, and it probably should have been
op_free(), which calls cop_free().

> op_null() is basically the first variant but also sets o->op_targ =
> o->op_type before nulling.

That's so that later debugging, deparsing etc can determine what the op
was before it was optimised away.

-- 
"There's something wrong with our bloody ships today, Chatfield."
    -- Admiral Beatty at the Battle of Jutland, 31st May 1916.

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