(defun random-fixnum ()
(random (1+ most-positive-fixnum)))
-(defconstant n-fixnum-bits #.(integer-length most-positive-fixnum))
-
;;; Lambda which executes its body (or not) randomly. Used to drop
;;; random cache entries.
(defmacro randomly-punting-lambda (lambda-list &body body)
(with-unique-names (drops drop-pos)
`(let ((,drops (random-fixnum))
- (,drop-pos n-fixnum-bits))
+ (,drop-pos sb-vm:n-fixnum-bits))
(declare (fixnum ,drops)
- (type (integer 0 #.n-fixnum-bits) ,drop-pos))
+ (type (integer 0 #.sb-vm:n-fixnum-bits) ,drop-pos))
(lambda ,lambda-list
(when (logbitp (the unsigned-byte (decf ,drop-pos)) ,drops)
(locally ,@body))
(when (zerop ,drop-pos)
(setf ,drops (random-fixnum)
- ,drop-pos n-fixnum-bits))))))
+ ,drop-pos sb-vm:n-fixnum-bits))))))
\f
;;;; early definition of WRAPPER
;;;;
(for-std-class-p t))
(:constructor make-wrapper-internal)
(:copier nil))
- (instance-slots-layout nil :type list)
- (class-slots nil :type list))
+ (slots () :type list))
#-sb-fluid (declaim (sb-ext:freeze-type wrapper))
\f
;;;; PCL's view of funcallable instances
(member (dsd-name included-slot) slot-overrides :test #'eq))
collect slot)))))
+(defun uninitialized-accessor-function (type slotd)
+ (lambda (&rest args)
+ (declare (ignore args))
+ (error "~:(~A~) function~@[ for ~S ~] not yet initialized."
+ type slotd)))
+
(defun structure-slotd-name (slotd)
(dsd-name slotd))
(dsd-accessor-name slotd))
(defun structure-slotd-reader-function (slotd)
- (fdefinition (dsd-accessor-name slotd)))
+ (let ((name (dsd-accessor-name slotd)))
+ (if (fboundp name)
+ (fdefinition name)
+ (uninitialized-accessor-function :reader slotd))))
(defun structure-slotd-writer-function (type slotd)
(if (dsd-read-only slotd)
(let ((dd (find-defstruct-description type)))
(coerce (slot-setter-lambda-form dd slotd) 'function))
- (fdefinition `(setf ,(dsd-accessor-name slotd)))))
+ (let ((name `(setf ,(dsd-accessor-name slotd))))
+ (if (fboundp name)
+ (fdefinition name)
+ (uninitialized-accessor-function :writer slotd)))))
(defun structure-slotd-type (slotd)
(dsd-type slotd))