Changeset 12398 in project


Ignore:
Timestamp:
11/07/08 15:11:26 (12 years ago)
Author:
felix winkelmann
Message:

allocation estimation in preparation phase of the compiler takes maximum allocation for each conditional branch, not sum

Location:
chicken/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/TODO

    r12359 r12398  
    77*** pre-optimization
    88**** changes call-sites and makes them invalid for later pre-optimization
     9
    910** expander
    1011*** when import-libraries are used, reference to unexported syntax in exported syntax fails
     
    1516*** dirty-macros.scm loops when using `defile'
    1617    possibly due to unrenamed special forms
     18
    1719** modules
    1820*** chicken.import.scm refers to ##sys#chicken-macro-environment
     
    5860** compiler
    5961*** remove "custom-declare" + stuff?
     62*** generate object-files in /tmp (or TMPDIR)?
     63
     64** csc
     65*** automatically compile import-libraries?
    6066
    6167** setup/install
     
    95101* optimizations
    96102
    97 ** allocation-estimation in conditionals should take max of both branches, not sum
    98 
    99103** self-recursion optimization
    100104   what MacScheme called "benchmark-mode" (assume self-calls are recursion)
  • chicken/trunk/compiler.scm

    r12301 r12398  
    25852585                   (else (make-node '##core#literal (list (literal c)) '())) ) ) )
    25862586
    2587           ;;*** conditionals (if + ##core#cond) are missing here: allocation
    2588           ;; calculation should use max of both branches, not sum.
     2587          ((if ##core#cond)
     2588           (let* ((test (walk (first subs) e here boxes))
     2589                  (a0 allocated)
     2590                  (x1 (walk (second subs) e here boxes))
     2591                  (a1 allocated)
     2592                  (x2 (walk (third subs) e here boxes)))
     2593             (set! allocated (+ a0 (max (- allocated a1) (- a1 a0))))
     2594             (make-node class params (list test x1 x2))))
     2595
     2596          ((##core#switch)
     2597           (let* ((exp (walk (first subs) e here boxes))
     2598                  (a0 allocated))
     2599             (make-node
     2600              class
     2601              params
     2602              (cons
     2603               exp
     2604               (let loop ((j (first params)) (subs (cdr subs)) (ma 0))
     2605                 (set! allocated a0)
     2606                 (if (zero? j)
     2607                     (let ((def (walk (car subs) e here boxes)))
     2608                       (set! allocated (+ a0 (max ma (- allocated a0))))
     2609                       (list def))
     2610                     (let* ((const (walk (car subs) e here boxes))
     2611                            (body (walk (cadr subs) e here boxes)))
     2612                       (cons*
     2613                        const body
     2614                        (loop (sub1 j) (cddr subs) (max (- allocated a0) ma))))))))))
    25892615
    25902616          (else (make-node class params (mapwalk subs e here boxes)) ) ) ) )
Note: See TracChangeset for help on using the changeset viewer.