Ignore:
Timestamp:
Nov 17, 2008, 1:05:15 PM (13 years ago)
Author:
gb
Message:

When incrementing/propagating a variable's assignment/reference
counts, increment the VAR-REFS slot as well. (Separate instances of
inherited lexical variables are represented as separate per-function
VARs in which the child references the parent via the VAR-BITS slot
and information about "the variable as a whole, in all functions that
reference/set it" is maintained in the parent's VAR-BITS. Keeping
reference-count info per function (and not sharing structure so much)
should give us a clearer idea of which inherited variables are good
candidates for register allocation. (Until now, we've tended to
overestimate the number of times a variable's referenced in the
parent, since the shared ref info includes references from inner
functions, and have avoided NVR allocation in the child (because
that has updated shared info and confused things in the parent.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/nx0.lisp

    r11373 r11384  
    12811281                                 (%ilsl $vbitpuntable 1)
    12821282                                 (%i- varbits varcount)))
    1283               (nx-set-var-bits
    1284                boundto
    1285                  (%i+ (%i- boundtobits boundtocount)
    1286                       (%ilogand $vrefmask
    1287                                 (%i+ (%i- boundtocount 1) varcount)))))))))
    1288 
    1289 ;; Home-baked handler-case replacement.  About 10 times as fast as full handler-case.
    1290 ;;(LET ((S 0)) (DOTIMES (I 1000000) (INCF S))) took 45,678 microseconds
    1291 ;;(LET ((S 0)) (DOTIMES (I 1000000) (BLOCK X (ERROR (CATCH 'X (RETURN-FROM X (INCF S))))))) took 57,485
    1292 ;;(LET ((S 0)) (DOTIMES (I 1000000) (HANDLER-CASE (INCF S) (ERROR (C) C)))) took 168,947
     1283          (setf (var-refs var) (+ (var-refs var) (var-refs boundto)))
     1284          (nx-set-var-bits
     1285           boundto
     1286           (%i+ (%i- boundtobits boundtocount)
     1287                (%ilogand $vrefmask
     1288                          (%i+ (%i- boundtocount 1) varcount)))))))))
     1289
     1290;;; Home-baked handler-case replacement.  About 10 times as fast as full handler-case.
     1291;;;(LET ((S 0)) (DOTIMES (I 1000000) (INCF S))) took 45,678 microseconds
     1292;;;(LET ((S 0)) (DOTIMES (I 1000000) (BLOCK X (ERROR (CATCH 'X (RETURN-FROM X (INCF S))))))) took 57,485
     1293;;;(LET ((S 0)) (DOTIMES (I 1000000) (HANDLER-CASE (INCF S) (ERROR (C) C)))) took 168,947
    12931294(defmacro with-program-error-handler (handler &body body)
    12941295  (let ((tag (gensym)))
     
    23452346         (by (if temp-p 1 (expt  4 *nx-loop-nesting-level*)))
    23462347         (new (%imin (%i+ (%ilogand2 $vrefmask bits) by) 255)))
     2348    (setf (var-refs var) (+ (var-refs var) by))
    23472349    (nx-set-var-bits var (%ilogior (%ilogand (%ilognot $vrefmask) bits) new))
    23482350    new))
Note: See TracChangeset for help on using the changeset viewer.