schemify: fix potential "optimization" of too-early use
The part of schemify that checks for simple bindings was not keeping track of when it should be checking for only simple procedure forms.
This commit is contained in:
parent
58371b95d4
commit
1646d294fd
|
@ -3314,6 +3314,19 @@ case of module-leve bindings; it doesn't cover local bindings.
|
|||
(namespace-require ''uses-a-module-2)
|
||||
(test 'done eval '(m)))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Make sure a too-early function use is not inlined away
|
||||
|
||||
(module uses-a-function-too-early racket/base
|
||||
(define f
|
||||
(let ([v (g)])
|
||||
(lambda ()
|
||||
v)))
|
||||
(define (g)
|
||||
0))
|
||||
|
||||
(err/rt-test/once (dynamic-require ''uses-a-function-too-early #f))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -99,19 +99,20 @@
|
|||
(match v
|
||||
[`(lambda . ,_) #t]
|
||||
[`(case-lambda . ,_) #t]
|
||||
[`(let-values ([(,id) ,rhs]) ,body) (let-lambda? id rhs body)]
|
||||
[`(letrec-values ([(,id) ,rhs]) ,body) (let-lambda? id rhs body)]
|
||||
[`(let ([,id ,rhs]) ,body) (let-lambda? id rhs body)]
|
||||
[`(letrec* ([,id ,rhs]) ,body) (let-lambda? id rhs body)]
|
||||
[`(let-values ([(,id) ,rhs]) ,body) (let-lambda? id rhs body #:simple? simple?)]
|
||||
[`(letrec-values ([(,id) ,rhs]) ,body) (let-lambda? id rhs body #:simple? simple?)]
|
||||
[`(let ([,id ,rhs]) ,body) (let-lambda? id rhs body #:simple? simple?)]
|
||||
[`(letrec* ([,id ,rhs]) ,body) (let-lambda? id rhs body #:simple? simple?)]
|
||||
[`(let-values ,_ ,body) (and (not simple?) (lambda? body))]
|
||||
[`(letrec-values ,_ ,body) (and (not simple?) (lambda? body))]
|
||||
[`(begin ,body) (lambda? body)]
|
||||
[`(values ,body) (lambda? body)]
|
||||
[`(begin ,body) (lambda? body #:simple? simple?)]
|
||||
[`(values ,body) (lambda? body #:simple? simple?)]
|
||||
[`,_ #f]))
|
||||
|
||||
(define (let-lambda? id rhs body)
|
||||
(or (and (wrap-eq? id body) (lambda? rhs))
|
||||
(lambda? body)))
|
||||
(define (let-lambda? id rhs body #:simple? simple?)
|
||||
(or (and (wrap-eq? id body) (lambda? rhs #:simple? simple?))
|
||||
(and (not simple?)
|
||||
(lambda? body #:simple? simple?))))
|
||||
|
||||
;; Extract procedure from a form on which `lambda?` produces true
|
||||
(define (extract-lambda v)
|
||||
|
|
Loading…
Reference in New Issue
Block a user