make the optimizer slightly smarter, so that it can see through more patterns of nested let and letrec procedure bindings

svn: r12434

original commit: 59f3f19f84
This commit is contained in:
Matthew Flatt 2008-11-14 00:48:54 +00:00
parent c3ee691e9d
commit 66ad436925
2 changed files with 5 additions and 4 deletions

View File

@ -40,7 +40,7 @@
;; Main entry: ;; Main entry:
(define (decompile top) (define (decompile top)
(match top (match top
[(struct compilation-top (_ prefix form)) [(struct compilation-top (max-let-depth prefix form))
(let-values ([(globs defns) (decompile-prefix prefix)]) (let-values ([(globs defns) (decompile-prefix prefix)])
`(begin `(begin
,@defns ,@defns
@ -88,7 +88,7 @@
(define (decompile-module mod-form stack) (define (decompile-module mod-form stack)
(match mod-form (match mod-form
[(struct mod (name self-modidx prefix provides requires body syntax-body)) [(struct mod (name self-modidx prefix provides requires body syntax-body max-let-depth))
(let-values ([(globs defns) (decompile-prefix prefix)] (let-values ([(globs defns) (decompile-prefix prefix)]
[(stack) (append '(#%modvars) stack)]) [(stack) (append '(#%modvars) stack)])
`(module ,name .... `(module ,name ....

View File

@ -23,7 +23,7 @@
;; In stxs of prefix: ;; In stxs of prefix:
(define-form-struct stx (encoded)) ; todo: decode syntax objects (define-form-struct stx (encoded)) ; todo: decode syntax objects
(define-form-struct mod (name self-modidx prefix provides requires body syntax-body)) (define-form-struct mod (name self-modidx prefix provides requires body syntax-body max-let-depth))
(define-form-struct lam (name flags num-params rest? closure-map max-let-depth body)) ; `lambda' (define-form-struct lam (name flags num-params rest? closure-map max-let-depth body)) ; `lambda'
(define-form-struct closure (code gen-id)) ; a static closure (nothing to close over) (define-form-struct closure (code gen-id)) ; a static closure (nothing to close over)
@ -220,7 +220,8 @@
make-def-for-syntax make-def-for-syntax
make-def-syntaxes) make-def-syntaxes)
ids expr prefix max-let-depth)])) ids expr prefix max-let-depth)]))
(vector->list syntax-body)))]))])) (vector->list syntax-body))
max-let-depth)]))]))
(define (read-module-wrap v) (define (read-module-wrap v)
v) v)