0.6.11.13:
[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     (/show0 "doing class with NAME=..")
26     (/primitive-print (symbol-name name))
27     (when trans-p
28       (/show0 "in TRANS-P case")
29       (let ((class (class-cell-class (find-class-cell name)))
30             (type (specifier-type translation)))
31         (setf (built-in-class-translation class) type)
32         (setf (info :type :builtin name) type)))))
33
34 ;;; numeric types
35 (/show0 "precomputing numeric types")
36 (precompute-types '((mod 2) (mod 4) (mod 16) (mod #x100) (mod #x10000)
37                     (mod #x100000000)
38                     (unsigned-byte 1) (unsigned-byte 2) (unsigned-byte 4)
39                     (unsigned-byte 8) (unsigned-byte 16) (unsigned-byte 32)
40                     (signed-byte 8) (signed-byte 16) (signed-byte 32)))
41
42 ;;; built-in symbol type specifiers
43 (/show0 "precomputing built-in symbol type specifiers")
44 (precompute-types *!standard-type-names*)
45
46 ;;; FIXME: It should be possible to do this in the cross-compiler,
47 ;;; but currently the cross-compiler's type system is too dain-bramaged to
48 ;;; handle it. (Various consistency checks are disabled when this flag
49 ;;; is false, and the cross-compiler's type system can't pass these
50 ;;; checks. Some of the problems are quite severe, e.g. mismatch between
51 ;;; LAYOUTs generated by DEF!STRUCT and LAYOUTs generated by real
52 ;;; DEFSTRUCT due to DEF!STRUCT not understanding raw slots -- it's
53 ;;; actually somewhat remarkable that the system works..)
54 ; #+sb-xc-host (setf *type-system-initialized* t)
55
56 (/show0 "done with type-init.lisp")