Commenting-out beta expansion candidate search

This commit is contained in:
Justin Ethier 2016-06-02 23:24:32 -04:00
parent bb48e32600
commit 5f5bfb7290

View file

@ -17,8 +17,8 @@
; can write initial analyze, but can't get too far without being able ; can write initial analyze, but can't get too far without being able
; to uniquely ID each lambda ; to uniquely ID each lambda
(define-library (cps-optimizations) ;(define-library (cps-optimizations)
;(define-library (scheme cyclone cps-optimizations) (define-library (scheme cyclone cps-optimizations)
(import (scheme base) (import (scheme base)
(scheme cyclone util) (scheme cyclone util)
(scheme cyclone ast) (scheme cyclone ast)
@ -418,32 +418,33 @@
(define (analyze-cps exp) (define (analyze-cps exp)
(analyze exp -1) ;; Top-level is lambda ID -1 (analyze exp -1) ;; Top-level is lambda ID -1
(analyze2 exp) ;; Second pass (analyze2 exp) ;; Second pass
;; TODO: ;; For now, beta expansion finds so few candidates it is not worth optimizing
;; Find candidates for beta expansion ;; ;; TODO:
(for-each ;; ;; Find candidates for beta expansion
(lambda (db-entry) ;; (for-each
;(trace:error `(check for lambda candidate ;; (lambda (db-entry)
(cond ;;;(trace:error `(check for lambda candidate
((number? (car db-entry)) ;; (cond
;; TODO: this is just exploratory code, can be more efficient ;; ((number? (car db-entry))
(let ((id (car db-entry)) ;; ;; TODO: this is just exploratory code, can be more efficient
(fnc (cdr db-entry)) ;; (let ((id (car db-entry))
(app-count 0) ;; (fnc (cdr db-entry))
(app-arg-count 0) ;; (app-count 0)
(reassigned-count 0)) ;; (app-arg-count 0)
(for-each ;; (reassigned-count 0))
(lambda (sym) ;; (for-each
(with-var! sym (lambda (var) ;; (lambda (sym)
(set! app-count (+ app-count (adbv:app-fnc-count var))) ;; (with-var! sym (lambda (var)
(set! app-arg-count (+ app-arg-count (adbv:app-arg-count var))) ;; (set! app-count (+ app-count (adbv:app-fnc-count var)))
(set! reassigned-count (+ reassigned-count (if (adbv:reassigned? var) 1 0))) ;; (set! app-arg-count (+ app-arg-count (adbv:app-arg-count var)))
)) ;; (set! reassigned-count (+ reassigned-count (if (adbv:reassigned? var) 1 0)))
) ;; ))
(adbf:assigned-to-var fnc)) ;; )
(trace:error `(candidate ,id ,app-count ,app-arg-count ,reassigned-count)) ;; (adbf:assigned-to-var fnc))
)))) ;;(trace:error `(candidate ,id ,app-count ,app-arg-count ,reassigned-count))
(hash-table->alist *adb*)) ;; ))))
;; END TODO ;; (hash-table->alist *adb*))
;; ;; END TODO
) )
;; NOTES: ;; NOTES: