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)]
|
||||
[else l]))
|
||||
|
||||
(define startup-submodule
|
||||
(if submod-name
|
||||
`(submod ,startup-module ,submod-name)
|
||||
startup-module))
|
||||
|
||||
(cond
|
||||
[expand?
|
||||
(pretty-write (syntax->datum (apply-to-module expand startup-module)))]
|
||||
|
@ -343,16 +348,19 @@
|
|||
(extract-linklets
|
||||
(apply-to-module compile startup-module))
|
||||
#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
|
||||
;; Load and run the requested module
|
||||
(parameterize ([current-command-line-arguments (list->vector args)])
|
||||
(namespace-require (if submod-name
|
||||
`(submod ,startup-module ,submod-name)
|
||||
startup-module)))])
|
||||
(namespace-require startup-submodule))])
|
||||
|
||||
|
||||
(when extract?
|
||||
;; Extract a bootstrapping slice of the requested module
|
||||
(extract startup-module cache
|
||||
(extract startup-submodule cache
|
||||
#:print-extracted-to print-extracted-to
|
||||
#:as-c? extract-to-c?
|
||||
#:as-decompiled? extract-to-decompiled?
|
||||
|
|
|
@ -36,7 +36,7 @@ io-src: $(RKTIO_DEP)
|
|||
$(RACO) make ../expander/bootstrap-run.rkt
|
||||
$(MAKE) io-src-generate
|
||||
|
||||
GENERATE_ARGS = -t main.rkt --submod main \
|
||||
GENERATE_ARGS = -t main.rkt \
|
||||
--check-depends $(BUILDDIR)compiled/io-dep.rktd \
|
||||
++depend-module ../expander/bootstrap-run.rkt \
|
||||
++depend ../rktio/rktio.rktl \
|
||||
|
|
|
@ -65,5 +65,3 @@
|
|||
(install-error-value->string-handler!)
|
||||
(init-current-directory!)
|
||||
(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)))))"
|
||||
"(define-values(call/ec) call-with-escape-continuation)"
|
||||
"(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)"
|
||||
" (lambda (who_0 orig-l_0) (begin 'bad-list (raise-mismatch-error who_0 \"not a proper list: \" orig-l_0))))"
|
||||
"(define-values"
|
||||
|
@ -19097,7 +19100,7 @@ static const char *startup_source =
|
|||
"(let-values(((type_0)(read-byte/no-eof i_0)))"
|
||||
"(let-values(((tmp_0) type_0))"
|
||||
"(let-values(((index_0)"
|
||||
"(if(fixnum? tmp_0)"
|
||||
"(if(fixnum-for-every-system? tmp_0)"
|
||||
"(if(if(unsafe-fx>= tmp_0 1)"
|
||||
"(unsafe-fx< tmp_0 41)"
|
||||
" #f)"
|
||||
|
|
|
@ -34,7 +34,7 @@ GLOBALS = --no-global \
|
|||
++global-ok log-place-event
|
||||
|
||||
|
||||
GENERATE_ARGS = -t main.rkt --submod main \
|
||||
GENERATE_ARGS = -t main.rkt \
|
||||
--check-depends $(BUILDDIR)compiled/thread-dep.rktd \
|
||||
++depend-module ../expander/bootstrap-run.rkt \
|
||||
--depends $(BUILDDIR)compiled/thread-dep.rktd \
|
||||
|
|
|
@ -211,5 +211,3 @@
|
|||
unsafe-os-semaphore-wait
|
||||
|
||||
#%thread-instance)
|
||||
|
||||
(module main racket/base)
|
||||
|
|
Loading…
Reference in New Issue
Block a user