expander: fix extract mode to not run and work with a submodule root
Also, report an error, for now, if a cache directory is not specified in extract mode, since extraction doesn't currently work without it.
This commit is contained in:
parent
8f85df64d9
commit
62f1243136
|
@ -334,6 +334,11 @@
|
||||||
[(linklet-as-s-expr? l) (linklet-as-s-expr l)]
|
[(linklet-as-s-expr? l) (linklet-as-s-expr l)]
|
||||||
[else l]))
|
[else l]))
|
||||||
|
|
||||||
|
(define startup-submodule
|
||||||
|
(if submod-name
|
||||||
|
`(submod ,startup-module ,submod-name)
|
||||||
|
startup-module))
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
[expand?
|
[expand?
|
||||||
(pretty-write (syntax->datum (apply-to-module expand startup-module)))]
|
(pretty-write (syntax->datum (apply-to-module expand startup-module)))]
|
||||||
|
@ -343,16 +348,19 @@
|
||||||
(extract-linklets
|
(extract-linklets
|
||||||
(apply-to-module compile startup-module))
|
(apply-to-module compile startup-module))
|
||||||
#f)))]
|
#f)))]
|
||||||
|
[extract?
|
||||||
|
(unless cache-dir (error 'run "extract mode requires a cache directory"))
|
||||||
|
;; Put target module in the cache without running it
|
||||||
|
(dynamic-require startup-module (void))]
|
||||||
[else
|
[else
|
||||||
;; Load and run the requested module
|
;; Load and run the requested module
|
||||||
(parameterize ([current-command-line-arguments (list->vector args)])
|
(parameterize ([current-command-line-arguments (list->vector args)])
|
||||||
(namespace-require (if submod-name
|
(namespace-require startup-submodule))])
|
||||||
`(submod ,startup-module ,submod-name)
|
|
||||||
startup-module)))])
|
|
||||||
|
|
||||||
(when extract?
|
(when extract?
|
||||||
;; Extract a bootstrapping slice of the requested module
|
;; Extract a bootstrapping slice of the requested module
|
||||||
(extract startup-module cache
|
(extract startup-submodule cache
|
||||||
#:print-extracted-to print-extracted-to
|
#:print-extracted-to print-extracted-to
|
||||||
#:as-c? extract-to-c?
|
#:as-c? extract-to-c?
|
||||||
#:as-decompiled? extract-to-decompiled?
|
#:as-decompiled? extract-to-decompiled?
|
||||||
|
|
|
@ -36,7 +36,7 @@ io-src: $(RKTIO_DEP)
|
||||||
$(RACO) make ../expander/bootstrap-run.rkt
|
$(RACO) make ../expander/bootstrap-run.rkt
|
||||||
$(MAKE) io-src-generate
|
$(MAKE) io-src-generate
|
||||||
|
|
||||||
GENERATE_ARGS = -t main.rkt --submod main \
|
GENERATE_ARGS = -t main.rkt \
|
||||||
--check-depends $(BUILDDIR)compiled/io-dep.rktd \
|
--check-depends $(BUILDDIR)compiled/io-dep.rktd \
|
||||||
++depend-module ../expander/bootstrap-run.rkt \
|
++depend-module ../expander/bootstrap-run.rkt \
|
||||||
++depend ../rktio/rktio.rktl \
|
++depend ../rktio/rktio.rktl \
|
||||||
|
|
|
@ -65,5 +65,3 @@
|
||||||
(install-error-value->string-handler!)
|
(install-error-value->string-handler!)
|
||||||
(init-current-directory!)
|
(init-current-directory!)
|
||||||
(init-current-ports! in-fd out-fd err-fd cust plumber))
|
(init-current-ports! in-fd out-fd err-fd cust plumber))
|
||||||
|
|
||||||
(module main racket/base)
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ static const char *startup_source =
|
||||||
" (lambda (a_0 b_0) (begin (if (list? a_0) (append a_0 b_0) (raise-argument-error 'unquote-splicing \"list?\" a_0)))))"
|
" (lambda (a_0 b_0) (begin (if (list? a_0) (append a_0 b_0) (raise-argument-error 'unquote-splicing \"list?\" a_0)))))"
|
||||||
"(define-values(call/ec) call-with-escape-continuation)"
|
"(define-values(call/ec) call-with-escape-continuation)"
|
||||||
"(define-values"
|
"(define-values"
|
||||||
|
"(fixnum-for-every-system?)"
|
||||||
|
"(lambda(v_0)(begin(if(fixnum? v_0)(if(fx>= v_0 -536870912)(fx<= v_0 536870911) #f) #f))))"
|
||||||
|
"(define-values"
|
||||||
"(bad-list$1)"
|
"(bad-list$1)"
|
||||||
" (lambda (who_0 orig-l_0) (begin 'bad-list (raise-mismatch-error who_0 \"not a proper list: \" orig-l_0))))"
|
" (lambda (who_0 orig-l_0) (begin 'bad-list (raise-mismatch-error who_0 \"not a proper list: \" orig-l_0))))"
|
||||||
"(define-values"
|
"(define-values"
|
||||||
|
@ -19097,7 +19100,7 @@ static const char *startup_source =
|
||||||
"(let-values(((type_0)(read-byte/no-eof i_0)))"
|
"(let-values(((type_0)(read-byte/no-eof i_0)))"
|
||||||
"(let-values(((tmp_0) type_0))"
|
"(let-values(((tmp_0) type_0))"
|
||||||
"(let-values(((index_0)"
|
"(let-values(((index_0)"
|
||||||
"(if(fixnum? tmp_0)"
|
"(if(fixnum-for-every-system? tmp_0)"
|
||||||
"(if(if(unsafe-fx>= tmp_0 1)"
|
"(if(if(unsafe-fx>= tmp_0 1)"
|
||||||
"(unsafe-fx< tmp_0 41)"
|
"(unsafe-fx< tmp_0 41)"
|
||||||
" #f)"
|
" #f)"
|
||||||
|
|
|
@ -34,7 +34,7 @@ GLOBALS = --no-global \
|
||||||
++global-ok log-place-event
|
++global-ok log-place-event
|
||||||
|
|
||||||
|
|
||||||
GENERATE_ARGS = -t main.rkt --submod main \
|
GENERATE_ARGS = -t main.rkt \
|
||||||
--check-depends $(BUILDDIR)compiled/thread-dep.rktd \
|
--check-depends $(BUILDDIR)compiled/thread-dep.rktd \
|
||||||
++depend-module ../expander/bootstrap-run.rkt \
|
++depend-module ../expander/bootstrap-run.rkt \
|
||||||
--depends $(BUILDDIR)compiled/thread-dep.rktd \
|
--depends $(BUILDDIR)compiled/thread-dep.rktd \
|
||||||
|
|
|
@ -211,5 +211,3 @@
|
||||||
unsafe-os-semaphore-wait
|
unsafe-os-semaphore-wait
|
||||||
|
|
||||||
#%thread-instance)
|
#%thread-instance)
|
||||||
|
|
||||||
(module main racket/base)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user