1 ;;;; the representation of a lexical environment
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
14 #!-sb-fluid (declaim (inline internal-make-lexenv)) ; only called in one place
16 ;;; The LEXENV represents the lexical environment used for IR1 conversion.
17 ;;; (This is also what shows up as an ENVIRONMENT value in macroexpansion.)
18 #!-sb-fluid (declaim (inline internal-make-lexenv)) ; only called in one place
20 ;; FIXME: should probably be called MAKE-EMPTY-LEXENV or
22 (:constructor make-null-lexenv ())
23 (:constructor internal-make-lexenv
24 (functions variables blocks tags type-restrictions
25 lambda cleanup policy options)))
26 ;; Alist (NAME . WHAT), where WHAT is either a Functional (a local function),
27 ;; a DEFINED-FUNCTION, representing an INLINE/NOTINLINE declaration, or
28 ;; a list (MACRO . <function>) (a local macro, with the specifier
29 ;; expander.) Note that NAME may be a (SETF <name>) function.
30 (functions nil :type list)
31 ;; an alist translating variable names to LEAF structures. A special
32 ;; binding is indicated by a :SPECIAL GLOBAL-VAR leaf. Each special
33 ;; binding within the code gets a distinct leaf structure, as does
34 ;; the current "global" value on entry to the code compiled.
35 ;; (locally (special ...)) is handled by adding the most recent
36 ;; special binding to the front of the list.
38 ;; If the CDR is (MACRO . <exp>), then <exp> is the expansion of a
40 (variables nil :type list)
41 ;; BLOCKS and TAGS are alists from block and go-tag names to 2-lists
42 ;; of the form (<entry> <continuation>), where <continuation> is the
43 ;; continuation to exit to, and <entry> is the corresponding ENTRY node.
44 (blocks nil :type list)
46 ;; an alist (THING . CTYPE) which is used to keep track of
47 ;; "pervasive" type declarations. When THING is a leaf, this is for
48 ;; type declarations that pertain to the type in a syntactic extent
49 ;; which does not correspond to a binding of the affected name. When
50 ;; Thing is a continuation, this is used to track the innermost THE
52 (type-restrictions nil :type list)
53 ;; the lexically enclosing lambda, if any
55 ;; FIXME: This should be :TYPE (OR CLAMBDA NULL), but it was too hard
56 ;; to get CLAMBDA defined in time for the cross-compiler.
58 ;; the lexically enclosing cleanup, or NIL if none enclosing within Lambda
60 ;; FIXME: This should be :TYPE (OR CLEANUP NULL), but it was too hard
61 ;; to get CLEANUP defined in time for the cross-compiler.
63 ;; the current OPTIMIZE policy
64 (policy *policy* :type policy)
65 ;; an alist of miscellaneous options that are associated with the
66 ;; lexical environment
67 (options nil :type list))