0.8.18.14:
[sbcl.git] / src / assembly / x86-64 / array.lisp
1 ;;;; various array operations that are too expensive (in space) to do
2 ;;;; inline
3
4 ;;;; This software is part of the SBCL system. See the README file for
5 ;;;; more information.
6 ;;;;
7 ;;;; This software is derived from the CMU CL system, which was
8 ;;;; written at Carnegie Mellon University and released into the
9 ;;;; public domain. The software is in the public domain and is
10 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
11 ;;;; files for more information.
12
13 (in-package "SB!VM")
14 \f
15 ;;;; allocation
16
17 (define-assembly-routine (allocate-vector
18                           (:policy :fast-safe)
19                           (:translate allocate-vector)
20                           (:arg-types positive-fixnum
21                                       positive-fixnum
22                                       positive-fixnum))
23                          ((:arg type unsigned-reg eax-offset)
24                           (:arg length any-reg ebx-offset)
25                           (:arg words any-reg ecx-offset)
26                           (:res result descriptor-reg edx-offset))
27   (inst mov result (+ (1- (ash 1 n-lowtag-bits))
28                       (* vector-data-offset n-word-bytes)))
29   (inst add result words)
30   (inst and result (lognot lowtag-mask))
31   (pseudo-atomic
32    (allocation result result)
33    (inst lea result (make-ea :byte :base result :disp other-pointer-lowtag))
34    (storew type result 0 other-pointer-lowtag)
35    (storew length result vector-length-slot other-pointer-lowtag))
36   (inst ret))
37 \f
38 ;;;; Note: CMU CL had assembly language primitives for hashing strings,
39 ;;;; but SBCL doesn't.