Experimental inline change

At least for now, use both inlinable analysis (fast path) and inline-ok (slow path, but finds more optimizations).
This commit is contained in:
Justin Ethier 2016-11-10 20:59:38 +00:00
parent aa70c5ece9
commit 004fa655d5

View file

@ -642,20 +642,26 @@
;; Helper for the next function
(define (inline-prim-call? exp ivars args)
(call/cc
(lambda (return)
;; TODO:
;; experimenting with switching inline-ok? with code using data from analysis DB
;(trace:error `(inline-ok? ,exp ,ivars ,args))
;(inline-ok? exp ivars args (list #f) return)
(for-each
(lambda (v)
(with-var v (lambda (var)
(if (not (adbv:inlinable var))
(return #f)))))
ivars)
;; End experimental code
(return #t))))
(let ((fast-inline #t))
;; 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
;; involved for any given optimization.
(for-each
(lambda (v)
(with-var v (lambda (var)
(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))))))
;; Make sure inlining a primitive call will not cause out-of-order execution
;; exp - expression to search