[plt-scheme] compiler/compiler vs mzc
When you run a program in DrScheme with debugging enabled, anything
that is compiled in a namespace with the same module registry as the
main program is instrumented for debugging.
You can avoid DrScheme's debugging annotation by creating a new
namespace. Compare
#lang racket
(require compiler/zo-parse)
(zo-parse (let-values ([(r w) (make-pipe)])
(write (compile #'(module m racket (+ cons 1))) w)
(close-output-port w)
r))
to
#lang racket
(require compiler/zo-parse)
(zo-parse (let-values ([(r w) (make-pipe)])
(parameterize ([current-namespace (make-base-empty-namespace)])
(write (compile #'(module m racket (+ cons 1))) w))
(close-output-port w)
r))
At Tue, 18 May 2010 17:31:41 -0400, Danny Yoo wrote:
> I'm getting different results of generated bytecode between using the
> compiler/compiler collection and mzc. I believe the distinguishing
> feature is that I'm using compiler/compiler through DrScheme. For
> example, when compiling:
>
>
>
> dyoo at mithril:~/work/mzscheme-vm/tests/42$ cat 42.ss
> #lang scheme/base
> 42
>
>
>
> Under vanilla mzc, I'm getting the following:
>
> dyoo at mithril:~/work/mzscheme-vm/tests/42/compiled$ ls
> 42_ss.dep 42_ss.zo
> dyoo at mithril:~/work/mzscheme-vm/tests/42/compiled$ mzscheme
> Welcome to MzScheme v4.2.5 [3m], Copyright (c) 2004-2010 PLT Scheme Inc.
> > (require compiler/zo-parse)
> > (zo-parse (open-input-file "42_ss.zo"))
> #(struct:compilation-top
> 0
> #(struct:prefix 0 (#f) ())
> #(struct:mod
> |42|
> #<module-path-index>
> #(struct:prefix
> 0
> (#(struct:module-variable #<module-path-index> print-values 0 0))
> ())
> ()
> ((0 #<module-path-index>) (1) (-1) (#f))
> (#(struct:apply-values #(struct:toplevel 0 0 #f #f) 42))
> ()
> (() () ())
> 0
> #(struct:toplevel 0 0 #f #f)
> #(scheme/base/lang/reader get-info-getter (scheme/base #f))
> #t))
>
>
>
>
> But under compiler/compiler, I'm getting a different bytecode
> structure which appears to introduce tracing and other debugging
> stuff:
>
> dyoo at mithril:~/work/mzscheme-vm/tests/42/compiled-test$ ls
> 42_ss_merged_ss.zo 42_ss.zo
> dyoo at mithril:~/work/mzscheme-vm/tests/42/compiled-test$ mzscheme
> Welcome to MzScheme v4.2.5 [3m], Copyright (c) 2004-2010 PLT Scheme Inc.
> > (require compiler/zo-parse)
> > (zo-parse (open-input-file "42_ss.zo"))
> #(struct:compilation-top
> 0
> #(struct:prefix 0 (#f) ())
> #(struct:mod
> |42|
> #<module-path-index>
> #(struct:prefix
> 0
> (#(struct:module-variable #<module-path-index> init-test-coverage 1 0)
> #(struct:module-variable #<module-path-index> errortrace-key 0 0)
> #(struct:module-variable #<module-path-index> print-values 0 0))
> ())
> ()
> ((0 #<module-path-index> #<module-path-index>)
> (1 #<module-path-index>)
> (-1)
> (#f))
> (#(struct:application #(struct:toplevel 1 0 #f #f) (()))
> #(struct:with-cont-mark
> #(struct:toplevel 0 1 #f #f)
> ((call-with-values (lambda () '42) print-values)
> "../tests/42/42.ss"
> 2
> 0
> 19
> 2)
> #(struct:apply-values #(struct:toplevel 0 2 #f #f) 42)))
> ()
> (() () ())
> 1
> #(struct:toplevel 0 0 #f #f)
> #f
> #(struct:stx
> #(struct:wrapped
> #f
> (#(struct:module-rename
> 0
> normal
> 935326
> (#(struct:all-from-module #<module-path-index> 0 0 () #f)
> #(struct:all-from-module #<module-path-index> 0 0 () #f))
> ()
> ()
> #f)
> #(struct:module-rename
> 0
> normal
> 935326
> (#(struct:all-from-module #<module-path-index> 0 0 () #f)
> #(struct:all-from-module #<module-path-index> 0 0 () #f))
> ()
> ()
> #f)
> #(struct:module-rename
> 0
> normal
> 935326
> (#(struct:all-from-module #<module-path-index> 0 0 () #f)
> #(struct:all-from-module #<module-path-index> 0 0 () #f))
> ()
> ()
> #f)
> #(struct:module-rename
> 0
> normal
> 935326
> (#(struct:all-from-module #<module-path-index> 0 0 () #f)
> #(struct:all-from-module #<module-path-index> 0 0 () #f))
> ()
> ()
> #f))
> #f))))
>
>
>
>
>
> What I do to reset the compiler/compiler collection so that it has
> identical behavior to mzc?
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme