Added an option to see the result of the optimizer before compiling.
This commit is contained in:
parent
27f0e50d53
commit
1d758ee782
|
@ -2,6 +2,7 @@
|
|||
|
||||
(require syntax/parse
|
||||
syntax/id-table racket/dict
|
||||
racket/pretty
|
||||
(for-template scheme/base
|
||||
scheme/flonum scheme/fixnum scheme/unsafe/ops
|
||||
racket/private/for)
|
||||
|
@ -91,7 +92,10 @@
|
|||
#:with e*:opt-expr #'e
|
||||
#'e*.opt]
|
||||
[e:expr #'e])])
|
||||
((optimize) stx))
|
||||
(let ((result ((optimize) stx)))
|
||||
(when *show-optimized-code*
|
||||
(pretty-print (syntax->datum result)))
|
||||
result))
|
||||
(when (and *log-optimizations?*
|
||||
*log-optimizatons-to-log-file?*)
|
||||
(close-output-port port)))))
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
(types abbrev type-table utils subtype)
|
||||
(rep type-rep))
|
||||
|
||||
(provide log-optimization *log-optimizations?* *log-optimizatons-to-log-file?* *optimization-log-file*
|
||||
(provide log-optimization *log-optimizations?* *log-optimizatons-to-log-file?*
|
||||
*optimization-log-file* *show-optimized-code*
|
||||
subtypeof? isoftype?
|
||||
mk-unsafe-tbl
|
||||
n-ary->binary
|
||||
|
@ -25,6 +26,8 @@
|
|||
(syntax->datum stx)
|
||||
kind)
|
||||
#t))
|
||||
;; if set to #t, the optimizer will dump its result to stdout before compilation
|
||||
(define *show-optimized-code* #f)
|
||||
|
||||
;; is the syntax object s's type a subtype of t?
|
||||
(define (subtypeof? s t)
|
||||
|
|
Loading…
Reference in New Issue
Block a user