only creating zo file

This commit is contained in:
Blake Johnson 2010-10-29 14:22:28 -06:00 committed by Jay McCarthy
parent a315f79ebd
commit 783418ce37
3 changed files with 16 additions and 40 deletions

View File

@ -66,67 +66,46 @@ Here's the idea:
;; Compile ;; Compile
#;(log-debug "Removing existing zo file")
#;(define compiled-zo-path (build-compiled-path base (path-add-suffix name #".zo")))
#;(when (file-exists? compiled-zo-path) (log-info "Compiling module")
(delete-file compiled-zo-path))
(log-debug "Compiling module")
(void (system* (find-executable-path "raco") "make" file-to-batch)) (void (system* (find-executable-path "raco") "make" file-to-batch))
(define merged-source-path (path-add-suffix file-to-batch #".merged.rkt")) (define merged-zo-path (path-add-suffix file-to-batch #"_merged.zo"))
(define merged-struct-path (path-add-suffix file-to-batch #".mergeds.rkt"))
(define-values (merged-source-base merged-source-name _1) (split-path merged-source-path))
(define merged-zo-path (build-compiled-path merged-source-base (path-add-suffix merged-source-name #".zo")))
;; Transformations ;; Transformations
(log-debug "Removing dependencies") (log-info "Removing dependencies")
(define-values (batch-nodep top-lang-info top-self-modidx) (define-values (batch-nodep top-lang-info top-self-modidx)
(nodep-file file-to-batch (excluded-modules))) (nodep-file file-to-batch (excluded-modules)))
(log-debug "Merging modules") (log-info "Merging modules")
(define batch-merge (define batch-merge
(merge-compilation-top batch-nodep)) (merge-compilation-top batch-nodep))
(log-debug "GC-ing top-levels") ; Not doing this for now
;(log-info "GC-ing top-levels")
(define batch-gcd (define batch-gcd
batch-merge batch-merge
#;(gc-toplevels batch-merge)) #;(gc-toplevels batch-merge))
(log-debug "Alpha-varying top-levels") (log-info "Alpha-varying top-levels")
(define batch-alpha (define batch-alpha
(alpha-vary-ctop batch-gcd)) (alpha-vary-ctop batch-gcd))
(log-debug "Replacing self-modidx") (log-info "Replacing self-modidx")
(define batch-replace-modidx (define batch-replace-modidx
(replace-modidx batch-alpha top-self-modidx)) (replace-modidx batch-alpha top-self-modidx))
(define batch-modname (define batch-modname
(string->symbol (regexp-replace #rx"\\.rkt$" (path->string merged-source-name) ""))) (string->symbol (regexp-replace #rx"\\.zo$" (path->string merged-zo-path) "")))
(log-debug (format "Modularizing into ~a" batch-modname)) (log-info (format "Modularizing into ~a" batch-modname))
(define batch-mod (define batch-mod
(wrap-in-kernel-module batch-modname batch-modname top-lang-info top-self-modidx batch-replace-modidx)) (wrap-in-kernel-module batch-modname batch-modname top-lang-info top-self-modidx batch-replace-modidx))
;; Output (log-info "Writing merged zo")
(define batch-final batch-mod)
(log-debug "Writing merged source")
(with-output-to-file
merged-source-path
(lambda ()
(write batch-final))
#:exists 'replace)
(log-debug "Writing merged zo")
(void (void
(with-output-to-file (with-output-to-file
merged-zo-path merged-zo-path
(lambda () (lambda ()
(zo-marshal-to batch-final (current-output-port))) (zo-marshal-to batch-mod (current-output-port)))
#:exists 'replace)) #:exists 'replace))

View File

@ -23,5 +23,6 @@ a typical Racket installation.
@include-section["planet.scrbl"] @include-section["planet.scrbl"]
@include-section["setup.scrbl"] @include-section["setup.scrbl"]
@include-section["decompile.scrbl"] @include-section["decompile.scrbl"]
@include-section["demod.scrbl"]
@include-section["ctool.scrbl"] @include-section["ctool.scrbl"]
@include-section["command.scrbl"] @include-section["command.scrbl"]

View File

@ -22,14 +22,12 @@
(define demod-filename (define demod-filename
(path->string (path->string
(path-add-suffix filename #".merged.rkt"))) (path-add-suffix filename #"_merged.zo")))
; run whole program ; run whole program
(define-values (whole-output whole-error) (define-values (whole-output whole-error)
(capture-output (find-executable-path "racket") demod-filename)) (capture-output (find-executable-path "racket") demod-filename))
(display whole-error)
; compare output ; compare output
(test (test
#:failure-prefix (format "~a stdout" filename) #:failure-prefix (format "~a stdout" filename)
@ -43,9 +41,7 @@
(and (not (regexp-match #rx"merged" filename)) (and (not (regexp-match #rx"merged" filename))
(regexp-match #rx"rkt$" filename))) (regexp-match #rx"rkt$" filename)))
(test-on-program "/Users/blake/Development/plt/collects/tests/compiler/demodularizer/tests/racket-5.rkt") (test
#;(test
(for ([i (in-list (directory-list tests))]) (for ([i (in-list (directory-list tests))])
(define ip (build-path tests i)) (define ip (build-path tests i))
(when (modular-program? ip) (when (modular-program? ip)