mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 20:45:06 +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
|
;; Helper for the next function
|
||||||
(define (inline-prim-call? exp ivars args)
|
(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
|
;; faster and safer but (at least for now) misses some
|
||||||
;; opportunities for optimization because it takes a global
|
;; opportunities for optimization because it takes a global
|
||||||
;; approach rather than considering the specific variables
|
;; approach rather than considering the specific variables
|
||||||
|
@ -695,18 +696,23 @@
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (v)
|
(lambda (v)
|
||||||
(with-var v (lambda (var)
|
(with-var v (lambda (var)
|
||||||
|
(if (adbv:mutated-indirectly? var)
|
||||||
|
(set! cannot-inline #t))
|
||||||
(if (not (adbv:inlinable var))
|
(if (not (adbv:inlinable var))
|
||||||
(set! fast-inline #f)))))
|
(set! fast-inline #f)))))
|
||||||
ivars)
|
ivars)
|
||||||
(if fast-inline
|
(cond
|
||||||
;; Fast path, no need for more analysis
|
(cannot-inline #f)
|
||||||
fast-inline
|
(else
|
||||||
;; Fast path failed, see if we can inline anyway
|
(if fast-inline
|
||||||
(call/cc
|
;; Fast path, no need for more analysis
|
||||||
(lambda (return)
|
fast-inline
|
||||||
;(trace:error `(inline-ok? ,exp ,ivars ,args))
|
;; Fast path failed, see if we can inline anyway
|
||||||
(inline-ok? exp ivars args (list #f) return)
|
(call/cc
|
||||||
(return #t))))))
|
(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
|
;; Make sure inlining a primitive call will not cause out-of-order execution
|
||||||
;; exp - expression to search
|
;; exp - expression to search
|
||||||
|
|
Loading…
Add table
Reference in a new issue