Vacant-Address-Space.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <html lang="en">
  2. <head>
  3. <title>Vacant Address Space - avram - a virtual machine code interpreter</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="avram - a virtual machine code interpreter">
  6. <meta name="generator" content="makeinfo 4.13">
  7. <link title="Top" rel="start" href="index.html#Top">
  8. <link rel="up" href="Virtual-Code-Semantics.html#Virtual-Code-Semantics" title="Virtual Code Semantics">
  9. <link rel="prev" href="Interfaces-to-External-Code.html#Interfaces-to-External-Code" title="Interfaces to External Code">
  10. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  11. <meta http-equiv="Content-Style-Type" content="text/css">
  12. <style type="text/css"><!--
  13. pre.display { font-family:inherit }
  14. pre.format { font-family:inherit }
  15. pre.smalldisplay { font-family:inherit; font-size:smaller }
  16. pre.smallformat { font-family:inherit; font-size:smaller }
  17. pre.smallexample { font-size:smaller }
  18. pre.smalllisp { font-size:smaller }
  19. span.sc { font-variant:small-caps }
  20. span.roman { font-family:serif; font-weight:normal; }
  21. span.sansserif { font-family:sans-serif; font-weight:normal; }
  22. --></style>
  23. </head>
  24. <body>
  25. <div class="node">
  26. <a name="Vacant-Address-Space"></a>
  27. <p>
  28. Previous:&nbsp;<a rel="previous" accesskey="p" href="Interfaces-to-External-Code.html#Interfaces-to-External-Code">Interfaces to External Code</a>,
  29. Up:&nbsp;<a rel="up" accesskey="u" href="Virtual-Code-Semantics.html#Virtual-Code-Semantics">Virtual Code Semantics</a>
  30. <hr>
  31. </div>
  32. <h4 class="subsection">2.7.17 Vacant Address Space</h4>
  33. <p>Not every possible pattern has been used by the virtual machine as a way
  34. of encoding a function. The following patterns, where <var>a</var>,
  35. <var>b</var>, and <var>c</var> are non-<code>nil</code> trees, do not
  36. represent anything useful.
  37. <dl>
  38. <dt>unary forms<dd><code>((nil,nil),((nil,nil),(nil,((nil,</code><var>a</var><code>),nil))))</code><br>
  39. <code>((nil,nil),((nil,nil),(nil,(nil,(nil,</code><var>a</var><code>)))))</code>
  40. <br><dt>binary forms<dd><code>((nil,nil),((nil,nil),(</code><var>a</var><code>,</code><var>b</var><code>)))</code><br>
  41. <code>((nil,nil),((</code><var>a</var><code>,nil),(</code><var>b</var><code>,nil)))</code><br>
  42. <code>((nil,nil),((</code><var>a</var><code>,nil),(nil,</code><var>b</var><code>)))</code>
  43. <br><dt>ternary forms<dd><code>((nil,nil),((</code><var>a</var><code>,</code><var>b</var><code>),(</code><var>c</var><code>,nil)))</code><br>
  44. <code>((nil,nil),((</code><var>a</var><code>,</code><var>b</var><code>),(nil,</code><var>c</var><code>)))</code><br>
  45. <code>((nil,nil),((</code><var>a</var><code>,nil),(</code><var>b</var><code>,</code><var>c</var><code>)))</code><br>
  46. <code>((nil,nil),((nil,</code><var>a</var><code>),(</code><var>b</var><code>,</code><var>c</var><code>)))</code>
  47. </dl>
  48. <p class="noindent">These patterns are detected by the virtual machine simply to avoid blowing
  49. it up, but they always cause an error message to be reported.
  50. <a name="index-g_t_0040code_007bunsupported-hook_007d-386"></a><a name="index-g_t_0040code_007bunrecognized-combinator_007d-387"></a>
  51. <dl>
  52. <dt><em>P55</em><dd>For <var>f</var> matching any of the first three trees in the above list,<br>
  53. &nbsp;<!-- /@w -->&nbsp;<!-- /@w -->&nbsp;<!-- /@w --><var>f</var><code>_</code><var>n</var> <var>x</var><code>_</code><var>n</var> =
  54. [[<code>('unsupported hook',nil)</code>]]<code>_(</code><var>n</var><code>+1)</code>
  55. <br><dt><em>P56</em><dd>For the remaining trees <var>f</var> in the above list,<br>
  56. &nbsp;<!-- /@w -->&nbsp;<!-- /@w -->&nbsp;<!-- /@w --><var>f</var><code>_</code><var>n</var> <var>x</var><code>_</code><var>n</var> =
  57. [[<code>('unrecognized combinator (code </code><var>m</var><code>)',nil)</code>]]<code>_(</code><var>n</var><code>+1)</code>
  58. </dl>
  59. <p class="noindent">Here, <var>m</var> is a numeric constant dependent on which tree
  60. <var>f</var> was used. The unsupported hook message is meant to be
  61. more informative than the unrecognized combinator message, suggesting
  62. that a feature intended for future use is not yet available.
  63. <p>This list has been assembled for the benefit of readers considering the
  64. addition of backward compatible extensions to the virtual code
  65. semantics, who are undeterred by the facts that
  66. <ul>
  67. <li>the computational model
  68. <a name="index-universality-388"></a>is already universal
  69. <li>virtual code applications are already
  70. interoperable with all kinds of high performance software having a text
  71. based or console interface by way of the <code>interact</code> combinator
  72. <li>an unlimited number of built in library functions can be added
  73. by way of the <code>library</code> combinator as described in
  74. <a href="Implementing-new-library-functions.html#Implementing-new-library-functions">Implementing new library functions</a>
  75. <li>the C code in <code>avram</code> makes fairly
  76. <a name="index-pointers-389"></a>intricate use of pointers with a careful policy of reference counting
  77. and storage reclamation
  78. <li>there is also a performance penalty incurred by
  79. <a name="index-reference-count-390"></a>further extensions to the semantics, even for applications that don't
  80. use them, because a pattern recognition algorithm in the interpreter has
  81. more cases to consider.
  82. </ul>
  83. <p>Nevertheless, a new functional form combining a pair of functions to be
  84. interpreted in a new way by the virtual machine could be defined using
  85. any of the binary forms above, for example, with <var>a</var> as the
  86. virtual code for one of the functions and <var>b</var> as that of the
  87. other. Such a form would not conflict with any existing applications,
  88. provided that both <var>a</var> and <var>b</var> are not <code>nil</code>,
  89. which is true of any valid representation for a function.
  90. <p>Virtual machine architects, take note. There are infinitely many trees
  91. <a name="index-trees-391"></a>fitting these patterns, but it would be possible to use them up by
  92. assigning them without adequate foresight. For example, if
  93. interpretations were assigned to the four ternary forms, the three binary
  94. forms, and one of the remaining unary forms, then the only
  95. unassigned pattern could be of the form
  96. <pre class="display"> <code>((nil,nil),((nil,nil),(nil,(nil,(nil,</code><var>a</var><code>)))))</code>
  97. </pre>
  98. <p class="noindent">Assigning an interpretation to it would leave no further room for
  99. backward compatible expansion. On the other hand, any tree of the
  100. following form also fits the above pattern,
  101. <pre class="display"> <code>((nil,nil),((nil,nil),(nil,(nil,(nil,(</code><var>b</var><code>,</code><var>c</var><code>))))))</code>
  102. </pre>
  103. <p class="noindent">with any values for <var>b</var> and <var>c</var>. Different
  104. meanings could be chosen for the case where both are <code>nil</code>, both
  105. are non-<code>nil</code>, or one is <code>nil</code> and the other non-<code>nil</code>,
  106. allowing two unary forms, one binary, and one constant. If at least one
  107. of these patterns is reserved for future enhancements, then a
  108. potentially inexhaustible supply of address space remains and there will
  109. be no need for incompatible changes later.
  110. </body></html>