mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 08:47:35 +02:00
WIP
This commit is contained in:
parent
dab0d9a570
commit
2a91c9431e
2 changed files with 15 additions and 5 deletions
13
cyclone.scm
13
cyclone.scm
|
@ -433,21 +433,28 @@
|
|||
(trace:info "---------------- after CPS:")
|
||||
(trace:info (ast:ast->pp-sexp input-program))
|
||||
|
||||
(define
|
||||
*cps-opt-options*
|
||||
(list
|
||||
(cons 'module-globals module-globals)
|
||||
;(cons)
|
||||
))
|
||||
|
||||
(when (> *optimization-level* 0)
|
||||
(set! input-program
|
||||
(optimize-cps input-program))
|
||||
(optimize-cps input-program *cps-opt-options*))
|
||||
(report:elapsed "---------------- after cps optimizations (1):")
|
||||
(trace:info "---------------- after cps optimizations (1):")
|
||||
(trace:info (ast:ast->pp-sexp input-program))
|
||||
|
||||
(set! input-program
|
||||
(optimize-cps input-program))
|
||||
(optimize-cps input-program *cps-opt-options*))
|
||||
(report:elapsed "---------------- after cps optimizations (2):")
|
||||
(trace:info "---------------- after cps optimizations (2):")
|
||||
(trace:info (ast:ast->pp-sexp input-program))
|
||||
|
||||
(set! input-program
|
||||
(optimize-cps input-program))
|
||||
(optimize-cps input-program *cps-opt-options*))
|
||||
(report:elapsed "---------------- after cps optimizations (3):")
|
||||
(trace:info "---------------- after cps optimizations (3):")
|
||||
(trace:info (ast:ast->pp-sexp input-program))
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
(define (memoizable? var body)
|
||||
(define cont #f)
|
||||
(define (scan exp return locals)
|
||||
;(trace:error `(DEBUG scan ,(ast:ast->pp-sexp exp)))
|
||||
(trace:error `(DEBUG scan ,(ast:ast->pp-sexp exp)))
|
||||
;(write `(DEBUG scan ,var ,cont ,(ast:ast->pp-sexp exp))) (newline)
|
||||
(cond
|
||||
;; TODO: reject if a lambda is returned
|
||||
|
@ -163,6 +163,10 @@
|
|||
(let ((new-exp (scan sexp)))
|
||||
(cond
|
||||
((not (null? memo-tbl))
|
||||
(when (pair? module-globals)
|
||||
(set-cdr!
|
||||
module-globals
|
||||
(append (cdr module-globals) (map cdr memo-tbl))))
|
||||
(append
|
||||
(map
|
||||
(lambda (var/new-var)
|
||||
|
@ -207,7 +211,6 @@
|
|||
(lambda
|
||||
(k$41 x$5$21 y$6$22)
|
||||
(k$41 (Cyc-fast-plus x$5$21 y$6$22))))
|
||||
(define mfnc #f)
|
||||
(define ack
|
||||
(lambda
|
||||
(k$46 m$7$23 n$8$24)
|
||||
|
|
Loading…
Add table
Reference in a new issue