0.8.3.39:
[sbcl.git] / src / assembly / ppc / 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 (define-assembly-routine (allocate-vector
16                           (:policy :fast-safe)
17                           (:translate allocate-vector)
18                           (:arg-types positive-fixnum
19                                       positive-fixnum
20                                       positive-fixnum))
21                          ((:arg type any-reg a0-offset)
22                           (:arg length any-reg a1-offset)
23                           (:arg words any-reg a2-offset)
24                           (:res result descriptor-reg a0-offset)
25
26                           (:temp ndescr non-descriptor-reg nl0-offset)
27                           (:temp pa-flag non-descriptor-reg nl3-offset)
28                           (:temp vector descriptor-reg a3-offset))
29   (pseudo-atomic (pa-flag)
30     (inst ori vector alloc-tn sb!vm:other-pointer-lowtag)
31     (inst addi ndescr words (* (1+ sb!vm:vector-data-offset) sb!vm:n-word-bytes))
32     (inst clrrwi ndescr ndescr n-lowtag-bits)
33     (inst add alloc-tn alloc-tn ndescr)
34     (inst srwi ndescr type sb!vm:word-shift)
35     (storew ndescr vector 0 sb!vm:other-pointer-lowtag)
36     (storew length vector sb!vm:vector-length-slot sb!vm:other-pointer-lowtag))
37   (move result vector))