[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Translator



    Date: Sat, 15 Sep 90 17:10:30 EDT
    From: barmar@Think.COM

       Date: Sat, 15 Sep 90 11:14 EDT
       From: Kalman Reti <Reti@WESER.sreti.symbolics.com>
			      This will get the new definition when a redefinition
       occurs, but will avoid the paging overhead of having to reference the symbol
       (which is likely to be far away from the function cell).

    The function cell is *in* the symbol.

The function cell is *sometimes* in the symbol.  Other times
it lives in the function object.  For example:

(eq (locf (sys:cca-function-cell (sys:compiled-function-cca #'print)))
    (locf #'print))

==> T

and

(eq (locf (sys:cca-function-cell (sys:compiled-function-cca #'print)))
    (follow-cell-forwarding (locf (symbol-function 'print)) t))

==> T

This greatly improves the locality of programs, since the symbols do
not have to be paged in to call the functions.  This is one of the
big improvements of the 3600 and later systems over the CADR family.

I don't know offhand exactly when this forwarding takes place, but
it's pretty aggressive.  There's another hack that's done; there's
a series of tables for function cells (and value cells of special
variables) that would otherwise have to live in the symbol.  For
example, generic functions.  Again, the goal is to improve locality
to avoiding the need to page in symbols on function calls.

(defun yow (x) x)
YOW
(describe (locf #'yow))
#<LOCATIVE to #'YOW 21110016074> is a locative pointer to the function definition cell of YOW
It points into area SYS:PERMANENT-STORAGE-AREA
It points to word 734 of #S(SI:FORWARDED-SYMBOL-CELL-TABLE)

    #<FORWARDED-SYMBOL-CELL-TABLE 21110015140> is an ART-Q type array.
    It has a short array header
    It is 1,000 elements long, with a leader of length 3.
    It has dimensions (1000)
    
#<LOCATIVE to #'YOW 21110016074>

(dotimes (i 735) (print (locf (aref (first si:*all-forwarded-symbol-cell-tables*) i))))
#<LOCATIVE to #'CI::WINDOW-SCROLL-BAR-FRACTIONS 21110015141> 
#<LOCATIVE to #'CI::DEFINE-SLOT-ACCESSING-MACRO 21110015142> 
#<LOCATIVE to CI::*SLOT-ACCESSING-MACROS* 21110015143> 
#<LOCATIVE to #'CI::WITH-SLOTS-BOUND-AS-NEEDED 21110015144> 
#<LOCATIVE to #'CI::CALCULATING-BOUNDING-BOX 21110015145> 
#<LOCATIVE to #'CI::INCLUDE-POINT 21110015146> 
#<LOCATIVE to #'CI::LS-THICKNESS 21110015147> 
#<LOCATIVE to #'CI::BOUNDING-BOX-EDGES* 21110015150> 
#<LOCATIVE to #'CI::DECACHE-BOUNDING-BOX-EDGES* 21110015151> 
#<LOCATIVE to #'CI::HIGHLIGHT-OUTPUT-RECORD-1 21110015152> 
#<LOCATIVE to CI:*CLIM-INTERNALS-PACKAGE* 21110015153> 
#<LOCATIVE to #'CI::DEFINE-GRAPHICS-OPERATOR 21110015154> 
#<LOCATIVE to #'CI::BOUNDING-BOX-FROM-COORDINATE-SEQUENCE 21110015155> 
#<LOCATIVE to #'CI::DO-COORDINATES 21110015156> 
#<LOCATIVE to #'CI::COMPUTE-DRAW-TEXT-BOUNDING-BOX 21110015157> 
#<LOCATIVE to #'CI::INTERACTIVE-STREAM-P 21110015160> 
#<LOCATIVE to #'CI::INPUT-EDITOR-BUFFER 21110015161> 
#<LOCATIVE to #'CLIM:INPUT-POSITION 21110015162> 
#<LOCATIVE to #'CI::INSERTION-POINTER 21110015163> 
 ...

Note that during redefinition, to get full benefits
and to be able to GC the old functions, the system
must forward the old cell (in the obsolete function)
to the new cell in the new function, and update
references to the new cell.  Again, I'm not certain
of the exact time it does this, but before full-gc
and disk save come to mind as likely candidates.