107 |
(setf (cache-vector-lock-count cache-vector) 0)) |
(setf (cache-vector-lock-count cache-vector) 0)) |
108 |
cache-vector) |
cache-vector) |
109 |
|
|
110 |
|
;; FIXME 64 |
111 |
|
(defconstant rand-base (- (ash 1 31) 1)) |
112 |
|
|
113 |
(defmacro modify-cache (cache-vector &body body) |
(defmacro modify-cache (cache-vector &body body) |
114 |
`(without-interrupts |
`(without-interrupts |
115 |
(multiple-value-prog1 |
(multiple-value-prog1 |
117 |
(let ((old-count (cache-vector-lock-count ,cache-vector))) |
(let ((old-count (cache-vector-lock-count ,cache-vector))) |
118 |
(declare (type non-negative-fixnum old-count)) |
(declare (type non-negative-fixnum old-count)) |
119 |
(setf (cache-vector-lock-count ,cache-vector) |
(setf (cache-vector-lock-count ,cache-vector) |
120 |
(if (= old-count most-positive-fixnum) |
(if (= old-count rand-base) |
121 |
1 (the non-negative-fixnum (1+ old-count)))))))) |
1 (the non-negative-fixnum (1+ old-count)))))))) |
122 |
|
|
123 |
(deftype field-type () |
(deftype field-type () |
258 |
;;; most-positive-fixnum is all-ones. -- Ram |
;;; most-positive-fixnum is all-ones. -- Ram |
259 |
;;; |
;;; |
260 |
(defconstant wrapper-cache-number-length |
(defconstant wrapper-cache-number-length |
261 |
(- (integer-length most-positive-fixnum) |
(- (integer-length rand-base) |
262 |
wrapper-cache-number-adds-ok)) |
wrapper-cache-number-adds-ok)) |
263 |
|
|
264 |
(defconstant wrapper-cache-number-mask |
(defconstant wrapper-cache-number-mask |
273 |
(loop |
(loop |
274 |
(setq n |
(setq n |
275 |
(logand wrapper-cache-number-mask |
(logand wrapper-cache-number-mask |
276 |
(random most-positive-fixnum *get-wrapper-cache-number*))) |
(random rand-base *get-wrapper-cache-number*))) |
277 |
(unless (zerop n) (return n))))) |
(unless (zerop n) (return n))))) |
278 |
|
|
279 |
|
|