0.9.9.36:
[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      (:temp temp non-descriptor-reg nl2-offset))
30   (pseudo-atomic (pa-flag)
31     ;; boxed words == unboxed bytes
32     (inst addi ndescr words (* (1+ vector-data-offset) n-word-bytes))
33     (inst clrrwi ndescr ndescr n-lowtag-bits)
34     (allocation vector ndescr other-pointer-lowtag
35                 :temp-tn temp
36                 :flag-tn pa-flag)
37     (inst srwi ndescr type word-shift)
38     (storew ndescr vector 0 other-pointer-lowtag)
39     (storew length vector vector-length-slot other-pointer-lowtag))
40   ;; This makes sure the zero byte at the end of a string is paged in so
41   ;; the kernel doesn't bitch if we pass it the string.
42   ;;
43   ;; rtoy says to turn this off as it causes problems with CMUCL.
44   ;;
45   ;; I don't think we need to do this anymore. It looks like this
46   ;; inherited from the SPARC port and does not seem to be
47   ;; necessary. Turning this on worked at some point, but I have not
48   ;; tested with the final GENGC-related changes. CLH 20060221
49   ;;
50   ;;  (storew zero-tn alloc-tn 0)
51   (move result vector))