0.6.9.6:
[sbcl.git] / src / compiler / lexenv.lisp
1 ;;;; the representation of a lexical environment
2
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
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.
11
12 (in-package "SB!C")
13
14 #!-sb-fluid (declaim (inline internal-make-lexenv)) ; only called in one place
15
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
19 (def!struct (lexenv
20              ;; FIXME: should probably be called MAKE-EMPTY-LEXENV or
21              ;; MAKE-NULL-LEXENV
22              (:constructor make-null-lexenv ())
23              (:constructor internal-make-lexenv
24                            (functions variables blocks tags type-restrictions
25                                       lambda cleanup cookie
26                                       interface-cookie options)))
27   ;; Alist (name . what), where What is either a Functional (a local function),
28   ;; a DEFINED-FUNCTION, representing an INLINE/NOTINLINE declaration, or
29   ;; a list (MACRO . <function>) (a local macro, with the specifier
30   ;; expander.)    Note that Name may be a (SETF <name>) function.
31   (functions nil :type list)
32   ;; an alist translating variable names to LEAF structures. A special
33   ;; binding is indicated by a :SPECIAL GLOBAL-VAR leaf. Each special
34   ;; binding within the code gets a distinct leaf structure, as does
35   ;; the current "global" value on entry to the code compiled.
36   ;; (locally (special ...)) is handled by adding the most recent
37   ;; special binding to the front of the list.
38   ;;
39   ;; If the CDR is (MACRO . <exp>), then <exp> is the expansion of a
40   ;; symbol macro.
41   (variables nil :type list)
42   ;; BLOCKS and TAGS are alists from block and go-tag names to 2-lists
43   ;; of the form (<entry> <continuation>), where <continuation> is the
44   ;; continuation to exit to, and <entry> is the corresponding ENTRY node.
45   (blocks nil :type list)
46   (tags nil :type list)
47   ;; an alist (THING . CTYPE) which is used to keep track of
48   ;; "pervasive" type declarations. When THING is a leaf, this is for
49   ;; type declarations that pertain to the type in a syntactic extent
50   ;; which does not correspond to a binding of the affected name. When
51   ;; Thing is a continuation, this is used to track the innermost THE
52   ;; type declaration.
53   (type-restrictions nil :type list)
54   ;; the lexically enclosing lambda, if any
55   ;; 
56   ;; FIXME: This should be :TYPE (OR CLAMBDA NULL), but it was too hard
57   ;; to get CLAMBDA defined in time for the cross-compiler.
58   (lambda nil) 
59   ;; the lexically enclosing cleanup, or NIL if none enclosing within Lambda
60   ;;
61   ;; FIXME: This should be :TYPE (OR CLEANUP NULL), but it was too hard
62   ;; to get CLEANUP defined in time for the cross-compiler.
63   (cleanup nil)
64   ;; The representation of the current OPTIMIZE policy.
65   (cookie *default-cookie* :type cookie)
66   ;; the policy that takes effect in XEPs and related syntax parsing
67   ;; functions. Slots in this cookie may be null to indicate that the
68   ;; normal value in effect.
69   (interface-cookie *default-interface-cookie* :type cookie)
70   ;; an alist of miscellaneous options that are associated with the
71   ;; lexical environment
72   (options nil :type list))