From 783418ce37474b4562ae70dd4c1ca68158ab7f1d Mon Sep 17 00:00:00 2001 From: Blake Johnson Date: Fri, 29 Oct 2010 14:22:28 -0600 Subject: [PATCH] only creating zo file --- collects/compiler/demodularizer/batch.rkt | 47 +++++-------------- collects/scribblings/raco/raco.scrbl | 1 + .../compiler/demodularizer/demod-test.rkt | 8 +--- 3 files changed, 16 insertions(+), 40 deletions(-) diff --git a/collects/compiler/demodularizer/batch.rkt b/collects/compiler/demodularizer/batch.rkt index 2553baeaf9..e65df730ac 100644 --- a/collects/compiler/demodularizer/batch.rkt +++ b/collects/compiler/demodularizer/batch.rkt @@ -66,67 +66,46 @@ Here's the idea: ;; 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) - (delete-file compiled-zo-path)) - -(log-debug "Compiling module") +(log-info "Compiling module") (void (system* (find-executable-path "raco") "make" file-to-batch)) -(define merged-source-path (path-add-suffix file-to-batch #".merged.rkt")) -(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"))) +(define merged-zo-path (path-add-suffix file-to-batch #"_merged.zo")) ;; Transformations -(log-debug "Removing dependencies") +(log-info "Removing dependencies") (define-values (batch-nodep top-lang-info top-self-modidx) (nodep-file file-to-batch (excluded-modules))) -(log-debug "Merging modules") +(log-info "Merging modules") (define batch-merge (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 batch-merge #;(gc-toplevels batch-merge)) -(log-debug "Alpha-varying top-levels") +(log-info "Alpha-varying top-levels") (define batch-alpha (alpha-vary-ctop batch-gcd)) -(log-debug "Replacing self-modidx") +(log-info "Replacing self-modidx") (define batch-replace-modidx (replace-modidx batch-alpha top-self-modidx)) (define batch-modname - (string->symbol (regexp-replace #rx"\\.rkt$" (path->string merged-source-name) ""))) -(log-debug (format "Modularizing into ~a" batch-modname)) + (string->symbol (regexp-replace #rx"\\.zo$" (path->string merged-zo-path) ""))) +(log-info (format "Modularizing into ~a" batch-modname)) (define batch-mod (wrap-in-kernel-module batch-modname batch-modname top-lang-info top-self-modidx batch-replace-modidx)) -;; Output -(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") +(log-info "Writing merged zo") (void (with-output-to-file merged-zo-path (lambda () - (zo-marshal-to batch-final (current-output-port))) - #:exists 'replace)) - - - - + (zo-marshal-to batch-mod (current-output-port))) + #:exists 'replace)) \ No newline at end of file diff --git a/collects/scribblings/raco/raco.scrbl b/collects/scribblings/raco/raco.scrbl index 6e97c4bf6e..ee77477fc6 100644 --- a/collects/scribblings/raco/raco.scrbl +++ b/collects/scribblings/raco/raco.scrbl @@ -23,5 +23,6 @@ a typical Racket installation. @include-section["planet.scrbl"] @include-section["setup.scrbl"] @include-section["decompile.scrbl"] +@include-section["demod.scrbl"] @include-section["ctool.scrbl"] @include-section["command.scrbl"] diff --git a/collects/tests/compiler/demodularizer/demod-test.rkt b/collects/tests/compiler/demodularizer/demod-test.rkt index ed29ff1f3e..dec2f03a96 100644 --- a/collects/tests/compiler/demodularizer/demod-test.rkt +++ b/collects/tests/compiler/demodularizer/demod-test.rkt @@ -22,14 +22,12 @@ (define demod-filename (path->string - (path-add-suffix filename #".merged.rkt"))) + (path-add-suffix filename #"_merged.zo"))) ; run whole program (define-values (whole-output whole-error) (capture-output (find-executable-path "racket") demod-filename)) - (display whole-error) - ; compare output (test #:failure-prefix (format "~a stdout" filename) @@ -43,9 +41,7 @@ (and (not (regexp-match #rx"merged" 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))]) (define ip (build-path tests i)) (when (modular-program? ip)