cs: compile FFI stubs in unsafe mode
Unsafe mode saves time compiling the stubs (which happens dynamically for programs using `ffi/unsafe`) more than running them.
This commit is contained in:
parent
d3d0bffb88
commit
f8bc4e8fa1
|
@ -208,13 +208,19 @@
|
||||||
;; `compile`, `interpret`, etc. have `dynamic-wind`-based state
|
;; `compile`, `interpret`, etc. have `dynamic-wind`-based state
|
||||||
;; that need to be managed correctly when swapping Racket
|
;; that need to be managed correctly when swapping Racket
|
||||||
;; engines/threads.
|
;; engines/threads.
|
||||||
(define (compile* e)
|
(define compile*
|
||||||
(call-with-system-wind (lambda ()
|
(case-lambda
|
||||||
(if assembly-on?
|
[(e safe?)
|
||||||
(parameterize ([#%$assembly-output (#%current-output-port)])
|
(call-with-system-wind (lambda ()
|
||||||
(printf ";; assembly ---------------------\n")
|
(parameterize ([optimize-level (if safe?
|
||||||
(compile e))
|
(optimize-level)
|
||||||
(compile e)))))
|
3)])
|
||||||
|
(if assembly-on?
|
||||||
|
(parameterize ([#%$assembly-output (#%current-output-port)])
|
||||||
|
(printf ";; assembly ---------------------\n")
|
||||||
|
(compile e))
|
||||||
|
(compile e)))))]
|
||||||
|
[(e) (compile* e #t)]))
|
||||||
(define (interpret* e)
|
(define (interpret* e)
|
||||||
(call-with-system-wind (lambda () (interpret e))))
|
(call-with-system-wind (lambda () (interpret e))))
|
||||||
(define (fasl-write* s o)
|
(define (fasl-write* s o)
|
||||||
|
@ -225,7 +231,7 @@
|
||||||
(define (eval/foreign e mode)
|
(define (eval/foreign e mode)
|
||||||
(performance-region
|
(performance-region
|
||||||
mode
|
mode
|
||||||
(compile* e)))
|
(compile* e #f)))
|
||||||
|
|
||||||
(define primitives (make-hasheq)) ; hash of sym -> known
|
(define primitives (make-hasheq)) ; hash of sym -> known
|
||||||
(define primitive-tables '()) ; list of (cons sym hash)
|
(define primitive-tables '()) ; list of (cons sym hash)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user