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