Initial revision
[sbcl.git] / src / assembly / x86 / 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
15 (file-comment
16  "$Header$")
17 \f
18 ;;;; allocation
19
20 (define-assembly-routine (allocate-vector
21                           (:policy :fast-safe)
22                           (:translate allocate-vector)
23                           (:arg-types positive-fixnum
24                                       positive-fixnum
25                                       positive-fixnum))
26                          ((:arg type unsigned-reg eax-offset)
27                           (:arg length any-reg ebx-offset)
28                           (:arg words any-reg ecx-offset)
29                           (:res result descriptor-reg edx-offset))
30   (inst mov result (+ (1- (ash 1 lowtag-bits))
31                       (* vector-data-offset word-bytes)))
32   (inst add result words)
33   (inst and result (lognot sb!vm:lowtag-mask))
34   (pseudo-atomic
35    (allocation result result)
36    (inst lea result (make-ea :byte :base result :disp other-pointer-type))
37    (storew type result 0 other-pointer-type)
38    (storew length result vector-length-slot other-pointer-type))
39   (inst ret))
40 \f
41 ;;;; Note: CMU CL had assembly language primitives for hashing strings,
42 ;;;; but SBCL doesn't.