Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

perlman:B::Bytecode

by root (Scribe)
on Dec 23, 1999 at 00:50 UTC ( #1154=perlfunc: print w/replies, xml ) Need Help??

B::Bytecode

See the current Perl documentation for B::Bytecode.

Here is our local, out-dated (pre-5.6) version:


B::Bytecode - Perl compiler's bytecode backend



        perl -MO=Bytecode[,OPTIONS] foo.pl



This compiler backend takes Perl source and generates a platform-independent bytecode encapsulating code to load the internal structures perl uses to run your program. When the generated bytecode is loaded in, your program is ready to run, reducing the time which perl would have taken to load and parse your program into its internal semi-compiled form. That means that compiling with this backend will not help improve the runtime execution speed of your program but may improve the start-up time. Depending on the environment in which your program runs this may or may not be a help.

The resulting bytecode can be run with a special byteperl executable or (for non-main programs) be loaded via the byteload_fh function in the B module.


OPTIONS

If there are any non-option arguments, they are taken to be names of objects to be saved (probably doesn't work properly yet). Without extra arguments, it saves the main program.

-ofilename

Output to filename instead of STDOUT.

--

Force end of options.

-f

Force optimisations on or off one at a time. Each can be preceded by no- to turn the option off (e.g. -fno-compress-nullops).

-fcompress-nullops

Only fills in the necessary fields of ops which have been optimised away by perl's internal compiler.

-fomit-sequence-numbers

Leaves out code to fill in the op_seq field of all ops which is only used by perl's internal compiler.

-fbypass-nullops

If op->op_next ever points to a NULLOP, replaces the op_next field with the first non-NULLOP in the path of execution.

-fstrip-syntax-tree

Leaves out code to fill in the pointers which link the internal syntax tree together. They're not needed at run-time but leaving them out will make it impossible to recompile or disassemble the resulting program. It will also stop goto label statements from working.

-On

Optimisation level (n = 0, 1, 2, ...). -O means -O1. -O1 sets -fcompress-nullops -fomit-sequence numbers. -O6 adds -fstrip-syntax-tree.

-D

Debug options (concatenated or separate flags like perl -D).

-Do

Prints each OP as it's processed.

-Db

Print debugging information about bytecompiler progress.

-Da

Tells the (bytecode) assembler to include source assembler lines in its output as bytecode comments.

-DC

Prints each CV taken from the final symbol tree walk.

-S

Output (bytecode) assembler source rather than piping it through the assembler and outputting bytecode.

-m

Compile as a module rather than a standalone program. Currently this just means that the bytecodes for initialising main_start, main_root and curpad are omitted.


EXAMPLES

        perl -MO=Bytecode,-O6,-o,foo.plc foo.pl

        perl -MO=Bytecode,-S foo.pl > foo.S
        assemble foo.S > foo.plc
        byteperl foo.plc

        perl -MO=Bytecode,-m,-oFoo.pmc Foo.pm


BUGS

Plenty. Current status: experimental.


AUTHOR

Malcolm Beattie, mbeattie@sable.ox.ac.uk


Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[1nickt]: I have been an apostate in the Apple orchard for almost 15 years. But Dells are still high quality it seems, unlike Macs these days.
[1nickt]: And you can still configure the system at will, on the "Small Business" site.
[Corion]: 1nickt: I bought a 2015 XPS 13, which is a very nice and shiney (and somewhat overpriced) machine, but I think it's still better priced than an Apple machine. Now it just has to hold up 10 years like the old one did ;)
[1nickt]: Ah, you got Linus' fave? With Ubuntu? 4k display?
[1nickt]: ( The 17" monster I just bought is for my wife, who doesn;t leave the house with it...)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2017-03-27 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.