Remove sigsetmask from ldso-stubs, unused.
[sbcl.git] / src / interpreter / basic-env.lisp
blobdd39e739e222c03a1a9463cf2350f97436bdbf24
1 ;;;; A partially-compiling interpreted EVAL
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.
12 (in-package "SB!INTERPRETER")
14 ;; +NONE+ is not accidentally acceptable - as would be NIL -
15 ;; to functions accepting a SEQUENCE type.
16 (defconstant +none+ 0)
17 (deftype value-vector () `(or (eql ,+none+) simple-vector))
19 (defstruct (decl-scope (:conc-name)
20 (:constructor make-decl-scope (declarations %policy))
21 (:copier nil))
22 (declarations (missing-arg) :type list :read-only t) ; in their original form
23 ;; lexical policy. Don't read directly. Use ENV-POLICY instead.
24 (%policy nil :type sb!c::policy :read-only t)
26 ;; A vector parallel to the bound symbols in a LET or LAMBDA frame.
27 (binding-typechecks +none+ :type value-vector)
28 ;; A vector of extra checks performed on entry to this scope.
29 ;; Each check takes 2 cells to represent: a binding and a ctype.
30 ;; The binding is either a frame-ptr or a symbol.
31 (extra-typechecks +none+ :type value-vector)
33 ;; (BINDING . CTYPE) where BINDING is either a binding cell - a cons -
34 ;; or a symbol in the case of free specials.
35 ;; Name ambiguities are resolved when the cell is a cons.
36 ;; Restrictions are stored even when current policy precludes type checking,
37 ;; so that a nested scope in a safer policy works as it should.
38 (type-restrictions nil :type list))
40 ;; Some limits of the number of levels of lexical nesting and number
41 ;; of things that can be bound at one level.
42 ;; For 32-bit machines, could replace these with a cons of two fixnums
43 ;; if the limits prove to be inadequate.
44 (eval-when (:compile-toplevel :load-toplevel :execute)
45 (defconstant +frame-depth-bits+ 8) ; 2^8 levels of lexical scope nesting
46 (defconstant +frame-size-bits+ 21)) ; 2^21 {vars,funs,tags} per scope
48 ;; Environment structure.
49 ;; The interpreter never stack-allocates any ENV, for two reasons:
50 ;; 1. it does not analyze which would environments could be dx
51 ;; 2. heap allocation is better for being tail-recursive
52 ;; But the code-walker using these structures *does* allocate its ENVs,
53 ;; on the stack, so it needs an inlineable constructor.
54 (declaim (inline make-basic-env))
55 ;; This is 6 words including the header. It could be shrunk to 4 words
56 ;; with the compact-instance patch because the 'symbols' slot is strictly
57 ;; a lexical (static) aspect that can be moved into the 'decl-scope' object.
58 (defstruct (basic-env ; 6 words incl. header word.
59 (:conc-name env-)
60 (:include sb!c::abstract-lexenv)
61 (:constructor make-basic-env (parent payload symbols contour))
62 ;(:predicate nil)
63 (:copier nil))
64 (parent nil :type (or null basic-env))
65 (payload nil :read-only t) ; whatever the particular ENV subtype wants to put here
66 ;; #(name1 ... nameN) or (#(name1 ... nameN) . fill-pointer)
67 ;; All ENV subtypes except tagbody and block may have symbols,
68 ;; either to create free specials or lexical bindings or both.
69 ;; FIXME: NIL should be +NONE+ so that we don't have to distinguish it from CONS,
70 ;; and then MUTABLE-P would be LISTP instead of CONSP for a faster test.
71 (symbols nil :type (or null simple-vector
72 (cons (unsigned-byte #.+frame-size-bits+)
73 simple-vector)))
74 ;; The CONTOUR is the static aspect of the dynamic contour,
75 ;; all the "compile-time-ish" stuff such as parsed bindings, canonical policy.
76 ;; It's analogous to a LEXENV, but naming it LEXENV would be confusing
77 ;; as heck, since ENV-LEXENV could be reasonably construed as the function
78 ;; that returns a compiler LEXENV corresponding to this BASIC-ENV.
79 (contour nil :type decl-scope :read-only t))