Preserve progn-like clauses for coverage
[sbcl.git] / src / assembly / sparc / array.lisp
blob926550b90dafa29e1d5f152dba5a0227844d69f3
1 ;;;; support routines for arrays and vectors
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
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.
12 (in-package "SB!VM")
14 (define-assembly-routine (allocate-vector
15 (:policy :fast-safe)
16 (:translate allocate-vector)
17 (:arg-types positive-fixnum
18 positive-fixnum
19 positive-fixnum))
20 ((:arg type any-reg a0-offset)
21 (:arg length any-reg a1-offset)
22 (:arg words any-reg a2-offset)
23 (:res result descriptor-reg a0-offset)
25 (:temp ndescr non-descriptor-reg nl0-offset)
26 (:temp gc-temp non-descriptor-reg nl1-offset)
27 (:temp vector descriptor-reg a3-offset))
28 (pseudo-atomic ()
29 ;; boxed words == unboxed bytes
30 (inst add ndescr words (* (1+ vector-data-offset) n-word-bytes))
31 (inst andn ndescr 7)
32 (allocation vector ndescr other-pointer-lowtag :temp-tn gc-temp)
33 (inst srl ndescr type word-shift)
34 (storew ndescr vector 0 other-pointer-lowtag)
35 (storew length vector vector-length-slot other-pointer-lowtag))
36 ;; This makes sure the zero byte at the end of a string is paged in so
37 ;; the kernel doesn't bitch if we pass it the string.
39 ;; RLT comments in CMUCL about changing the following line to
40 ;; store at -1 instead of 0:
41 ;; This used to write to the word after the last allocated word. I
42 ;; (RLT) made it write to the last allocated word, which is where
43 ;; the zero-byte of the string is. Look at the deftransform for
44 ;; make-array in array-tran.lisp. For strings we always allocate
45 ;; enough space to hold the zero-byte.
46 ;; Which is most certainly motivated by the fact that this store (if
47 ;; performed on gencgc) overwrites the first word of the following
48 ;; page -- destroying the first object of an unrelated allocation region!
50 ;; But the CMUCL fix breaks :ELEMENT-TYPE NIL strings, so we'd need a
51 ;; branch to figure out whether to do it. Until and unless someone
52 ;; demonstrates that gencgc actually gives us uncommitted memory, I'm
53 ;; just not doing it at all: -- DFL
54 #!-gencgc
55 (storew zero-tn alloc-tn 0)
56 (move result vector))