<ulclass="crumbs"><li><ahref="../index.html">Home</a></li><li><ahref="../compiler.html">Services</a></li><li><ahref="index.html">arch</a></li><li><ahref="index.html#P">Preliminaries</a></li><li><b>What This Module Does</b></li></ul></div>
<pclass="commentary firstcommentary"><aid="SP1"class="paragraph-anchor"></a><b>§1. Prerequisites. </b>The arch module is a part of the Inform compiler toolset. It is
presented as a literate program or "web". Before diving in:
</p>
<ulclass="items"><li>(a) It helps to have some experience of reading webs: see <ahref="../../../inweb/docs/index.html"class="internal">inweb</a> for more.
</li><li>(b) The module is written in C, in fact ANSI C99, but this is disguised by the
fact that it uses some extension syntaxes provided by the <ahref="../../../inweb/docs/index.html"class="internal">inweb</a> literate
programming tool, making it a dialect of C called InC. See <ahref="../../../inweb/docs/index.html"class="internal">inweb</a> for
full details, but essentially: it's C without predeclarations or header files,
and where functions have names like <spanclass="extract"><spanclass="extract-syntax">Tags::add_by_name</span></span> rather than <spanclass="extract"><spanclass="extract-syntax">add_by_name</span></span>.
</li><li>(c) This module uses other modules drawn from the <ahref="../compiler.html"class="internal">compiler</a>, and also
uses a module of utility functions called <ahref="../../../inweb/docs/foundation-module/index.html"class="internal">foundation</a>.
For more, see <ahref="../../../inweb/docs/foundation-module/P-abgtf.html"class="internal">A Brief Guide to Foundation (in foundation)</a>.
<pclass="commentary firstcommentary"><aid="SP2"class="paragraph-anchor"></a><b>§2. Architecture versus VM. </b>The Inform 7 build process ultimately wants to make code for some target
virtual machine — traditionally, the Z or Glulx machines. But it does this
in two stages: first generating abstract Inter code, then further generating
VM code from that.
</p>
<pclass="commentary">It's an appealing notion that this first stage might be VM-independent: that
is, that <ahref="../inform7/index.html"class="internal">inform7</a> could generate the same Inter code regardless of the
final VM, and that only the second stage would vary according to target.
And this is nearly true, but not quite. There are (currently) two reasons
why not:
</p>
<ulclass="items"><li>(a) <ahref="../inform7/index.html"class="internal">inform7</a> has to generate different code if integers are 16 rather
than 32 bits wide, and
</li><li>(b) it also generates different code with debugging enabled than without.
</li></ul>
<pclass="commentary">Reason (b) could be avoided, at some cost in complexity, but reason (a) is
something we cannot sensibly avoid without making Inter a much higher-level
form of bytecode. Instead, we have "architectures" for Inter: for example,
32-bit with debugging enabled is the <spanclass="extract"><spanclass="extract-syntax">32d</span></span> architecture. See <ahref="2-arc.html"class="internal">Architectures</a>;
if ever we introduce a 64-bit VM, that will need new architectures, and
<pclass="commentary firstcommentary"><aid="SP3"class="paragraph-anchor"></a><b>§3. </b>A <ahref="2-tvm.html#SP1"class="internal">target_vm</a> object, on the other hand, represents an actual choice of
<pclass="commentary">Each VM can be used with just one architecture: use the function
<ahref="2-tvm.html#SP10"class="internal">TargetVMs::get_architecture</a> to obtain this. It might seem reasonable
to say that Glulx ought to be viable with both <spanclass="extract"><spanclass="extract-syntax">32</span></span> and <spanclass="extract"><spanclass="extract-syntax">32d</span></span> architectures,
but in fact "Glulx" is not a single virtual machine but a family of them.
A specific member of this family would be the <ahref="2-tvm.html#SP1"class="internal">target_vm</a> representing
Glulx version 3.1.2 with debugging enabled, and that can be used with the
<spanclass="extract"><spanclass="extract-syntax">32d</span></span> but not the <spanclass="extract"><spanclass="extract-syntax">32</span></span> architecture.
</p>
<pclass="commentary">There can in principle be numerous VMs in any given family; see
<ahref="2-tvm.html#SP6"class="internal">TargetVMs::find_in_family</a> to obtain family members with given behaviour,
and in general see <ahref="2-tvm.html"class="internal">Target Virtual Machines</a> for more.
<pclass="commentary firstcommentary"><aid="SP4"class="paragraph-anchor"></a><b>§4. Compatibility. </b>Not all software in the Inform stack — source text from the user, extensions,