1 ;;;; Lisp-side allocation (used currently only for direct allocation
4 ;;;; This software is part of the SBCL system. See the README file for
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.
15 #!-sb-fluid (declaim (inline store-word))
16 (defun store-word (word base &optional (offset 0) (lowtag 0))
17 (declare (type (unsigned-byte #.sb!vm:n-word-bits) word base offset)
18 (type (unsigned-byte #.n-lowtag-bits) lowtag))
19 (setf (sap-ref-word (int-sap base) (- (ash offset word-shift) lowtag)) word))
21 (defun allocate-static-vector (widetag length words)
22 (declare (type (unsigned-byte #.n-widetag-bits) widetag)
23 (type (unsigned-byte #.n-word-bits) words)
26 ;; FIXME: Is WITHOUT-GCING enough to do lisp-side allocation
27 ;; to static space, or should we have WITHOUT-INTERRUPTS here
30 (let* ((pointer *static-space-free-pointer*) ; in words
31 (free (* pointer n-word-bytes))
32 (vector (logior free other-pointer-lowtag)) ; in bytes, yay
33 ;; rounded to dual word boundary
34 (nwords (logandc2 (+ lowtag-mask (+ words vector-data-offset 1))
36 (new-pointer (+ *static-space-free-pointer* nwords))
37 (new-free (* new-pointer n-word-bytes)))
38 (unless (> static-space-end new-free)
39 (error 'simple-storage-condition
40 :format-control "Not enough memory left in static space to ~
43 vector 0 other-pointer-lowtag)
44 (store-word (ash length word-shift)
45 vector vector-length-slot other-pointer-lowtag)
46 (store-word 0 new-free)
48 (make-lisp-obj vector)
49 (setf *static-space-free-pointer* new-pointer))))
50 (serious-condition (c)
51 ;; unwind from WITHOUT-GCING