Initial revision
[sbcl.git] / doc / cmucl / internals / glossary.tex
1 \chapter{Glossary}% -*- Dictionary: int:design -*-
2
3 % Note: in an entry, any word that is also defined should be \it
4 % should entries have page references as well?
5
6 \begin{description}
7 \item[assert (a type)]
8 In Python, all type checking is done via a general type assertion
9 mechanism.  Explicit declarations and implicit assertions (e.g. the arg to
10 + is a number) are recorded in the front-end (implicit continuation)
11 representation.  Type assertions (and thus type-checking) are "unbundled"
12 from the operations that are affected by the assertion.  This has two major
13 advantages:
14 \begin{itemize}
15 \item Code that implements operations need not concern itself with checking
16 operand types.
17
18 \item Run-time type checks can be eliminated when the compiler can prove that
19 the assertion will always be satisfied.
20 \end{itemize}
21 See also {\it restrict}.
22
23 \item[back end] The back end is the part of the compiler that operates on the
24 {\it virtual machine} intermediate representation.  Also included are the
25 compiler phases involved in the conversion from the {\it front end}
26 representation (or {\it ICR}).
27
28 \item[bind node] This is a node type the that marks the start of a {\it lambda}
29 body in {\it ICR}.  This serves as a placeholder for environment manipulation
30 code.
31
32 \item[IR1] The first intermediate representation, also known as {\it ICR}, or
33 the Implicit Continuation Represenation.
34
35 \item[IR2] The second intermediate representation, also known as {\it VMR}, or
36 the Virtual Machine Representation.
37
38 \item[basic block] A basic block (or simply "block") has the pretty much the
39 usual meaning of representing a straight-line sequence of code.  However, the
40 code sequence ultimately generated for a block might contain internal branches
41 that were hidden inside the implementation of a particular operation.  The type
42 of a block is actually {\tt cblock}.  The {\tt block-info} slot holds an 
43 {\tt VMR-block} containing backend information.
44
45 \item[block compilation] Block compilation is a term commonly used to describe
46 the compile-time resolution of function names.  This enables many
47 optimizations.
48
49 \item[call graph]
50 Each node in the call graph is a function (represented by a {\it flow graph}.)
51 The arcs in the call graph represent a possible call from one function to
52 another.  See also {\it tail set}.
53
54 \item[cleanup]
55 A cleanup is the part of the implicit continuation representation that
56 retains information scoping relationships.  For indefinite extent bindings
57 (variables and functions), we can abandon scoping information after ICR
58 conversion, recovering the lifetime information using flow analysis.  But
59 dynamic bindings (special values, catch, unwind protect, etc.) must be
60 removed at a precise time (whenever the scope is exited.)  Cleanup
61 structures form a hierarchy that represents the static nesting of dynamic
62 binding structures.  When the compiler does a control transfer, it can use
63 the cleanup information to determine what cleanup code needs to be emitted.
64
65 \item[closure variable]
66 A closure variable is any lexical variable that has references outside of
67 its {\it home environment}.  See also {\it indirect value cell}.
68
69 \item[closed continuation] A closed continuation represents a {\tt tagbody} tag
70 or {\tt block} name that is closed over.  These two cases are mostly
71 indistinguishable in {\it ICR}.
72
73 \item[home] Home is a term used to describe various back-pointers.  A lambda
74 variable's "home" is the lambda that the variable belongs to.  A lambda's "home
75 environment" is the environment in which that lambda's variables are allocated.
76
77 \item[indirect value cell]
78 Any closure variable that has assignments ({\tt setq}s) will be allocated in an
79 indirect value cell.  This is necessary to ensure that all references to
80 the variable will see assigned values, since the compiler normally freely
81 copies values when creating a closure.
82
83 \item[set variable] Any variable that is assigned to is called a "set
84 variable".  Several optimizations must special-case set variables, and set
85 closure variables must have an {\it indirect value cell}.
86
87 \item[code generator] The code generator for a {\it VOP} is a potentially
88 arbitrary list code fragment which is responsible for emitting assembly code to
89 implement that VOP.
90
91 \item[constant pool] The part of a compiled code object that holds pointers to
92 non-immediate constants.
93
94 \item[constant TN]
95 A constant TN is the {\it VMR} of a compile-time constant value.  A
96 constant may be immediate, or may be allocated in the {\it constant pool}.
97
98 \item[constant leaf]
99 A constant {\it leaf} is the {\it ICR} of a compile-time constant value.
100
101 \item[combination]
102 A combination {\it node} is the {\it ICR} of any fixed-argument function
103 call (not {\tt apply} or {\tt multiple-value-call}.)  
104
105 \item[top-level component]
106 A top-level component is any component whose only entry points are top-level
107 lambdas.
108
109 \item[top-level lambda]
110 A top-level lambda represents the execution of the outermost form on which
111 the compiler was invoked.  In the case of {\tt compile-file}, this is often a
112 truly top-level form in the source file, but the compiler can recursively
113 descend into some forms ({\tt eval-when}, etc.) breaking them into separate
114 compilations.
115
116 \item[component] A component is basically a sequence of blocks.  Each component
117 is compiled into a separate code object.  With {\it block compilation} or {\it
118 local functions}, a component will contain the code for more than one function.
119 This is called a component because it represents a connected portion of the
120 call graph.  Normally the blocks are in depth-first order ({\it DFO}).
121
122 \item[component, initial] During ICR conversion, blocks are temporarily
123 assigned to initial components.  The "flow graph canonicalization" phase
124 determines the true component structure.
125
126 \item[component, head and tail]
127 The head and tail of a component are dummy blocks that mark the start and
128 end of the {\it DFO} sequence.  The component head and tail double as the root
129 and finish node of the component's flow graph.
130
131 \item[local function (call)]
132 A local function call is a call to a function known at compile time to be
133 in the same {\it component}.  Local call allows compile time resolution of the
134 target address and calling conventions.  See {\it block compilation}.
135
136 \item[conflict (of TNs, set)]
137 Register allocation terminology.  Two TNs conflict if they could ever be
138 live simultaneously.  The conflict set of a TN is all TNs that it conflicts
139 with.
140
141 \item[continuation]
142 The ICR data structure which represents both:
143 \begin{itemize}
144 \item The receiving of a value (or multiple values), and
145
146 \item A control location in the flow graph.
147 \end{itemize}
148 In the Implicit Continuation Representation, the environment is implicit in the
149 continuation's BLOCK (hence the name.)  The ICR continuation is very similar to
150 a CPS continuation in its use, but its representation doesn't much resemble (is
151 not interchangeable with) a lambda.
152
153 \item[cont] A slot in the {\it node} holding the {\it continuation} which
154 receives the node's value(s).  Unless the node ends a {\it block}, this also
155 implicitly indicates which node should be evaluated next.
156
157 \item[cost] Approximations of the run-time costs of operations are widely used
158 in the back end.  By convention, the unit is generally machine cycles, but the
159 values are only used for comparison between alternatives.  For example, the
160 VOP cost is used to determine the preferred order in which to try possible
161 implementations.
162     
163 \item[CSP, CFP] See {\it control stack pointer} and {\it control frame
164 pointer}.
165
166 \item[Control stack] The main call stack, which holds function stack frames.
167 All words on the control stack are tagged {\it descriptors}.  In all ports done
168 so far, the control stack grows from low memory to high memory.  The most
169 recent call frames are considered to be ``on top'' of earlier call frames.
170
171 \item[Control stack pointer] The allocation pointer for the {\it control
172 stack}.  Generally this points to the first free word at the top of the stack.
173
174 \item[Control frame pointer] The pointer to the base of the {\it control stack}
175 frame for a particular function invocation.  The CFP for the running function
176 must be in a register.
177
178 \item[Number stack] The auxiliary stack used to hold any {\it non-descriptor}
179 (untagged) objects.  This is generally the same as the C call stack, and thus
180 typically grows down.
181
182 \item[Number stack pointer] The allocation pointer for the {\it number stack}.
183 This is typically the C stack pointer, and is thus kept in a register.
184
185 \item[NSP, NFP] See {\it number stack pointer}, {\it number frame pointer}.
186
187 \item[Number frame pointer] The pointer to the base of the {\it number stack}
188 frame for a particular function invocation.  Functions that don't use the
189 number stack won't have an NFP, but if an NFP is allocated, it is always
190 allocated in a particular register.  If there is no variable-size data on the
191 number stack, then the NFP will generally be identical to the NSP.
192
193 \item[Lisp return address] The name of the {\it descriptor} encoding the
194 "return pc" for a function call.
195
196 \item[LRA] See {\it lisp return address}.  Also, the name of the register where
197 the LRA is passed.
198
199
200 \item[Code pointer] A pointer to the header of a code object.  The code pointer
201 for the currently running function is stored in the {\tt code} register.
202
203 \item[Interior pointer] A pointer into the inside of some heap-allocated
204 object.  Interior pointers confuse the garbage collector, so their use is
205 highly constrained.  Typically there is a single register dedicated to holding
206 interior pointers.
207
208 \item[dest]
209 A slot in the {\it continuation} which points the the node that receives this
210 value.  Null if this value is not received by anyone.
211
212 \item[DFN, DFO] See {\it Depth First Number}, {\it Depth First Order}.
213
214 \item[Depth first number] Blocks are numbered according to their appearance in
215 the depth-first ordering (the {\tt block-number} slot.)  The numbering actually
216 increases from the component tail, so earlier blocks have larger numbers.
217
218 \item[Depth first order] This is a linearization of the flow graph, obtained by
219 a depth-first walk.  Iterative flow analysis algorithms work better when blocks
220 are processed in DFO (or reverse DFO.)
221
222
223 \item[Object] In low-level design discussions, an object is one of the
224 following:
225 \begin{itemize}
226 \item a single word containing immediate data (characters, fixnums, etc)
227 \item a single word pointing to an object (structures, conses, etc.)
228 \end{itemize}
229 These are tagged with three low-tag bits as described in the section
230 \ref{tagging} This is synonymous with {\it descriptor}.
231 In other parts of the documentation, may be used more loosely to refer to a
232 {\it lisp object}.
233
234 \item[Lisp object]
235 A Lisp object is a high-level object discussed as a data type in the Common
236 Lisp definition.
237
238 \item[Data-block]
239 A data-block is a dual-word aligned block of memory that either manifests a
240 Lisp object (vectors, code, symbols, etc.) or helps manage a Lisp object on
241 the heap (array header, function header, etc.).
242
243 \item[Descriptor]
244 A descriptor is a tagged, single-word object.  It either contains immediate
245 data or a pointer to data.  This is synonymous with {\it object}.  Storage
246 locations that must contain descriptors are referred to as descriptor
247 locations.
248
249 \item[Pointer descriptor]
250 A descriptor that points to a {\it data block} in memory (i.e. not an immediate
251 object.)
252
253 \item[Immediate descriptor]
254 A descriptor that encodes the object value in the descriptor itself; used for
255 characters, fixnums, etc.
256
257 \item[Word]
258 A word is a 32-bit quantity.
259
260 \item[Non-descriptor]
261 Any chunk of bits that isn't a valid tagged descriptor.  For example, a
262 double-float on the number stack.  Storage locations that are not scanned by
263 the garbage collector (and thus cannot contain {\it pointer descriptors}) are
264 called non-descriptor locations.  {\it Immediate descriptors} can be stored in
265 non-descriptor locations.
266
267
268 \item[Entry point] An entry point is a function that may be subject to
269 ``unpredictable'' control transfers.  All entry points are linked to the root
270 of the flow graph (the component head.)  The only functions that aren't entry
271 points are {\it let} functions.  When complex lambda-list syntax is used,
272 multiple entry points may be created for a single lisp-level function.
273 See {\it external entry point}.
274
275 \item[External entry point] A function that serves as a ``trampoline'' to
276 intercept function calls coming in from outside of the component.  The XEP does
277 argument syntax and type checking, and may also translate the arguments and
278 return values for a locally specialized calling calling convention.
279
280 \item[XEP] An {\it external entry point}.
281
282 \item[lexical environment] A lexical environment is a structure that is used
283 during VMR conversion to represent all lexically scoped bindings (variables,
284 functions, declarations, etc.)  Each {\tt node} is annotated with its lexical
285 environment, primarily for use by the debugger and other user interfaces.  This
286 structure is also the environment object passed to {\tt macroexpand}.
287
288 \item[environment] The environment is part of the ICR, created during
289 environment analysis.  Environment analysis apportions code to disjoint
290 environments, with all code in the same environment sharing the same stack
291 frame.  Each environment has a ``{\it real}'' function that allocates it, and
292 some collection {\tt let} functions.   Although environment analysis is the
293 last ICR phase, in earlier phases, code is sometimes said to be ``in the
294 same/different environment(s)''.  This means that the code will definitely be
295 in the same environment (because it is in the same real function), or that is
296 might not be in the same environment, because it is not in the same function.
297
298 \item[fixup]  Some sort of back-patching annotation.  The main sort encountered
299 are load-time {\it assembler fixups}, which are a linkage annotation mechanism.
300
301 \item[flow graph] A flow graph is a directed graph of basic blocks, where each
302 arc represents a possible control transfer.  The flow graph is the basic data
303 structure used to represent code, and provides direct support for data flow
304 analysis.  See component and ICR.
305
306 \item[foldable] An attribute of {\it known functions}.  A function is foldable
307 if calls may be constant folded whenever the arguments are compile-time
308 constant.  Generally this means that it is a pure function with no side
309 effects.
310
311
312 FSC
313 full call
314 function attribute
315 function
316         "real" (allocates environment)
317         meaning function-entry
318         more vague (any lambda?)
319 funny function
320 GEN (kill and...)
321 global TN, conflicts, preference
322 GTN (number)
323 IR ICR VMR  ICR conversion, VMR conversion (translation)
324 inline expansion, call
325 kill (to make dead)
326 known function
327 LAMBDA
328 leaf
329 let call
330 lifetime analysis, live (tn, variable)
331 load tn
332 LOCS (passing, return locations)
333 local call
334 local TN, conflicts, (or just used in one block)
335 location (selection)
336 LTN (number)
337 main entry
338 mess-up (for cleanup)
339 more arg (entry)
340 MV
341 non-local exit
342 non-packed SC, TN
343 non-set variable
344 operand (to vop)
345 optimizer (in icr optimize)
346 optional-dispatch
347 pack, packing, packed
348 pass (in a transform)
349 passing 
350         locations (value)
351         conventions (known, unknown)
352 policy (safe, fast, small, ...)
353 predecessor block
354 primitive-type
355 reaching definition
356 REF
357 representation
358         selection
359         for value
360 result continuation (for function)
361 result type assertion (for template) (or is it restriction)
362 restrict
363         a TN to finite SBs
364         a template operand to a primitive type (boxed...)
365         a tn-ref to particular SCs
366
367 return (node, vops)
368 safe, safety
369 saving (of registers, costs)
370 SB
371 SC (restriction)
372 semi-inline
373 side-effect
374         in ICR
375         in VMR
376 sparse set
377 splitting (of VMR blocks)
378 SSET
379 SUBPRIMITIVE
380 successor block
381 tail recursion
382         tail recursive
383         tail recursive loop
384         user tail recursion
385
386 template
387 TN
388 TNBIND
389 TN-REF
390 transform (source, ICR)
391 type
392         assertion
393         inference
394                 top-down, bottom-up
395         assertion propagation
396         derived, asserted
397         descriptor, specifier, intersection, union, member type
398         check
399 type-check (in continuation)
400 UNBOXED (boxed) descriptor
401 unknown values continuation
402 unset variable
403 unwind-block, unwinding
404 used value (dest)
405 value passing
406 VAR
407 VM
408 VOP
409 XEP
410
411 \end{description}