Cleanup box optimizations.
This commit is contained in:
parent
010f9e1ef4
commit
6c4ee21348
|
@ -11,24 +11,16 @@
|
||||||
|
|
||||||
(provide box-opt-expr)
|
(provide box-opt-expr)
|
||||||
|
|
||||||
(define-syntax-class box-expr
|
(define-unsafe-syntax-class unbox)
|
||||||
#:commit
|
(define-unsafe-syntax-class set-box!)
|
||||||
(pattern e:expr
|
|
||||||
#:when (match (type-of #'e)
|
|
||||||
[(tc-result1: (Box: _)) #t]
|
|
||||||
[_ #f])
|
|
||||||
#:with opt ((optimize) #'e)))
|
|
||||||
|
|
||||||
(define-syntax-class box-op
|
(define-syntax-class box-op
|
||||||
#:commit
|
#:attributes (unsafe)
|
||||||
;; we need the * versions of these unsafe operations to be chaperone-safe
|
(pattern :unbox^)
|
||||||
(pattern (~literal unbox) #:with unsafe #'unsafe-unbox)
|
(pattern :set-box!^))
|
||||||
(pattern (~literal set-box!) #:with unsafe #'unsafe-set-box!))
|
|
||||||
|
|
||||||
(define-syntax-class box-opt-expr
|
(define-syntax-class box-opt-expr
|
||||||
#:commit
|
#:commit
|
||||||
(pattern (#%plain-app op:box-op b:box-expr new:expr ...)
|
(pattern (#%plain-app op:box-op b:opt-expr new:opt-expr ...)
|
||||||
#:with opt
|
#:do [(log-opt "box" "Box check elimination.")]
|
||||||
(begin (log-optimization "box" "Box check elimination." this-syntax)
|
#:with opt #`(op.unsafe b.opt new.opt ...)))
|
||||||
(add-disappeared-use #'op)
|
|
||||||
#`(op.unsafe b.opt #,@(stx-map (optimize) #'(new ...))))))
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user