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