Changeset 11384


Ignore:
Timestamp:
Nov 17, 2008, 1:05:15 PM (11 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.)

Location:
trunk/source/compiler
Files:
2 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))
  • trunk/source/compiler/nxenv.lisp

    r11296 r11384  
    564564    (if (%i> new 255) (setq new 255))
    565565    (setq bits (nx-set-var-bits var (%ilogior (%ilogand (%ilognot $vsetqmask) bits) (%ilsl 8 new))))
    566 ; If a variable is setq'ed from a catch nested within the construct that
    567 ; bound it, it can't be allocated to a register. *
    568 ; * unless it can be proved that the variable isn't referenced
    569 ;   after that catch construct has been exited. **
    570 ; ** or unless the saved value of the register in the catch frame
    571 ;    is also updated.
     566    ;; If a variable is setq'ed from a catch nested within the construct that
     567    ;; bound it, it can't be allocated to a register. *
     568    ;; * unless it can be proved that the variable isn't referenced
     569    ;;   after that catch construct has been exited. **
     570    ;; ** or unless the saved value of the register in the catch frame
     571    ;;    is also updated.
    572572    (when catchp
    573573      (nx-set-var-bits var (%ilogior2 bits (%ilsl $vbitnoreg 1))))
     574    (setf (var-refs var) (+ (the fixnum (var-refs var)) by))
    574575    new))
    575576
Note: See TracChangeset for help on using the changeset viewer.