Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 27 lines (24 sloc) 0.955 kb
248875b Stas Boukarev Move the remaining SBCL-specific optimizations into separate files.
authored
1 (in-package #:storage)
2
3 (declaim (inline fast-allocate-instance))
4 (defun fast-allocate-instance (wrapper initforms)
5 (declare (simple-vector initforms))
6 (let ((instance (sb-pcl::%make-standard-instance
7 (copy-seq initforms) (sb-pcl::get-instance-hash-code))))
8 (setf (sb-pcl::std-instance-wrapper instance)
9 wrapper)
10 instance))
11
12 (defun preallocate-objects (array info)
13 (declare (simple-vector array)
14 (optimize speed))
15 (loop with index = 0
16 for (class . length) in info
17 for initforms = (class-initforms class)
18 for wrapper = (sb-pcl::class-wrapper class)
19 do
20 (setf (objects-of-class class)
21 (loop repeat (the fixnum length)
22 for instance = (fast-allocate-instance wrapper initforms)
23 collect instance
24 do
25 (setf (aref array index) instance)
26 (incf index)))))
Something went wrong with that request. Please try again.