Changeset 7923


Ignore:
Timestamp:
Dec 19, 2007, 8:16:17 PM (13 years ago)
Author:
wws
Message:

optimize-generic-function-dispatching now calls
override-one-method-one-arg-dcode on methods that specialize on only
the second argument. This enables customization of CLOS writer
methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-1/l1-clos.lisp

    r7900 r7923  
    17531753(defun optimize-generic-function-dispatching ()
    17541754  (dolist (gf (population.data %all-gfs%))
    1755     (when (eq #'%%one-arg-dcode (%gf-dcode gf))
     1755    (optimize-dispatching-for-gf gf)))
     1756
     1757(defun optimize-dispatching-for-gf (gf)
     1758  (let* ((dcode (%gf-dcode gf)))
     1759    (when (or (eq dcode #'%%one-arg-dcode)
     1760              (eq dcode #'%%nth-arg-dcode))
    17561761      (let ((methods (generic-function-methods gf)))
    1757         (when (eql 1 (length methods))
    1758           (override-one-method-one-arg-dcode gf (car methods)))))))
    1759 
    1760 
     1762        (when (and methods (null (cdr methods)))
     1763          (when (or (eq #'%%one-arg-dcode dcode)
     1764                    (and (eq #'%%nth-arg-dcode dcode)
     1765                         (let ((spec (method-specializers (car methods)))
     1766                               (argnum (%gf-dispatch-table-argnum
     1767                                        (%gf-dispatch-table gf))))
     1768                           (and (eql 2 (length spec))
     1769                                (and (eql argnum 1) (eq (car spec) *t-class*))))))
     1770            (override-one-method-one-arg-dcode gf (car methods))))))))
    17611771
    17621772;;; dcode for a GF with a single reader method which accesses
Note: See TracChangeset for help on using the changeset viewer.