Test optimization changes

This commit is contained in:
Justin Ethier 2016-03-11 02:19:20 -05:00
parent 4e9a209f43
commit 4c2b56b19e

View file

@ -1458,9 +1458,10 @@
ast) ast)
(else (else
(cps ast '%halt))))) (cps ast '%halt)))))
ast-cps)) ; ast-cps))
;; TODO: use for temporary testing of optimizations ;; TODO: use for temporary testing of optimizations
; (cps-optimize-01 ast-cps))) ;; eventually will want to call this explicitly from cyclone.scm
(cps-optimize-01 ast-cps)))
;; CPS optimizations ;; CPS optimizations
@ -1469,13 +1470,13 @@
(define (cps-optimize-01 exp) (define (cps-optimize-01 exp)
(define (opt-lambda exp) (define (opt-lambda exp)
(let ((body (car (lambda->exp exp)))) ;; Single expr after CPS (let ((body (car (lambda->exp exp)))) ;; Single expr after CPS
(trace:error `(DEBUG ;(trace:error `(DEBUG
,exp ; ,exp
,body ; ,body
,(if (and (pair? body) (app? body) (lambda? (car body))) ; ,(if (and (pair? body) (app? body) (lambda? (car body)))
(list (app->args body) ; (list (app->args body)
(lambda->formals exp)) ; (lambda->formals exp))
#f))) ; #f)))
(cond (cond
;; Does the function just call its continuation? ;; Does the function just call its continuation?
((and (pair? body) ((and (pair? body)