Add recompile
option to raco demod
. (#1373)
Originally by @bdj in racket/compiler#7.
This commit is contained in:
parent
c3355f6df2
commit
eec3684dbd
|
@ -55,6 +55,8 @@ Here's the idea:
|
|||
(output-file (string->path dest-filename))]
|
||||
[("-g" "--garbage-collect") "Garbage-collect final module (unsound)"
|
||||
(garbage-collect-toplevels-enabled #t)]
|
||||
[("-r" "--recompile") "Recompile final module to re-run optimizations"
|
||||
(recompile-enabled #t)]
|
||||
#:args (filename)
|
||||
(demodularize filename (output-file))))
|
||||
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
|
||||
(provide current-excluded-modules
|
||||
garbage-collect-toplevels-enabled
|
||||
recompile-enabled
|
||||
demodularize)
|
||||
|
||||
(define garbage-collect-toplevels-enabled (make-parameter #f))
|
||||
(define recompile-enabled (make-parameter #f))
|
||||
|
||||
(define logger (make-logger 'demodularizer (current-logger)))
|
||||
|
||||
|
@ -74,4 +76,16 @@
|
|||
merged-zo-path
|
||||
(lambda ()
|
||||
(zo-marshal-to batch-mod (current-output-port)))
|
||||
#:exists 'replace))))
|
||||
#:exists 'replace))
|
||||
|
||||
(void
|
||||
(when (recompile-enabled)
|
||||
(define recomp
|
||||
(compiled-expression-recompile
|
||||
(parameterize ([read-accept-compiled #t])
|
||||
(call-with-input-file merged-zo-path read))))
|
||||
(call-with-output-file merged-zo-path
|
||||
(lambda (out)
|
||||
(write recomp out))
|
||||
#:exists 'replace)))))
|
||||
|
||||
|
|
|
@ -102,7 +102,12 @@
|
|||
(make-module-code modvar-rewrite lang-info ctop))))))
|
||||
|
||||
(define (nodep/dir top pth phase)
|
||||
(parameterize ([current-module-path pth])
|
||||
(define pth*
|
||||
(cond
|
||||
[(string? pth) (string->path pth)]
|
||||
[(list? pth) (cadr pth)]
|
||||
[else pth]))
|
||||
(parameterize ([current-module-path pth*])
|
||||
(nodep top phase)))
|
||||
|
||||
(define (nodep top phase)
|
||||
|
|
Loading…
Reference in New Issue
Block a user