develooper Front page | perl.perl5.porters | Postings from December 2007

Re: optimising opcodes

Thread Previous | Thread Next
Paul Johnson
December 26, 2007 02:11
Re: optimising opcodes
Message ID:
On Mon, Dec 24, 2007 at 07:25:18PM +0000, Nicholas Clark wrote:

> So I wondered:
> 0: How hard would it be to write some code to take an optree, and copy out all
>    the live ops into a new optree, skipping any nulled out ops?
> 1: Would that break the runtime?

I don't /think/ so.

> 5: How do you spot code executed only once, and avoid doing this?
>    (main program, eval blocks, top level code from do/require/use,
>     BEGIN/UNITCHECK/CHECK/INIT/END - ie basically anything not a "real"
>     subroutine definition)

This might break Devel:Cover.  This might not be important.

> 6: Is the op_opt flag bit free at this point? Does having a bit help?

I believe so.  And a spare bit is always helpful.  IIRC Dave used three
of them recently, leaving just three bits in op_spare.  Though it's not
clear to me how useful the bit would be at this stage.

Note that doing this would reduce the accuracy of some error messages.
In particular, we can get some line number information from nullops, and
whilst nothing would /break/ if the nullops weren't there (in this
sense), some line numbers would be reported incorrectly.

Unless that information could be copied somehow as the nullops were
removed.  This fits in with a discussion we were having previously about
including line numbers (and filenames) in more ops.

Paul Johnson -

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