Make 'primordial-extensions' very primordial.
[sbcl.git] / src / code / alloc.lisp
blobc7b76f9e004a79292345b834030a00d6316f640c
1 ;;;; Lisp-side allocation (used currently only for direct allocation
2 ;;;; to static space).
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.
13 (in-package "SB!VM")
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)
24 (type index length))
25 ;; WITHOUT-GCING implies WITHOUT-INTERRUPTS
26 (or
27 (without-gcing
28 (let* ((pointer (ash *static-space-free-pointer* n-fixnum-tag-bits))
29 (vector (logior pointer other-pointer-lowtag))
30 ;; rounded to dual word boundary
31 (nwords (logandc2 (+ lowtag-mask (+ words vector-data-offset 1))
32 lowtag-mask))
33 (new-pointer (+ pointer (ash nwords word-shift))))
34 (when (> static-space-end new-pointer)
35 (store-word widetag
36 vector 0 other-pointer-lowtag)
37 (store-word (fixnumize length)
38 vector vector-length-slot other-pointer-lowtag)
39 (store-word 0 new-pointer)
40 (setf *static-space-free-pointer*
41 (ash new-pointer (- n-fixnum-tag-bits)))
42 (%make-lisp-obj vector))))
43 (error 'simple-storage-condition
44 :format-control "Not enough memory left in static space to ~
45 allocate vector.")))