;;;; files for more information.
(in-package "SB!VM")
+
+(declaim (special sb!vm:*read-only-space-free-pointer*
+ sb!vm:*static-space-free-pointer*))
\f
;;;; type format database
;; will be a short. On platforms with larger ones, it'll
;; be an int.
(bytes-used (unsigned
- #.(if (typep sb!vm:gencgc-page-size
+ #.(if (typep sb!vm:gencgc-card-bytes
'(unsigned-byte 16))
16
32)))
(if careful
(make-lisp-obj tagged-address nil)
(values (%make-lisp-obj tagged-address) t))))
+ ;; Inlining MAKE-OBJ reduces consing on platforms where dynamic
+ ;; space extends past fixnum range.
+ (declare (inline make-obj))
(without-gcing
(multiple-value-bind (start end) (space-bounds space)
(declare (type system-area-pointer start end))
(maybe-skip-page ()
#!+gencgc
(when (eq space :dynamic)
- (loop with page-mask = #.(1- sb!vm:gencgc-page-size)
+ (loop with page-mask = #.(1- sb!vm:gencgc-card-bytes)
for addr of-type sb!vm:word = (sap-int current)
while (>= addr skip-tests-until-addr)
do
;; pointer is still below the allocation offset
;; of the page
(when (and (not (zerop alloc-flag))
- (<= (logand page-mask addr)
- bytes-used))
+ (< (logand page-mask addr)
+ bytes-used))
;; Don't bother testing again until we
;; get past that allocation offset
(setf skip-tests-until-addr
(return-from maybe-skip-page))
;; Move CURRENT to start of next page.
(setf current (int-sap (+ (logandc2 addr page-mask)
- sb!vm:gencgc-page-size)))
+ sb!vm:gencgc-card-bytes)))
(maybe-finish-mapping))))))
(maybe-map (obj obj-tag n-obj-bytes &optional (ok t))
(let ((next (typecase n-obj-bytes
space)
res)))
+;;; Calls FUNCTION with all object that have (possibly conservative)
+;;; references to them on current stack.
+(defun map-stack-references (function)
+ (let ((end
+ (sb!di::descriptor-sap
+ #!+stack-grows-downward-not-upward *control-stack-end*
+ #!-stack-grows-downward-not-upward *control-stack-start*))
+ (sp (current-sp))
+ (seen nil))
+ (loop until #!+stack-grows-downward-not-upward (sap> sp end)
+ #!-stack-grows-downward-not-upward (sap< sp end)
+ do (multiple-value-bind (obj ok) (make-lisp-obj (sap-ref-word sp 0) nil)
+ (when (and ok (typep obj '(not (or fixnum character))))
+ (unless (member obj seen :test #'eq)
+ (funcall function obj)
+ (push obj seen))))
+ (setf sp
+ #!+stack-grows-downward-not-upward (sap+ sp n-word-bytes)
+ #!-stack-grows-downward-not-upward (sap+ sp (- n-word-bytes))))))
+
(defun map-referencing-objects (fun space object)
(declare (type spaces space) (inline map-allocated-objects))
(unless *ignore-after*