0.7.1.18:
[sbcl.git] / src / compiler / generic / early-objdef.lisp
1 ;;;; type-based constants
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!VM")
13
14 ;;; FIXME: It's clever using :SUFFIX -TYPE for these things, but it's
15 ;;; a pain for people just learning to find their way around the code
16 ;;; who want to use lexical search to figure out where things like
17 ;;; EVEN-FIXNUM-LOWTAG are defined. Remove the :SUFFIXes and just expand
18 ;;; out the full names. Or even define them in DEF EVEN-FIXNUM-LOWTAG
19 ;;; style so searches like 'def.*even-fixnum-lowtag' can find them.
20
21 ;;; Tags for the main low-level types are stored in the low three
22 ;;; bits to identify the type of a machine word.  Certain constraints 
23 ;;; apply:
24 ;;;   * EVEN-FIXNUM-LOWTAG and ODD-FIXNUM-LOWTAG must be 0 and 4: code
25 ;;;     which shifts left two places to convert raw integers to tagged
26 ;;;     fixnums is ubiquitous.
27 ;;;   * LIST-POINTER-LOWTAG + 4 = OTHER-POINTER-LOWTAG: NIL is both a
28 ;;;     cons and a symbol (at the same address) and depends on this.
29 ;;;     See the definition of SYMBOL in objdef.lisp
30 (eval-when (:compile-toplevel :load-toplevel :execute)
31   ;; The EVAL-WHEN is necessary (at least for Lispworks), because the
32   ;; second DEFENUM uses the value of OTHER-IMMEDIATE-0-LOWTAG, which is
33   ;; defined in the first DEFENUM. -- AL 20000216
34   (defenum (:suffix -lowtag)
35     even-fixnum
36     ;; Note: CMU CL, and SBCL < 0.pre7.39, had FUN-POINTER-LOWTAG
37     ;; here. We swapped FUN-POINTER-LOWTAG and
38     ;; INSTANCE-POINTER-LOWTAG in sbcl-0.pre7.39 in order to help with a
39     ;; low-level pun in the function call sequence on the PPC port.
40     ;; For more information, see the PPC port code. -- WHN 2001-10-03
41     instance-pointer
42     other-immediate-0
43     list-pointer
44     odd-fixnum
45     fun-pointer
46     other-immediate-1
47     other-pointer))
48
49 ;;; the heap types, stored in 8 bits of the header of an object on the
50 ;;; heap, to identify the type of the heap object (which'll be at
51 ;;; least two machine words, often more)
52 (defenum (:suffix -widetag
53           :start (+ (ash 1 n-lowtag-bits) other-immediate-0-lowtag)
54           :step (ash 1 (1- n-lowtag-bits)))
55   bignum
56   ratio
57   single-float
58   double-float
59   #!+long-float long-float
60   complex
61   complex-single-float
62   complex-double-float
63   #!+long-float complex-long-float
64
65   simple-array
66   simple-string
67   simple-bit-vector
68   simple-vector
69   simple-array-unsigned-byte-2
70   simple-array-unsigned-byte-4
71   simple-array-unsigned-byte-8
72   simple-array-unsigned-byte-16
73   simple-array-unsigned-byte-32
74   simple-array-signed-byte-8
75   simple-array-signed-byte-16
76   simple-array-signed-byte-30
77   simple-array-signed-byte-32
78   simple-array-single-float
79   simple-array-double-float
80   #!+long-float simple-array-long-float
81   simple-array-complex-single-float
82   simple-array-complex-double-float
83   #!+long-float simple-array-complex-long-float
84   complex-string
85   complex-bit-vector
86   complex-vector
87   complex-array
88
89   code-header
90   simple-fun-header
91   closure-header
92   funcallable-instance-header
93   closure-fun-header
94
95   return-pc-header
96   value-cell-header
97   symbol-header
98   base-char
99   sap
100   unbound-marker
101   weak-pointer
102   instance-header
103   fdefn)
104
105 ;;; the different vector subtypes
106 (defenum (:prefix vector- :suffix -subtype)
107   normal
108   unused
109   valid-hashing
110   must-rehash)