cs: remove compile-as-independent? mode

This slower mode hasn't turned out to be needed, and since it hasn't
been used, it probably doesn't work anymore.
This commit is contained in:
Matthew Flatt 2019-06-17 08:04:04 -06:00
parent 9d55443e23
commit 6d200e6143
5 changed files with 23 additions and 119 deletions

View File

@ -352,9 +352,7 @@ for a suggestion on setting `PLT_ZO_PATH`.
When you change "rumble" or other layers, you can continue to use
Racket modules that were previously compiled to ".zo" form... usually,
but inlining optimizations and similar compiler choices can break
compatibility. Set `compile-as-independent?` to #t in "expander.sls"
to make compiled Racket modules reliably compatible with changes to
the layers here (at the expense of some performance).
compatibility.
FFI Differences
---------------
@ -477,23 +475,6 @@ configuration:
`racket/base` from source. Since the implementation is in pretty
good shape, `UNSAFE_COMP` is enabled by default.
* `compile-as-independent?` is #f in "expander.sls" --- currently set
to #f by default. See "Development Mode" above for more
information.
Effectiveness: Without also enabling `UNSAFE_COMP`, setting
`compile-as-independent?` to #f slows down tasks like loading
`racket/base` from source, but substantially improves programs
where the Chez Scheme optimizer needs to recognize uses of
primitives (e.g., microbenchmarks). Combining with `UNSAFE_COMP`
speeds up loading `racket/base` from source, too.
The combination of `UNSAFE_COMP` and `compile-as-independent?`
enables inlining of unsafe function bodies. For example,
`variable-ref/no-check` inlines as lots of code in safe mode and
little code in unsafe mode; lots of code doesn't run more slowly,
but it compiles more slowly.
* `DEBUG_COMP` not enabled --- or, if you enable it, run `make
strip`.

View File

@ -35,11 +35,6 @@
(include "place-register.ss")
(define-place-register-define define expander-register-start expander-register-count)
;; Set to `#t` to make compiled code reliably compatible with
;; changes to primitive libraries. Changing ths setting makes
;; the build incompatible with previously generated ".zo" files.
(define compile-as-independent? #f)
;; The expander needs various tables to set up primitive modules, and
;; the `primitive-table` function is the bridge between worlds
@ -93,100 +88,31 @@
;; ----------------------------------------
;; The environment is used to evaluate linklets, so all primitives
;; need to be there imported (prefered) or defined (less efficient,
;; but less tied to library implementations)
(unless compile-as-independent?
(parameterize ([expand-omit-library-invocations #f])
(eval `(import (rename (rumble)
[correlated? syntax?]
[correlated-source syntax-source]
[correlated-line syntax-line]
[correlated-column syntax-column]
[correlated-position syntax-position]
[correlated-span syntax-span]
[correlated-e syntax-e]
[correlated->datum syntax->datum]
[datum->correlated datum->syntax]
[correlated-property syntax-property]
[correlated-property-symbol-keys syntax-property-symbol-keys])
(thread)
(io)
(regexp)
(linklet)
(only (schemify)
force-unfasl)))
;; Ensure that the library is visited, especially for a wpo build:
(eval 'variable-set!)))
;; need to be there imported there
(parameterize ([expand-omit-library-invocations #f])
(eval `(import (rename (rumble)
[correlated? syntax?]
[correlated-source syntax-source]
[correlated-line syntax-line]
[correlated-column syntax-column]
[correlated-position syntax-position]
[correlated-span syntax-span]
[correlated-e syntax-e]
[correlated->datum syntax->datum]
[datum->correlated datum->syntax]
[correlated-property syntax-property]
[correlated-property-symbol-keys syntax-property-symbol-keys])
(thread)
(io)
(regexp)
(linklet)
(only (schemify)
force-unfasl)))
;; Ensure that the library is visited, especially for a wpo build:
(eval 'variable-set!))
(eval `(define primitive-table ',primitive-table))
(let ([install-table
(lambda (table)
(hash-for-each table
(lambda (k v)
;; Avoid redefining some primitives that we
;; don't have to replace:
(unless (memq k '(vector
list cons car cdr
eq?
values call-with-values))
(eval `(define ,k ',v))))))])
(when compile-as-independent?
(install-table kernel-table)
(install-table unsafe-table)
(install-table flfxnum-table)
(install-table paramz-table)
(install-table extfl-table)
(install-table network-table)
(install-table futures-table)
(install-table place-table)
(install-table foreign-table)
(install-table linklet-table)
(install-table internal-table)
(install-table schemify-table)))
(when compile-as-independent?
;; Copies of macros provided by `rumble`, plus
;; other bindings assumed by schemify:
(eval '(define-syntax with-continuation-mark
(syntax-rules ()
[(_ key val body)
(call-with-current-continuation-attachment
empty-mark-frame
(lambda (a)
(call-setting-continuation-attachment
(mark-frame-update a key val)
(lambda ()
body))))])))
(eval '(define call-with-immediate-continuation-mark call-with-immediate-continuation-mark/proc))
(eval '(define-syntax begin0
(syntax-rules ()
[(_ expr0 expr ...)
(call-with-values (lambda ()
(call-with-values (lambda () expr0)
(case-lambda
[(x) (values x #f)]
[args (values args #t)])))
(lambda (l apply?)
expr ...
(if apply?
(#%apply values l)
l)))])))
(eval '(define-syntax (|#%app| stx)
(syntax-case stx ()
[(_ rator rand ...)
(with-syntax ([n-args (length #'(rand ...))])
#'((extract-procedure rator n-args) rand ...))])))
(eval '(define-syntax-rule (extract-procedure f n-args)
(let ([tmp f])
(if (#%procedure? tmp)
tmp
(slow-extract-procedure tmp n-args)))))
(eval '(define-syntax (|#%name| stx)
(syntax-case stx ()
[(_ name val) #`(let ([name val]) name)])))
(eval `(define raise-binding-result-arity-error ',raise-binding-result-arity-error)))
;; For interpretation of the outer shell of a linklet:
(install-linklet-primitive-tables! kernel-table
unsafe-table

View File

@ -1,5 +1,4 @@
;; See copy in "expander.sls"
(define-syntax begin0
(syntax-rules (void)
[(_ expr0) expr0]

View File

@ -887,7 +887,6 @@
[(elem+cache? a) (extract-mark-from-frame* (elem+cache-elem a) key default-v wrapper)]
[else default-v]))
;; See copy in "expander.sls"
(define-syntax with-continuation-mark
(syntax-rules ()
[(_ key val body)

View File

@ -54,7 +54,6 @@
[else (fx+ 1 (loop (cdr argss)))]))])
(#2%apply #2%apply (extract-procedure proc len) argss)))]))
;; See copy in "expander.sls"
(define-syntax (|#%app| stx)
(syntax-case stx ()
[(_ rator rand ...)