Diff of /impnotes/bytecode-design.html [6e6002] .. [fd4e91] Maximize Restore

  Switch to side-by-side view

--- a/impnotes/bytecode-design.html
+++ b/impnotes/bytecode-design.html
@@ -1,35 +1,36 @@
-<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
-<html xmlns="http://www.w3.org/1999/xhtml"><head><title>33.6. Bytecode Design</title><link rel="stylesheet" href="impnotes.css" type="text/css"/><link rev="made" href="mailto:clisp-list@sf.net"/><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"/><link rel="home" href="index.html" title="Implementation Notes for GNU CLISP."/><link rel="up" href="bytecode.html" title="Chapter 33. The CLISP bytecode specification"/><link rel="previous" href="intr-set.html" title="33.5. The instruction set"/><link rel="next" href="gfdl.html" title="Appendix A. GNU Free Documentation License"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">33.6. Bytecode Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="intr-set.html">Prev</a> </td><th width="60%" align="center">Chapter 33. The <b class="command">CLISP</b> bytecode specification</th><td width="20%" align="right"> <a accesskey="n" href="gfdl.html">Next</a></td></tr></table><hr/></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bytecode-design"/>33.6. Bytecode Design</h2></div></div><div/></div><div class="toc"><dl><dt>33.6.1. <a href="bytecode-design.html#byte-when-add-q">When to add a new bytecode?</a></dt><dt>33.6.2. <a href="bytecode-design.html#byte-jmptail-q">Why JMPTAIL?</a></dt></dl></div><p>This section offers some insight into bytecode design in the form
- of questions and answers.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="byte-when-add-q"/>33.6.1. When to add a new bytecode?</h3></div></div><div/></div><div class="abstract"><p class="title"><b>Question:</b></p><p>Does it make sense to define a new bytecode instruction for
-   <a href="http://www.lisp.org/HyperSpec/Body/mac_restart-case.html" target="_top"><tt class="function">RESTART-CASE</tt></a>? Why? Why not?</p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="byte-when-add-a"/>Answer: Is it speed critical?</h4></div></div><div/></div><p><a href="http://www.lisp.org/HyperSpec/Body/mac_restart-case.html" target="_top"><tt class="function">RESTART-CASE</tt></a> is a glorified <a href="http://www.lisp.org/HyperSpec/Body/speope_letcm_letst.html" target="_top"><tt class="function">LET</tt></a> binding
-   for <tt class="varname">SYSTEM::*ACTIVE-RESTARTS*</tt> and could well profit
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>36.6. Bytecode Design</title><link rel="stylesheet" href="impnotes.css" type="text/css" /><link rev="made" href="mailto:clisp-list@sf.net" /><meta name="generator" content="DocBook XSL Stylesheets V2005-07-12_04:47_snapshot" /><link rel="start" href="index.html" title="Implementation Notes for GNU CLISP." /><link rel="up" href="bytecode.html" title="Chapter 36. The CLISP bytecode specification" /><link rel="prev" href="intr-set.html" title="36.5. The instruction set" /><link rel="next" href="gfdl.html" title="Appendix 1. GNU Free Documentation License" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">36.6. Bytecode Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="intr-set.html">Prev</a> </td><th width="60%" align="center">Chapter 36. The <span><strong class="command">CLISP</strong></span> bytecode specification</th><td width="20%" align="right"> <a accesskey="n" href="gfdl.html">Next</a></td></tr></table><hr /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bytecode-design"></a>36.6. Bytecode Design</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="bytecode-design.html#byte-when-add-q">36.6.1. When to add a new bytecode?</a></span></dt><dt><span class="section"><a href="bytecode-design.html#byte-jmptail-q">36.6.2. Why JMPTAIL?</a></span></dt></dl></div><p>This section offers some insight into bytecode design in the form
+ of questions and answers.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="byte-when-add-q"></a>36.6.1. When to add a new bytecode?</h3></div></div></div><div class="abstract"><p class="title"><b>Question:</b></p><p>Does it make sense to define a new bytecode instruction for
+   <a href="http://www.lisp.org/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a>? Why? Why not?</p></div><div class="simplesect" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="byte-when-add-a"></a>Answer: Is it speed critical?</h4></div></div></div><p><a href="http://www.lisp.org/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> is a glorified <a href="http://www.lisp.org/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> binding
+   for <code class="varname">SYSTEM::*ACTIVE-RESTARTS*</code> and could well profit
    from a separate bytecode: it would make it non-<a href="http://www.lisp.org/HyperSpec/Body/glo_c.html#cons" target="_top">consing[3]</a>.
-   (Remember that <a href="http://www.lisp.org/HyperSpec/Body/syscla_restart.html" target="_top"><tt class="classname">RESTART</tt></a>s have dynamic extent and therefore do not
-   really need to be heap allocated.)</p><p>The reason <a href="http://www.lisp.org/HyperSpec/Body/mac_handler-bind.html" target="_top"><tt class="function">HANDLER-BIND</tt></a> has its own bytecodes and
-   <a href="http://www.lisp.org/HyperSpec/Body/mac_restart-case.html" target="_top"><tt class="function">RESTART-CASE</tt></a> does not is that <a href="http://www.lisp.org/HyperSpec/Body/mac_handler-bind.html" target="_top"><tt class="function">HANDLER-BIND</tt></a> can occur in inner
-   computation loops, whereas <a href="http://www.lisp.org/HyperSpec/Body/mac_restart-case.html" target="_top"><tt class="function">RESTART-CASE</tt></a> occurs only as part of
+   (Remember that <a href="http://www.lisp.org/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s have dynamic extent and therefore do not
+   really need to be heap allocated.)</p><p>The reason <a href="http://www.lisp.org/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a> has its own bytecodes and
+   <a href="http://www.lisp.org/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> does not is that <a href="http://www.lisp.org/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a> can occur in inner
+   computation loops, whereas <a href="http://www.lisp.org/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> occurs only as part of
    user-interface programming and therefore not in inner loops where its
-   consing could hurt much.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="byte-jmptail-q"/>33.6.2. Why <a href="intr-set.html#instr-jump" title="33.5.5. Instructions for control flow, jumps">JMPTAIL</a>?</h3></div></div><div/></div><div class="abstract"><p class="title"><b>Question:</b></p><p>Consider this function and its disassembly:</p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting">
+   consing could hurt much.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="byte-jmptail-q"></a>36.6.2. Why <a href="intr-set.html#instr-jump" title="36.5.5. Instructions for control flow, jumps">JMPTAIL</a>?</h3></div></div></div><div class="abstract"><p class="title"><b>Question:</b></p><p>Consider this function and its disassembly:</p><pre class="programlisting">
  (defun foo (x y) (if (or (= x 0) (= y 0)) (+ x y) (foo y (1- x))))
- (<a href="http://www.lisp.org/HyperSpec/Body/fun_disassemble.html" target="_top"><tt class="function">DISASSEMBLE</tt></a> 'foo)
+ (<a href="http://www.lisp.org/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> 'foo)
 8     (LOAD&amp;PUSH 1)
 9     (LOAD&amp;DEC&amp;PUSH 3)
 11    (JMPTAIL 2 5 L0)
-    </pre></td></tr></table><p>
-    Why are the arguments pushed onto the <a href="vm.html" title="33.2. The virtual machine"><tt class="literal">STACK</tt></a>, just to be popped off of
-    it during the <tt class="byte">JMPTAIL</tt>?
-    Why not a sequence of <tt class="byte">LOAD</tt>,
-    <tt class="byte">STORE</tt> and
-    <tt class="byte">SKIP</tt> instructions
-    followed by a <tt class="byte">JMP</tt>?
- </p></div><div class="simplesect" lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="byte-jmptail-a"/>Answer: This is a shortcut for the most common use.</h4></div></div><div/></div><p>Using <tt class="byte">JMPTAIL</tt> requires 3
-   instructions, <tt class="byte">JMP</tt> requires more.
-   When <tt class="byte">JMPTAIL</tt> needs to be called, we
-   usually have some stuff close to the top of the <a href="vm.html" title="33.2. The virtual machine"><tt class="literal">STACK</tt></a> which will
+    </pre><p>
+    Why are the arguments pushed onto the <a href="vm.html" class="olink"><code class="literal">STACK</code></a>, just to be popped off of
+    it during the <span class="byte"><code class="literal">JMPTAIL</code></span>?
+    Why not a sequence of <span class="byte"><code class="literal">LOAD</code></span>,
+    <span class="byte"><code class="literal">STORE</code></span> and
+    <span class="byte"><code class="literal">SKIP</code></span> instructions
+    followed by a <span class="byte"><code class="literal">JMP</code></span>?
+ </p></div><div class="simplesect" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="byte-jmptail-a"></a>Answer: This is a shortcut for the most common use.</h4></div></div></div><p>Using <span class="byte"><code class="literal">JMPTAIL</code></span> requires 3
+   instructions, <span class="byte"><code class="literal">JMP</code></span> requires more.
+   When <span class="byte"><code class="literal">JMPTAIL</code></span> needs to be called, we
+   usually have some stuff close to the top of the <a href="vm.html" class="olink"><code class="literal">STACK</code></a> which will
    become the new arguments, and some junk between these new arguments
-   and the closure object.  <tt class="byte">JMPTAIL</tt>
-   removes the junk.  <tt class="byte">JMPTAIL</tt> is a
+   and the closure object.  <span class="byte"><code class="literal">JMPTAIL</code></span>
+   removes the junk.  <span class="byte"><code class="literal">JMPTAIL</code></span> is a
    convenient shortcut which shortens the bytecode - because typically
-   one would really have to clean-up the <a href="vm.html" title="33.2. The virtual machine"><tt class="literal">STACK</tt></a> by hand or make the
-   calculations in <tt class="filename">compiler.lisp</tt> more complicated.
-</p></div></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="intr-set.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bytecode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="gfdl.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">33.5. The instruction set </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix A. GNU Free Documentation License</td></tr></table></div><div class="custom-footer"><hr width="100%"/><table width="100%"><tr><td align="left"><a href="http://clisp.cons.org"><img src="clisp.png" width="48" height="48" alt="[CLISP home]"/></a></td><td align="center"><a href="http://www.gnu.org"><img src="http://www.gnu.org/graphics/gnubanner.jpg" width="468" height="60" alt="[Come and see what GNU creates for YOU]"/></a></td><td align="right"><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=1355&amp;amp;type=2" width="125" height="37" alt="[SourceForge]"/></a></td></tr></table></div></body></html>
+   one would really have to clean-up the <a href="vm.html" class="olink"><code class="literal">STACK</code></a> by hand or make the
+   calculations in <code class="filename">compiler.lisp</code> more complicated.
+</p></div></div></div><div class="bookinfo"><hr width="100%" /><table width="100%" summary="impnotes meta info"><th><td align="left">These notes document <a href="http://clisp.cons.org" target="_top"><span><strong class="command">CLISP</strong></span></a> version 2.34.</td><td align="right">Last modified: 2005-07-20</td></th></table></div><div class="custom-footer"><hr width="100%" /><table width="100%"><tr><td align="left"><a href="http://clisp.cons.org"><img src="clisp.png" width="48" height="48" alt="[CLISP home]" /></a></td><td align="center"><a href="http://www.gnu.org"><img src="http://www.gnu.org/graphics/gnubanner.jpg" width="468" height="60" alt="[Come and see what GNU creates for YOU]" /></a></td><td align="right"><a href="http://sourceforge.net"><img width="125" height="37" alt="[SourceForge]" src="http://sflogo.sourceforge.net/sflogo.php?group_id=1355&amp;type=2&amp;page=bytecode-design" /></a></td></tr></table></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="intr-set.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bytecode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="gfdl.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">36.5. The instruction set </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix 1. GNU Free Documentation License</td></tr></table></div></body></html>