1.0.48.31: WITH-LOCKED-SYSTEM-TABLE
authorNikodemus Siivola <nikodemus@random-state.net>
Sun, 29 May 2011 21:49:45 +0000 (21:49 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sun, 29 May 2011 21:49:45 +0000 (21:49 +0000)
  Instead of disabling interrupts in user code that needs
  WITH-LOCKED-HASH-TABLE, have a separate WITH-LOCKED-SYSTEM-TABLE
  that does so.

  Use it instead of WITH-LOCKED-HASH-TABLE for all internals.

17 files changed:
contrib/sb-introspect/introspect.lisp
package-data-list.lisp-expr
src/code/class.lisp
src/code/cross-misc.lisp
src/code/debug-int.lisp
src/code/dyncount.lisp
src/code/early-extensions.lisp
src/code/hash-table.lisp
src/code/linkage-table.lisp
src/code/ntrace.lisp
src/code/target-package.lisp
src/code/target-pathname.lisp
src/pcl/defs.lisp
src/pcl/dfun.lisp
src/pcl/fngen.lisp
src/pcl/init.lisp
version.lisp-expr

index 568e844..c7fc14f 100644 (file)
@@ -902,7 +902,7 @@ Experimental: interface subject to change."
                (funcall fun part))))
       (when ext
         (let ((table sb-pcl::*eql-specializer-table*))
-          (call (sb-ext:with-locked-hash-table (table)
+          (call (sb-int:with-locked-system-table (table)
                   (gethash object table)))))
       (etypecase object
         ((or bignum float sb-sys:system-area-pointer fixnum))
index 1dc2002..b77f7de 100644 (file)
@@ -852,6 +852,9 @@ possibly temporariliy, because it might be used internally."
                ;; Stack allocation without any questions asked
                "TRULY-DYNAMIC-EXTENT"
 
+               ;; Like WITH-LOCKED-HASH-TABLE, but disabled interrupts
+               "WITH-LOCKED-SYSTEM-TABLE"
+
                ;; generic set implementation
                "ADD-TO-XSET"
                "ALLOC-XSET"
index 0db908d..38fbef0 100644 (file)
 (defun find-classoid-cell (name &key create errorp)
   (let ((table *classoid-cells*)
         (real-name (uncross name)))
-    (or (with-locked-hash-table (table)
+    (or (with-locked-system-table (table)
           (or (gethash real-name table)
               (when create
                 (setf (gethash real-name table) (make-classoid-cell real-name)))))
 (defun insured-find-classoid (name predicate constructor)
   (declare (type function predicate constructor))
   (let ((table *forward-referenced-layouts*))
-    (with-locked-hash-table (table)
+    (with-locked-system-table (table)
       (let* ((old (find-classoid name nil))
              (res (if (and old (funcall predicate old))
                       old
index 597756a..70d6f35 100644 (file)
   (declare (ignore table))
   `(progn ,@body))
 
+(defmacro with-locked-system-table ((table) &body body)
+  (declare (ignore table))
+  `(progn ,@body))
+
 (defmacro defglobal (name value &rest doc)
   `(eval-when (:compile-toplevel :load-toplevel :execute)
      (defparameter ,name
index b37c0c0..9b973c0 100644 (file)
 ;;; and retains roots to functions that might otherwise be collected.
 (defun make-compiled-debug-fun (compiler-debug-fun component)
   (let ((table *compiled-debug-funs*))
-    (with-locked-hash-table (table)
+    (with-locked-system-table (table)
       (or (gethash compiler-debug-fun table)
           (setf (gethash compiler-debug-fun table)
                 (%make-compiled-debug-fun compiler-debug-fun component))))))
index c9270dc..befac9f 100644 (file)
@@ -37,7 +37,7 @@ comments from CMU CL:
   "Return a hash-table containing only the entries in Table1 whose key is not
    also a key in Table2." (declare (type hash-table table1 table2))
   (let ((res (make-hash-table-like table1)))
-    (with-locked-hash-table (table2)
+    (with-locked-system-table (table2)
       (dohash ((k v) table1 :locked t)
         (unless (nth-value 1 (gethash k table2))
           (setf (gethash k res) v))))
index c589ab9..5f2aa46 100644 (file)
                              ,@forms)))))
         `(let ((,n-table ,table))
            ,(if locked
-                `(with-locked-hash-table (,n-table)
+                `(with-locked-system-table (,n-table)
                    ,iter-form)
                 iter-form))))))
 \f
index d72595c..933b390 100644 (file)
@@ -144,6 +144,10 @@ unspecified."
   ;; Needless to say, this also excludes some internal bits, but
   ;; getting there is too much detail when "unspecified" says what
   ;; is important -- unpredictable, but harmless.
+  `(sb!thread::with-recursive-spinlock ((hash-table-spinlock ,hash-table))
+     ,@body))
+
+(defmacro-mundanely with-locked-system-table ((hash-table) &body body)
   `(sb!thread::with-recursive-system-spinlock
        ((hash-table-spinlock ,hash-table))
      ,@body))
index 6a4a70c..61e21b5 100644 (file)
@@ -60,7 +60,7 @@
 ;;; in the linkage table.
 (defun ensure-foreign-symbol-linkage (name datap)
   (/show0 "ensure-foreign-symbol-linkage")
-  (with-locked-hash-table (*linkage-info*)
+  (with-locked-system-table (*linkage-info*)
     (let ((info (or (gethash (cons name datap) *linkage-info*)
                     (link-foreign-symbol name datap))))
       (linkage-info-address info))))
index 1d74e47..ec90233 100644 (file)
@@ -660,7 +660,7 @@ are evaluated in the null environment."
       ((not fun)
        ;; Someone has FMAKUNBOUND it.
        (let ((table *traced-funs*))
-         (with-locked-hash-table (table)
+         (with-locked-system-table (table)
            (maphash (lambda (fun info)
                       (when (equal function-or-name (trace-info-what info))
                         (remhash fun table)))
index 3f9bb9a..4569a11 100644 (file)
@@ -75,7 +75,7 @@
 
 (defmacro with-package-names ((names &key) &body body)
   `(let ((,names *package-names*))
-     (with-locked-hash-table (,names)
+     (with-locked-system-table (,names)
        ,@body)))
 \f
 ;;;; PACKAGE-HASHTABLE stuff
index 52e81dc..ff023ee 100644 (file)
@@ -1361,7 +1361,7 @@ unspecified elements into a completed to-pathname based on the to-wildname."
 ;;; a new one if necessary.
 (defun intern-logical-host (thing)
   (declare (values logical-host))
-  (with-locked-hash-table (*logical-hosts*)
+  (with-locked-system-table (*logical-hosts*)
     (or (find-logical-host thing nil)
         (let* ((name (logical-word-or-lose thing))
                (new (make-logical-host :name name)))
index 21f0eb8..e7e825d 100644 (file)
 (defun intern-eql-specializer (object)
   ;; Need to lock, so that two threads don't get non-EQ specializers
   ;; for an EQL object.
-  (with-locked-hash-table (*eql-specializer-table*)
+  (with-locked-system-table (*eql-specializer-table*)
     (or (gethash object *eql-specializer-table*)
         (setf (gethash object *eql-specializer-table*)
               (make-instance 'eql-specializer :object object)))))
index be3c163..86019d2 100644 (file)
@@ -1579,7 +1579,7 @@ Except see also BREAK-VICIOUS-METACIRCLE.  -- CSR, 2003-05-28
     nil))
 \f
 ;;; Not synchronized, as all the uses we have for it are multiple ones
-;;; and need WITH-LOCKED-HASH-TABLE in any case.
+;;; and need WITH-LOCKED-SYSTEM-TABLE in any case.
 ;;;
 ;;; FIXME: Is it really more efficient to store this stuff in a global
 ;;; table instead of having a slot in each method?
@@ -1590,7 +1590,7 @@ Except see also BREAK-VICIOUS-METACIRCLE.  -- CSR, 2003-05-28
 
 (defun flush-effective-method-cache (generic-function)
   (let ((cache *effective-method-cache*))
-    (with-locked-hash-table (cache)
+    (with-locked-system-table (cache)
       (dolist (method (generic-function-methods generic-function))
         (remhash method cache)))))
 
@@ -1615,7 +1615,7 @@ Except see also BREAK-VICIOUS-METACIRCLE.  -- CSR, 2003-05-28
           (call-no-applicable-method gf args)))
       (let* ((key (car methods))
              (ht *effective-method-cache*)
-             (ht-value (with-locked-hash-table (ht)
+             (ht-value (with-locked-system-table (ht)
                          (or (gethash key ht)
                              (setf (gethash key ht) (cons nil nil))))))
         (if (and (null (cdr methods)) all-applicable-p ; the most common case
index 548974a..4df2a35 100644 (file)
@@ -89,7 +89,7 @@
 (defvar *fgens* (make-hash-table :test #'equal :synchronized t))
 
 (defun ensure-fgen (test gensyms generator generator-lambda system)
-  (with-locked-hash-table (*fgens*)
+  (with-locked-system-table (*fgens*)
     (let ((old (lookup-fgen test)))
       (cond (old
              (setf (fgen-generator old) generator)
 \f
 (defmacro precompile-function-generators (&optional system)
   (let (collect)
-    (with-locked-hash-table (*fgens*)
+    (with-locked-system-table (*fgens*)
       (maphash (lambda (test fgen)
                  (when (or (null (fgen-system fgen))
                            (eq (fgen-system fgen) system))
index 8a7b123..5b6d913 100644 (file)
@@ -66,7 +66,7 @@
   (let ((type (slot-definition-type slotd)))
     (values
      (when (and (neq t type) (safe-p (slot-definition-class slotd)))
-       (with-locked-hash-table (**typecheck-cache**)
+       (with-locked-system-table (**typecheck-cache**)
          (or (gethash type **typecheck-cache**)
              (setf (gethash type **typecheck-cache**)
                    (handler-bind (((or style-warning compiler-note)
index deb1ff9..cb5efe2 100644 (file)
@@ -20,4 +20,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.48.30"
+"1.0.48.31"