1.0.46.11: faster slot-accesses in the presence of SLOT-VALUE-USING-CLASS &co
authorNikodemus Siivola <nikodemus@random-state.net>
Sun, 20 Feb 2011 11:48:50 +0000 (11:48 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sun, 20 Feb 2011 11:48:50 +0000 (11:48 +0000)
commit0223f43d5f199914ebceff12b6f4c60448369edd
tree7048a94c5a2ba6384fa81e3fcf74e40762c5293e
parent9f175370f90a586b53ce086dce7fadf3cfb80ec4
1.0.46.11: faster slot-accesses in the presence of SLOT-VALUE-USING-CLASS &co

 * Introducing SLOT-INFO: a structure we save into the each
   EFFECTIVE-SLOT-DEFINITION object, which provides us with fast-accesses to
   typecheck, reader, writer, and boundp functions for that slot. (These
   functions already pre-exist, and currently live directly in the slot
   definition objects.)

   This replaces typecheckfuns in permutation vectors, and both the
   typecheckfun and slotd in slot-tables.

   Given this, when we run into SLOT-VALUE in a method body when there is an
   applicable non-standard SLOT-VALUE-USING-CLASS, we don't have to punt to
   the slow path, but can instead replace the SLOT-VALUE form with

    `(funcall (slot-info-reader (svref .pv. (1+ ,pv-offset))) ,parameter)

   which is pretty snappy as these things go. Analogously for SET-SLOT-VALUE,
   and SLOT-BOUNDP.

 * Previously slot typechecking functions were generated as part of the
   DEFCLASS expansion and made part of DIRECT-SLOT-DEFINITION objects. This
   was a bit wasteful, as (1) we don't need them for direct slot definitions,
   and (2) we used to get a separate typechecking function for each slot in
   each safe class, even if they all had the same type.

   Now there's only one typechecking function per type, and that is saved only
   in the SLOT-INFO structure of the relevant effective slot definitions.

 * In a couple of places finalize the class a bit earlier if possible to have
   a better idea of how to best implement slot
   accesses. TRY-FINALIZE-INHERITANCE tries, but refuses if there are forward
   referenced superclasses. CAN-OPTIMIZE-ACCESS will signal a compiler-note
   about such cases.

 * WRAPPER-INSTANCE-SLOTS-LAYOUT now also includes slot-types, and we consider
   the instance to be obsoleted when slot-type changes. (This was a bug that
   our previous type-check-function setup accidentally worked around.)

   Detect slot-type violations while updating instances of safe classes.

   Similarly for CHANGE-CLASS.
14 files changed:
NEWS
src/pcl/braid.lisp
src/pcl/defclass.lisp
src/pcl/defs.lisp
src/pcl/generic-functions.lisp
src/pcl/init.lisp
src/pcl/low.lisp
src/pcl/methods.lisp
src/pcl/slots-boot.lisp
src/pcl/slots.lisp
src/pcl/std-class.lisp
src/pcl/vector.lisp
tests/debug.impure.lisp
version.lisp-expr