1 ;;;; generic array operations
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.
13 ;;; (ARRAY NIL) stuff looks the same on all platforms
14 (define-vop (data-vector-ref/simple-array-nil
)
15 (:translate data-vector-ref
)
17 (:args
(object :scs
(descriptor-reg))
18 (index :scs
(unsigned-reg)))
19 (:arg-types simple-array-nil positive-fixnum
)
20 (:results
(value :scs
(descriptor-reg)))
24 (:save-p
:compute-only
)
26 (error-call vop nil-array-accessed-error object
)))
28 ;;; It shouldn't be possible to fall through to here in normal user
29 ;;; code, as the system is smart enough to deduce that there must be
30 ;;; an error upstream, as there are no objects of type NIL that can be
31 ;;; stored in this data vector; however, just in case, we provide this
32 ;;; translation, so that
34 ;;; (DECLARE (TYPE (SIMPLE-ARRAY NIL (*)) X)
35 ;;; (OPTIMIZE (SPEED 3) (SAFETY 0)))
36 ;;; (SB-KERNEL:DATA-VECTOR-SET X 3 'FOO))
37 ;;; signals the right kind of error.
38 (define-vop (data-vector-set/simple-array-nil
)
39 (:translate data-vector-set
)
41 (:args
(object :scs
(descriptor-reg))
42 (index :scs
(unsigned-reg))
43 (value :scs
(descriptor-reg)))
44 (:arg-types simple-array-nil positive-fixnum
*)
45 (:results
(result :scs
(descriptor-reg)))
47 (:ignore index value result
)
49 (:save-p
:compute-only
)
51 (error-call vop nil-array-accessed-error object
)))
53 (define-vop (data-vector-ref-with-offset/simple-array-nil
)
54 (:translate data-vector-ref-with-offset
)
56 (:args
(object :scs
(descriptor-reg))
57 (index :scs
(unsigned-reg)))
59 (:arg-types simple-array-nil positive-fixnum
60 (:constant
(integer 0 0)))
61 (:results
(value :scs
(descriptor-reg)))
63 (:ignore index value offset
)
65 (:save-p
:compute-only
)
67 (error-call vop nil-array-accessed-error object
)))
69 (define-vop (data-vector-set/simple-array-nil
)
70 (:translate data-vector-set
)
72 (:args
(object :scs
(descriptor-reg))
73 (index :scs
(unsigned-reg))
74 (value :scs
(descriptor-reg)))
76 (:arg-types simple-array-nil positive-fixnum
*
77 (:constant
(integer 0 0)))
78 (:results
(result :scs
(descriptor-reg)))
80 (:ignore index value result offset
)
82 (:save-p
:compute-only
)
84 (error-call vop nil-array-accessed-error object
)))
86 ;;; FIXME: There is probably plenty of other array stuff that looks
87 ;;; the same or similar enough to be genericized. Do so, and move it
88 ;;; here so that a new port doesn't need to do as much work.