X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Fcache.lisp;h=bb60a0306f5419467dfa29e024bf87b2653cd8ad;hb=b429c5c0557ed790e84dae4d6c35e06ab1a14416;hp=3204dbef49fbafb934cf283ad06569bf385e5301;hpb=229d5b35ac98f606f24c90d8e5cc037cae3829cd;p=sbcl.git diff --git a/src/pcl/cache.lisp b/src/pcl/cache.lisp index 3204dbe..bb60a03 100644 --- a/src/pcl/cache.lisp +++ b/src/pcl/cache.lisp @@ -104,11 +104,6 @@ ;; bits at the low end. (logand (1- vector-length) (- line-size))) -;;; The smallest power of two that is equal to or greater then X. -(declaim (inline power-of-two-ceiling)) -(defun power-of-two-ceiling (x) - (ash 1 (integer-length (1- x)))) - (defun cache-statistics (cache) (let* ((vector (cache-vector cache)) (size (length vector)) @@ -360,15 +355,8 @@ ;; _Experimentally_ 50% seems to perform the ;; best, but it would be nice to have a proper ;; analysis... - (flet ((random-fixnum () - (random (1+ most-positive-fixnum)))) - (let ((drops (random-fixnum))) - (declare (fixnum drops)) - (lambda (layouts value) - (when (logbitp 0 drops) - (try-update-cache copy layouts value)) - (when (zerop (ash drops -1)) - (setf drops (random-fixnum)))))) + (randomly-punting-lambda (layouts value) + (try-update-cache copy layouts value)) (lambda (layouts value) (unless (try-update-cache copy layouts value) ;; Didn't fit -- expand the cache, or drop