1.0.15.31: thread-safe FIND-CLASS -- really this time
authorNikodemus Siivola <nikodemus@random-state.net>
Fri, 14 Mar 2008 19:03:05 +0000 (19:03 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Fri, 14 Mar 2008 19:03:05 +0000 (19:03 +0000)
commit4f7161165647d655392713a0d95c951e4e1749ea
treee97864b45f9c032e1d01018309b2038d32aaf565
parent66b919851a8564e8f21247703d54c01c293414f8
1.0.15.31: thread-safe FIND-CLASS -- really this time

  Call It Myopia: it turns out FIND-CLASSOID &co underneath FIND-CLASS
  (when called for non-existent classes) were not thread-safe either.

  * Get rid of *FIND-CLASS* hash-table, moving the actual PCL classes into
    corresponding CLASSOID-CELL (new slot PCL-CLASS).

  * Move classoid-cells from the infodb into into *CLASSOID-CELLS*
    hash-table. We want to be able to lock around

      (or (get-cell) (setf (get-cell) (make-cell)))

    and infodb isn't really designed for that. This is the crux of
    the breakage:

     *** parallel writes to infodb are not thread safe! ***

  * Lock over *CLASSOID-CELLS* and *FORWARD-REFERENCED-LAYOUTS*. The
    latter should not be really necessary as long as we don't
    assume (SETF FIND-CLASS) to be thread-safe, but easier to reason
    about it this way. ...and it would be nice for the SETF to be safe
    as well.

  Related work:

  * Don't create cells for non-exitent classes unless we know we are
    going to need them -- previously both FIND-CLASSOID and FIND-CLASS
    created a cell for every name they were called with, which is
    isn't too good. This is especially important as once created these
    cells never go away!
15 files changed:
package-data-list.lisp-expr
src/code/class-init.lisp
src/code/class.lisp
src/code/defstruct.lisp
src/compiler/compiler-deftype.lisp
src/compiler/fndb.lisp
src/compiler/globaldb.lisp
src/compiler/typetran.lisp
src/pcl/braid.lisp
src/pcl/defs.lisp
src/pcl/early-low.lisp
src/pcl/macros.lisp
src/pcl/wrapper.lisp
tests/threads.pure.lisp
version.lisp-expr