Fix definition of most-FOOative-fixnum.
[sbcl.git] / src / compiler / generic / early-vm.lisp
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
9
10 (in-package "SB!VM")
11
12 ;;; the number of bits at the low end of a pointer used for type
13 ;;; information
14 (def!constant n-lowtag-bits
15   (integer-length (1- (/ (* 2 n-word-bits) n-byte-bits))))
16 ;;; a mask to extract the low tag bits from a pointer
17 (def!constant lowtag-mask (1- (ash 1 n-lowtag-bits)))
18 ;;; the exclusive upper bound on the value of the low tag bits from a
19 ;;; pointer
20 (def!constant lowtag-limit (ash 1 n-lowtag-bits))
21 ;;; the number of tag bits used for a fixnum
22 (def!constant n-fixnum-tag-bits (1- n-lowtag-bits))
23 ;;; the fixnum tag mask
24 (def!constant fixnum-tag-mask (1- (ash 1 n-fixnum-tag-bits)))
25 ;;; the bit width of positive fixnums
26 (def!constant n-positive-fixnum-bits (- n-word-bits n-fixnum-tag-bits 1))
27
28 ;;; the number of bits to shift between word addresses and byte addresses
29 (def!constant word-shift (1- (integer-length (/ n-word-bits n-byte-bits))))
30
31 ;;; the number of bytes in a word
32 (def!constant n-word-bytes (/ n-word-bits n-byte-bits))
33
34 ;;; the number of bits used in the header word of a data block to store
35 ;;; the type
36 (def!constant n-widetag-bits 8)
37 ;;; a mask to extract the type from a data block header word
38 (def!constant widetag-mask (1- (ash 1 n-widetag-bits)))
39
40 (def!constant sb!xc:most-positive-fixnum
41     (1- (ash 1 n-positive-fixnum-bits))
42   #!+sb-doc
43   "the fixnum closest in value to positive infinity")
44 (def!constant sb!xc:most-negative-fixnum
45     (ash -1 n-positive-fixnum-bits)
46   #!+sb-doc
47   "the fixnum closest in value to negative infinity")
48
49 (def!constant most-positive-word (1- (expt 2 n-word-bits))
50   "The most positive integer that is of type SB-EXT:WORD.")
51
52 (def!constant most-positive-exactly-single-float-fixnum
53   (min #xffffff sb!xc:most-positive-fixnum))
54 (def!constant most-negative-exactly-single-float-fixnum
55   (max #x-ffffff sb!xc:most-negative-fixnum))
56 (def!constant most-positive-exactly-double-float-fixnum
57   (min #x1fffffffffffff sb!xc:most-positive-fixnum))
58 (def!constant most-negative-exactly-double-float-fixnum
59   (max #x-1fffffffffffff sb!xc:most-negative-fixnum))
60
61 ;;;; Point where continuous area starting at dynamic-space-start bumps into
62 ;;;; next space.
63 #!+gencgc
64 (def!constant max-dynamic-space-end
65     (let ((stop (1- (ash 1 n-word-bits)))
66           (start dynamic-space-start))
67       (dolist (other-start (list read-only-space-start static-space-start linkage-table-space-start))
68         (when (< start other-start)
69           (setf stop (min stop other-start))))
70       stop))