[3031b2]: src / compiler / generic / vm-typetran.lisp Maximize Restore History

Download this file

vm-typetran.lisp    122 lines (111 with data), 5.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
;;;; This file contains the implementation specific type
;;;; transformation magic. Basically, the various non-standard
;;;; predicates that can be used in TYPEP transformations.
;;;; This software is part of the SBCL system. See the README file for
;;;; more information.
;;;;
;;;; This software is derived from the CMU CL system, which was
;;;; written at Carnegie Mellon University and released into the
;;;; public domain. The software is in the public domain and is
;;;; provided with absolutely no warranty. See the COPYING and CREDITS
;;;; files for more information.
(in-package "SB!C")
;;;; internal predicates
;;; These type predicates are used to implement simple cases of TYPEP.
;;; They shouldn't be used explicitly.
(define-type-predicate base-string-p base-string)
(define-type-predicate bignump bignum)
#!+sb-unicode (define-type-predicate character-string-p (vector character))
(define-type-predicate complex-double-float-p (complex double-float))
(define-type-predicate complex-single-float-p (complex single-float))
#!+long-float
(define-type-predicate complex-long-float-p (complex long-float))
;;; (COMPLEX-VECTOR-P isn't here because it's not so much a Lisp-level
;;; type predicate as just a hack to get at the type code so that we
;;; can implement some primitive stuff in Lisp.)
(define-type-predicate double-float-p double-float)
(define-type-predicate fixnump fixnum)
(define-type-predicate long-float-p long-float)
(define-type-predicate ratiop ratio)
(define-type-predicate short-float-p short-float)
(define-type-predicate single-float-p single-float)
(define-type-predicate simple-array-p simple-array)
(define-type-predicate simple-array-nil-p (simple-array nil (*)))
(define-type-predicate simple-array-unsigned-byte-2-p
(simple-array (unsigned-byte 2) (*)))
(define-type-predicate simple-array-unsigned-byte-4-p
(simple-array (unsigned-byte 4) (*)))
(define-type-predicate simple-array-unsigned-byte-7-p
(simple-array (unsigned-byte 7) (*)))
(define-type-predicate simple-array-unsigned-byte-8-p
(simple-array (unsigned-byte 8) (*)))
(define-type-predicate simple-array-unsigned-byte-15-p
(simple-array (unsigned-byte 15) (*)))
(define-type-predicate simple-array-unsigned-byte-16-p
(simple-array (unsigned-byte 16) (*)))
(define-type-predicate simple-array-unsigned-fixnum-p
(simple-array
(unsigned-byte #.sb!vm:n-positive-fixnum-bits) (*)))
(define-type-predicate simple-array-unsigned-byte-31-p
(simple-array (unsigned-byte 31) (*)))
(define-type-predicate simple-array-unsigned-byte-32-p
(simple-array (unsigned-byte 32) (*)))
#!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
(define-type-predicate simple-array-unsigned-byte-63-p
(simple-array (unsigned-byte 63) (*)))
#!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
(define-type-predicate simple-array-unsigned-byte-64-p
(simple-array (unsigned-byte 64) (*)))
(define-type-predicate simple-array-signed-byte-8-p
(simple-array (signed-byte 8) (*)))
(define-type-predicate simple-array-signed-byte-16-p
(simple-array (signed-byte 16) (*)))
(define-type-predicate simple-array-fixnum-p
(simple-array (signed-byte #.sb!vm:n-fixnum-bits)
(*)))
(define-type-predicate simple-array-signed-byte-32-p
(simple-array (signed-byte 32) (*)))
#!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
(define-type-predicate simple-array-signed-byte-64-p
(simple-array (signed-byte 64) (*)))
(define-type-predicate simple-array-single-float-p
(simple-array single-float (*)))
(define-type-predicate simple-array-double-float-p
(simple-array double-float (*)))
#!+long-float
(define-type-predicate simple-array-long-float-p
(simple-array long-float (*)))
(define-type-predicate simple-array-complex-single-float-p
(simple-array (complex single-float) (*)))
(define-type-predicate simple-array-complex-double-float-p
(simple-array (complex double-float) (*)))
#!+long-float
(define-type-predicate simple-array-complex-long-float-p
(simple-array (complex long-float) (*)))
(define-type-predicate simple-base-string-p simple-base-string)
#!+sb-unicode (define-type-predicate simple-character-string-p
(simple-array character (*)))
(define-type-predicate system-area-pointer-p system-area-pointer)
#!+#.(cl:if (cl:= 32 sb!vm:n-word-bits) '(and) '(or))
(define-type-predicate unsigned-byte-32-p (unsigned-byte 32))
#!+#.(cl:if (cl:= 32 sb!vm:n-word-bits) '(and) '(or))
(define-type-predicate signed-byte-32-p (signed-byte 32))
#!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
(define-type-predicate unsigned-byte-64-p (unsigned-byte 64))
#!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
(define-type-predicate signed-byte-64-p (signed-byte 64))
#!+sb-simd-pack
(define-type-predicate simd-pack-p simd-pack)
(define-type-predicate vector-nil-p (vector nil))
(define-type-predicate weak-pointer-p weak-pointer)
(define-type-predicate code-component-p code-component)
(define-type-predicate lra-p lra)
(define-type-predicate fdefn-p fdefn)
(macrolet
((def ()
`(progn ,@(loop for (name spec) in *vector-without-complex-typecode-infos*
collect `(define-type-predicate ,name (vector ,spec))))))
(def))
;;; Unlike the un-%'ed versions, these are true type predicates,
;;; accepting any type object.
(define-type-predicate %standard-char-p standard-char)