📄 ch08_12.htm
字号:
<html><head><title>B::Bytecode (Perl in a Nutshell, 2nd Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Stephen Spainhour" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly & Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="0596002416L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="Perl in a Nutshell, 2nd Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Java and XSLT" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch08_11.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="ch08_13.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">8.12. B::Bytecode</h2><p><a name="INDEX-1289" />The bytecode backend for the Perlcompiler. Takes Perl source code and generates platform-independentbytecode that can be run with the <em class="emphasis">byteperl</em>executable or can be loaded via the <tt class="literal">byteload_fh</tt>function in the B module. Compiling with the bytecode backendwon't speed up execution of your program, but it mayimprove start-up time. Invoke as:</p><blockquote><pre class="code">perl -MO=Bytecode[,<em class="replaceable"><tt>options</em>] <em class="replaceable">program</tt></em></pre></blockquote><p>in which <em class="replaceable"><tt>program</tt></em> is the name of the Perlscript to compile. Any non-option arguments are treated as the namesof objects to be saved; the main program is assumed if there are noextra arguments. Possible options are:</p><dl><dt><i> <em class="emphasis">--</em> </i></dt><dd>Forces end of options.</p></dd><dt><i><em class="emphasis">-Dopts</em></i></dt><dd>Debug options, which can be concatenated or specified separately.Possible options are:</p><dl><dt><b><tt class="literal">a</tt></b></dt><dd>Tells the bytecode assembler to include assembler source in itsoutput as bytecode comments</p></dd><dt><b><tt class="literal">b</tt></b></dt><dd>Prints debugging information about bytecompiler progress</p></dd><dt><b><tt class="literal">C</tt></b></dt><dd>Prints each CV from the final walk through the symbol tree</p></dd><dt><b><tt class="literal">o</tt></b></dt><dd>Prints each OP as it's processed</p></dd></dl></dd><dt><i><em class="emphasis">-fopt</em></i></dt><dd>Forces individual optimizations on or off. Preceding an optimizationwith <tt class="literal">no-</tt> turns that option off (e.g.,<tt class="literal">no-compress-nullops</tt>). Possible values of<em class="emphasis">opt</em> are:</p><dl><dt><b><tt class="literal">bypass-nullops</tt></b></dt><dd>If <tt class="literal">op->op_next</tt> ever points to a NULLOP,replaces the <tt class="literal">op_next</tt> field with the firstnon-NULLOP in the path of execution.</p></dd><dt><b><tt class="literal">compress-nullops</tt></b></dt><dd>Fills in only the necessary fields of ops that have been optimizedaway by Perl's internal compiler.</p></dd><dt><b><tt class="literal">omit-sequence-numbers</tt></b></dt><dd>Leaves out the code to fill in the <tt class="literal">op_seq</tt> fieldfor all ops that are used only by Perl's internalcompiler.</p></dd><dt><b><tt class="literal">strip-syntax-tree</tt></b></dt><dd>Leaves out the code to fill in the internal syntax tree pointers. Useof this option breaks any <tt class="literal">goto</tt><em class="replaceable"><tt>label</tt></em> statements and prevents laterrecompiling or disassembling of the resulting program.</p></dd></dl></dd><dt><i><em class="emphasis">-m</em></i></dt><dd>Compiles as a module rather than as a standalone program.</p></dd><dt><i><em class="emphasis">-ofilename</em></i></dt><dd>Sends output to <em class="emphasis">filename</em> instead of STDOUT.</p></dd><dt><i><em class="emphasis">-O[</em><em class="replaceable"><tt>n</em><em class="emphasis">]</tt></em></i></dt><dd>Sets the optimization level to <em class="replaceable"><tt>n</tt></em>, in inwhich <em class="replaceable"><tt>n</tt></em> is an integer.<em class="replaceable"><tt>n</tt></em> defaults to <tt class="literal">1</tt>.<tt class="literal">-O1</tt> sets <tt class="literal">-fcompress-nullops-fomit-sequence-numbers</tt>, and <tt class="literal">-O6</tt> adds<tt class="literal">-fstrip-syntax-tree</tt>.</p></dd><dt><i><em class="emphasis">-S</em></i></dt><dd>Outputs bytecode assembler source instead of assembling it intobytecode.</p></dd></dl><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch08_11.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td align="right" valign="top" width="228"><a href="ch08_13.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">8.11. B::Bblock</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td align="right" valign="top" width="228">8.13. B::C</td></tr></table></div><hr width="684" align="left" /><img src="../gifs/navbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links" /><p><p><font size="-1"><a href="copyrght.htm">Copyright © 2002</a> O'Reilly & Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -