1 ;;;; constants and types for assembly
3 ;;;; This software is part of the SBCL system. See the README file for
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.
12 (in-package "SB!ASSEM")
17 ;;; FIXME: It might make sense to use SB!VM:BYTE-FOO values here instead of the
18 ;;; various ASSEMBLY-UNIT-FOO things. One problem: BYTE is exported from the CL
19 ;;; package, so ANSI says that we're not supposed to be attaching any new
20 ;;; meanings to it. Perhaps rename SB!VM:BYTE-FOO to SB!VM:VMBYTE-FOO or
21 ;;; SB!VM:VM-BYTE-FOO, and then define the SB!VM:VMBYTE or SB!VM:VM-BYTE types?
23 ;;; If this was done, some of this file could go away, and the rest
24 ;;; could probably be merged back into assem.lisp. (This file was created
25 ;;; simply in order to move the ASSEMBLY-UNIT-related definitions before
26 ;;; compiler/generic/core.lisp in the build sequence.
28 ;;; ASSEMBLY-UNIT-BITS -- the number of bits in the minimum assembly unit,
29 ;;; (also refered to as a ``byte''). Hopefully, different instruction
30 ;;; sets won't require changing this.
31 (defconstant assembly-unit-bits 8)
32 (defconstant assembly-unit-mask (1- (ash 1 assembly-unit-bits)))
34 (deftype assembly-unit ()
35 `(unsigned-byte ,assembly-unit-bits))
37 ;;; Some functions which accept assembly units can meaningfully accept
38 ;;; signed values with the same number of bits and silently munge them
39 ;;; into appropriate unsigned values. (This is handy behavior e.g. when
40 ;;; assembling branch instructions on the X86.)
41 (deftype possibly-signed-assembly-unit ()
43 (signed-byte ,assembly-unit-bits)))
45 ;;; the maximum alignment we can guarantee given the object
46 ;;; format. If the loader only loads objects 8-byte aligned, we can't do
47 ;;; any better then that ourselves.
48 (defconstant max-alignment 3)
51 `(integer 0 ,max-alignment))
53 ;;; the maximum an index will ever become. Well, actually,
54 ;;; just a bound on it so we can define a type. There is no real hard
55 ;;; limit on indexes, but we will run out of memory sometime.
56 (defconstant max-index (1- most-positive-fixnum))
59 `(integer 0 ,max-index))
61 ;;; like MAX-INDEX, except for positions
62 (defconstant max-posn (1- most-positive-fixnum))
65 `(integer 0 ,max-posn))