mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Do not inline if there is an indirect mutation
This commit is contained in:
parent
11cf558ba8
commit
88e54286bb
1 changed files with 16 additions and 10 deletions
|
@ -687,7 +687,8 @@
|
|||
|
||||
;; Helper for the next function
|
||||
(define (inline-prim-call? exp ivars args)
|
||||
(let ((fast-inline #t))
|
||||
(let ((fast-inline #t)
|
||||
(cannot-inline #f))
|
||||
;; faster and safer but (at least for now) misses some
|
||||
;; opportunities for optimization because it takes a global
|
||||
;; approach rather than considering the specific variables
|
||||
|
@ -695,18 +696,23 @@
|
|||
(for-each
|
||||
(lambda (v)
|
||||
(with-var v (lambda (var)
|
||||
(if (adbv:mutated-indirectly? var)
|
||||
(set! cannot-inline #t))
|
||||
(if (not (adbv:inlinable var))
|
||||
(set! fast-inline #f)))))
|
||||
ivars)
|
||||
(if fast-inline
|
||||
;; Fast path, no need for more analysis
|
||||
fast-inline
|
||||
;; Fast path failed, see if we can inline anyway
|
||||
(call/cc
|
||||
(lambda (return)
|
||||
;(trace:error `(inline-ok? ,exp ,ivars ,args))
|
||||
(inline-ok? exp ivars args (list #f) return)
|
||||
(return #t))))))
|
||||
(cond
|
||||
(cannot-inline #f)
|
||||
(else
|
||||
(if fast-inline
|
||||
;; Fast path, no need for more analysis
|
||||
fast-inline
|
||||
;; Fast path failed, see if we can inline anyway
|
||||
(call/cc
|
||||
(lambda (return)
|
||||
;(trace:error `(inline-ok? ,exp ,ivars ,args))
|
||||
(inline-ok? exp ivars args (list #f) return)
|
||||
(return #t))))))))
|
||||
|
||||
;; Make sure inlining a primitive call will not cause out-of-order execution
|
||||
;; exp - expression to search
|
||||
|
|
Loading…
Add table
Reference in a new issue