0c128258cf202d2c3dabecfe1c9b4a1799af2a6f
[sbcl.git] / src / code / type-init.lisp
1 ;;;; When this file's top-level forms are run, it precomputes the
2 ;;;; translations for commonly used type specifiers. This stuff is
3 ;;;; split off from the other type stuff to get around problems with
4 ;;;; everything needing to be loaded before everything else. This is
5 ;;;; the first file which really exercises the type stuff. This stuff
6 ;;;; is also somewhat implementation-dependent in that implementations
7 ;;;; may want to precompute other types which are important to them.
8
9 ;;;; This software is part of the SBCL system. See the README file for
10 ;;;; more information.
11 ;;;;
12 ;;;; This software is derived from the CMU CL system, which was
13 ;;;; written at Carnegie Mellon University and released into the
14 ;;;; public domain. The software is in the public domain and is
15 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
16 ;;;; files for more information.
17
18 (in-package "SB!KERNEL")
19
20 ;;; built-in classes
21 (/show0 "beginning type-init.lisp")
22 (dolist (x *built-in-classes*)
23   (destructuring-bind (name &key (translation nil trans-p) &allow-other-keys)
24       x
25     #+sb-show (progn
26                 (/show0 "doing class with name=..")
27                 #+sb-xc-host (/show0 name)
28                 #-sb-xc-host (%primitive print (symbol-name name)))
29     (when trans-p
30       (/show0 "in TRANS-P case")
31       (let ((class (class-cell-class (find-class-cell name)))
32             (type (specifier-type translation)))
33         (setf (built-in-class-translation class) type)
34         (setf (info :type :builtin name) type)))))
35
36 ;;; numeric types
37 (/show0 "precomputing numeric types")
38 (precompute-types '((mod 2) (mod 4) (mod 16) (mod #x100) (mod #x10000)
39                     (mod #x100000000)
40                     (unsigned-byte 1) (unsigned-byte 2) (unsigned-byte 4)
41                     (unsigned-byte 8) (unsigned-byte 16) (unsigned-byte 32)
42                     (signed-byte 8) (signed-byte 16) (signed-byte 32)))
43
44 ;;; built-in symbol type specifiers
45 (/show0 "precomputing built-in symbol type specifiers")
46 (precompute-types *!standard-type-names*)
47
48 ;;; FIXME: It should be possible to do this in the cross-compiler,
49 ;;; but currently the cross-compiler's type system is too dain-bramaged to
50 ;;; handle it. (Various consistency checks are disabled when this flag
51 ;;; is false, and the cross-compiler's type system can't pass these
52 ;;; checks. Some of the problems are quite severe, e.g. mismatch between
53 ;;; LAYOUTs generated by DEF!STRUCT and LAYOUTs generated by real
54 ;;; DEFSTRUCT due to DEF!STRUCT not understanding raw slots -- it's
55 ;;; actually somewhat remarkable that the system works..)
56 ; #+sb-xc-host (setf *type-system-initialized* t)
57
58 (/show0 "done with type-init.lisp")