Changeset 10452


Ignore:
Timestamp:
Aug 12, 2008, 11:50:13 PM (11 years ago)
Author:
gb
Message:

Get rid of #+lock-accounting stuff, which was never very useful and
may add overhead even when it's not used. (There may be more
#+lock-accounting stuff elsewhere.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-misc.lisp

    r10161 r10452  
    2222(defparameter *lock-conses* ())
    2323
    24 ;; Cold-load lossage.
    25 #+lock-accounting
    26 (setq *lock-conses* (make-list 20))
    27 
    28 ;;; Per-thread consing, for lock-ownership tracking.
    29 #+lock-accounting
    30 (defun %lock-cons (x y)
    31   (let* ((cell (prog1 *lock-conses*
    32                  (setq *lock-conses* (cdr *lock-conses*)))))
    33     (if cell
    34       (progn
    35         (rplaca cell x)
    36         (rplacd cell y))
    37       (cons x y))))
     24
    3825
    3926
     
    528515  (declaim (inline note-lock-wait note-lock-held note-lock-released)))
    529516
    530 (defun note-lock-wait (lock)
    531   #+lock-accounting
    532   (setq *locks-pending* (%lock-cons lock *locks-pending*))
    533   #-lock-accounting (declare (ignore lock)))
    534 
    535 (defun note-lock-held ()
    536   #+lock-accounting
    537   (let* ((p *locks-pending*))
    538     (setq *locks-pending* (cdr *locks-pending*))
    539     (rplacd p *locks-held*)
    540     (setq *locks-held* p)))
    541 
    542 (defun note-lock-released ()
    543   #+lock-accounting
    544   (setf (car *locks-held*) nil
    545         *locks-held* (cdr *locks-held*)))
     517
     518
     519
    546520
    547521#-futex
     
    556530        (setf (lock-acquisition.status flag) nil)
    557531        (if flag (report-bad-arg flag 'lock-acquisition)))
    558       (note-lock-wait lock)
    559532      (loop
    560533        (without-interrupts
    561534         (when (eql p owner)
    562535           (incf (%get-natural ptr target::lockptr.count))
    563            (note-lock-held)
    564536           (when flag
    565537             (setf (lock-acquisition.status flag) t))
     
    570542                 (%get-natural ptr target::lockptr.count) 1)
    571543           (setf (%get-natural spin 0) 0)
    572            (note-lock-held)
    573544           (if flag
    574545             (setf (lock-acquisition.status flag) t))
     
    634605         (ptr (recursive-lock-ptr lock)))
    635606    (declare (fixnum self))
    636     (note-lock-wait lock)
    637607    (without-interrupts
    638608     (cond ((eql self (%get-object ptr target::lockptr.owner))
     
    641611              (%set-object ptr target::lockptr.owner self)
    642612              (setf (%get-natural ptr target::lockptr.count) 1)))
    643      (note-lock-held)
    644613     (when flag
    645614       (setf (lock-acquisition.status flag) t))
     
    722691       (when (eql 0 (decf (the fixnum
    723692                            (%get-natural ptr target::lockptr.count))))
    724          (note-lock-released)
    725693         (%get-spin-lock spin)
    726694         (setf (%get-ptr ptr target::lockptr.owner) (%null-ptr))
     
    749717     (when (eql 0 (decf (the fixnum
    750718                          (%get-natural ptr target::lockptr.count))))
    751     (note-lock-released)
    752719    (setf (%get-natural ptr target::lockptr.owner) 0)
    753720    (%unlock-futex ptr))))
     
    837804           (tcr (%current-tcr)))
    838805      (declare (fixnum tcr))
    839       (note-lock-wait lock)
    840806      (without-interrupts
    841807       (%get-spin-lock ptr)               ;(%get-spin-lock (%inc-ptr ptr target::rwlock.spin))
     
    844810           (incf (%get-signed-natural ptr target::rwlock.state))
    845811           (setf (%get-natural ptr target::rwlock.spin) 0)
    846            (note-lock-held)
    847812           (if flag
    848813             (setf (lock-acquisition.status flag) t))
     
    851816              ((eql 0 (%get-signed-natural ptr target::rwlock.state))
    852817               ;; That wasn't so bad, was it ?  We have the spinlock now.
    853                (note-lock-held)
    854818               (setf (%get-signed-natural ptr target::rwlock.state) 1
    855819                     (%get-natural ptr target::rwlock.spin) 0)
     
    872836           (tcr (%current-tcr)))
    873837      (declare (fixnum tcr))
    874       (note-lock-wait lock)
    875838      (without-interrupts
    876839       (%lock-futex ptr level lock nil)
     
    879842           (incf (%get-signed-natural ptr target::rwlock.state))
    880843           (%unlock-futex ptr)
    881            (note-lock-held)
    882844           (if flag
    883845             (setf (lock-acquisition.status flag) t))
     
    886848              ((eql 0 (%get-signed-natural ptr target::rwlock.state))
    887849               ;; That wasn't so bad, was it ?  We have the spinlock now.
    888                (note-lock-held)
    889850               (setf (%get-signed-natural ptr target::rwlock.state) 1)
    890851               (%unlock-futex ptr)
     
    916877           (tcr (%current-tcr)))
    917878      (declare (fixnum tcr))
    918       (note-lock-wait lock)
    919879      (without-interrupts
    920880       (%get-spin-lock ptr)             ;(%get-spin-lock (%inc-ptr ptr target::rwlock.spin))
     
    932892                     (the fixnum (1- state))
    933893                     (%get-natural ptr target::rwlock.spin) 0)
    934                (note-lock-held)
    935894               (if flag
    936895                 (setf (lock-acquisition.status flag) t))
     
    952911           (tcr (%current-tcr)))
    953912      (declare (fixnum tcr))
    954       (note-lock-wait lock)
    955913      (without-interrupts
    956914       (%lock-futex ptr level lock nil)
     
    967925               (setf (%get-signed-natural ptr target::rwlock.state)
    968926                     (the fixnum (1- state)))
    969                (note-lock-held)
    970927               (%unlock-futex ptr)
    971928               (if flag
     
    1027984         ;; are cleared here (they can't be changed from another thread
    1028985         ;; until this thread releases the spinlock.)
    1029          (note-lock-released)
    1030986         (setf (%get-signed-natural ptr target::rwlock.writer) 0)
    1031987         (let* ((nwriters (%get-natural ptr target::rwlock.blocked-writers))
     
    10641020       (setf (%get-signed-natural ptr target::rwlock.state) state)
    10651021       (when (zerop state)
    1066          (note-lock-released)
    10671022         (setf (%get-signed-natural ptr target::rwlock.writer) 0)
    10681023         (let* ((nwriters (%get-natural ptr target::rwlock.blocked-writers))
Note: See TracChangeset for help on using the changeset viewer.