0.6.7.22: removed CVS dollar-Header-dollar tags from sources
[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 binding
33   ;; is indicated by a :Special Global-Var leaf. Each special binding within
34   ;; the code gets a distinct leaf structure, as does the current "global"
35   ;; value on entry to the code compiled. (locally (special ...)) is handled
36   ;; by adding the most recent special binding to the front of the list.
37   ;;
38   ;; If the CDR is (MACRO . <exp>), then <exp> is the expansion of a symbol
39   ;; macro.
40   (variables nil :type list)
41   ;; Blocks and Tags are alists from block and go-tag names to 2-lists of the
42   ;; form (<entry> <continuation>), where <continuation> is the continuation to
43   ;; exit to, and <entry> is the corresponding Entry node.
44   (blocks nil :type list)
45   (tags nil :type list)
46   ;; An alist (Thing . CType) which is used to keep track of "pervasive" type
47   ;; declarations. When Thing is a leaf, this is for type declarations that
48   ;; pertain to the type in a syntactic extent which does not correspond to a
49   ;; binding of the affected name. When Thing is a continuation, this is used
50   ;; to track the innermost THE type declaration.
51   (type-restrictions nil :type list)
52   ;; The lexically enclosing lambda, if any.
53   ;; 
54   ;; FIXME: This should be :TYPE (OR CLAMBDA NULL), but it was too hard
55   ;; to get CLAMBDA defined in time for the cross-compiler.
56   (lambda nil) 
57   ;; The lexically enclosing cleanup, or NIL if none enclosing within Lambda.
58   ;;
59   ;; FIXME: This should be :TYPE (OR CLEANUP NULL), but it was too hard
60   ;; to get CLEANUP defined in time for the cross-compiler.
61   (cleanup nil)
62   ;; The representation of the current OPTIMIZE policy.
63   (cookie *default-cookie* :type cookie)
64   ;; The policy that takes effect in XEPs and related syntax parsing functions.
65   ;; Slots in this cookie may be null to indicate that the normal value in
66   ;; effect.
67   (interface-cookie *default-interface-cookie* :type cookie)
68   ;; an alist of miscellaneous options that are associated with the lexical
69   ;; environment
70   (options nil :type list))